Programming Logic

BlitzMax Forums/BlitzMax Beginners Area/Programming Logic

Zumwalt(Posted 2006) [#1]
Ok, I am really getting the hang of this thing, so hold on to your hats, I have a stupid question. Being an OOP person that I am, I like to modularize everything, I hate having 1 page of a gazillion lines of code, I want it neat, simple and easy to find.

That said, my main entry point to the application now reads:

SuperStrict
Framework Brl.Max2D
Import Brl.D3D7Max2D
Import Brl.GLMax2D
Import brl.FreetypeFont
Import Diablo.HighGUI
Import "Generators.bmx"
Import "Globals.bmx"
Import "Functions.bmx"
Import "Incbin.bmx"

playerStats.Race=0

SeedRnd(MilliSecs())
SetGraphicsDriver(GLMax2DDriver())
Graphics(800, 600, 0)
SetMaskColor(255, 0, 255)
hi_THighGUI.Init("Themes/Windows/XP")
SetBlend(ALPHABLEND)
ShowMouse()
Repeat
	Cls
	DrawImage background, 0, 0
	hi_THighGUI.Render()
	hi_THighGUI.Update()
	chkKeys()
	Flip 0
	TFPSCounter.Update()
	GCCollect()
Until Not running


As you can see, I do imports, now, from you professionals, is there a performance hit in how I am accomplishing my tasks or is the the 'appropriate and suggested blitzmax way' of doing things?

I am totally creating types and methods in completely seperate files, at this rate, now that this thing is really taking off the ground, I estimate that using this methodology, I will have a few hundred little bmx files lying around, but before I went crap wild nuts on programming, I wanted to make sure I wouldn't loose anything by doing it this way.

Thanks ahead of time.


kronholm(Posted 2006) [#2]
You won't lose any performance if that's what you're talking about. At least I don't think so. It's a good thing to keep your stuff structured with includes.


Zumwalt(Posted 2006) [#3]
Thanks, thats what I thought, I am dedicating certain files for species, structures, heck you name it, I want each one to stay less than 500 lines if at all humanly possible, starting to even build file level folders to hold the bmx files, I know that won't mean squat in the end other than organization, but like a Human folder, with all the bmx files to organize everything about Humans in it, I was just afraid I was missing a step along the way on how to properly organize the objects.


Chris C(Posted 2006) [#4]
with quick build enabled this *should* speed complation cause all it has to parse is the file you just changed and then do a file changed check on each of the other files, folled by the linking stage.


Zumwalt(Posted 2006) [#5]
Thats what I am looking for, my code gets thicker, so I want my compile to be as fast as possible.


FlameDuck(Posted 2006) [#6]
It would be better to split your imports depending on functionality, rather than syntax. Better for maintenance later on that it.