The perfect use of FrameWork
BlitzMax Forums/BlitzMax Programming/The perfect use of FrameWork
| ||
i try to understand Opengl and i made a little prog. But when i compile it the size of the exe was 768 Kb :(bglCreateContext (800,600,16,0,BGL_BACKBUFFER|BGL_DEPTHBUFFER) While Not KeyHit( KEY_ESCAPE ) glClearColor (0.0, 0.0, 0.0, 0.0) glClear (GL_COLOR_BUFFER_BIT) glPushMatrix () glRotatef (theta, 0.0, 0.0, 1.0) glTranslatef (0.0, 0.0, 0.0) glEnable (GL_LINE_SMOOTH) glBegin (GL_TRIANGLES) glColor3f (1.0, 0.0, 0.0); glVertex2f (0.0, 1.0) glColor3f (0.0, 1.0, 0.0); glVertex2f (0.87, -0.5) glColor3f (0.0, 0.0, 1.0); glVertex2f (-0.87, -0.5) glEnd () glPopMatrix () theta :+ 1.0 Delay (10) bglSwapBuffers Wend i've just added 2 lines in the beginning: Framework BRL.BlitzGL Import BRL.System bglCreateContext .......... size : 50Kb :) |
| ||
is there a guide to frameworks? |
| ||
in the Help -> Language reference -> modules |
| ||
same with the Teapot example from Peter Scheutz in teapot_test.bmx : Framework BRL.BlitzGL Import BRL.System ... in teapot.bmx: Import BRL.Bank ... |
| ||
Sorry, but why if i test this code: Strict FrameWork BRL.Max2D Function SetupSystem() Graphics 640, 480 End Function SetupSystem() While Not KeyHit(KEY_ESCAPE) Cls Flip Wend the compiler stop and say: "D:/Programmi_Gianluca/BlitzMAX/Studio/GSaver" Graphics mode does not exist Process complete ahhhh!!!! framework NightMare!!!!! HELP! |
| ||
I think that the fact that 'Framework' takes one parameter does not make much sense :( You will use more than one module in 99% of the cases, so you have to type 'Framework module' for the first case, and 'Import module' for the rest of the modules. IMHO, it would make more sense if 'Framework' didn't get any parameters, and you specified the modules you want to use with 'Import'. So:Framework BRL.BlitzGL Import BRL.System would become: Framework Import BRL.BlitzGL Import BRL.System |
| ||
Any reason why modules can't be imported automatically? Triggered by any call to a function in a given module I mean. |
| ||
Any reason why modules can't be imported automatically? Triggered by any call to a function in a given module I mean. Seems like a nice idea, one problem I can see is that the compiler would need to know which mod contains the relevant command. But that could be done by searching the modules which could take some time when you have a lot of mods. Perhaps each .mod folder could contain an index that lists the commands it contains (making searching quicker), this index could be autogenerated when the bmx file is rebuilt. *EDIT* Another problem I can see is with duplicate functions, which is inevitably going to happen if you use 3rd party modules. |
| ||
Good point John, that would be useful. Sergio. |
| ||
@GregBUG try that way Framework BRL.GLMax2D Import BRL.System Function SetupSystem() Graphics 640,480 'bglCreateContext 640,480,32,0,BGL_BACKBUFFER|BGL_DEPTHBUFFER End Function SetupSystem() While Not KeyHit(KEY_ESCAPE) Cls Flip Wend |
| ||
Any reason why modules can't be imported automatically? Triggered by any call to a function in a given module I mean. That would be awesome. |
| ||
It'd be nice to have a feature in the IDE or something to automatically insert code for the frameworks that you need only to compile the current program |
| ||
Why not directly from the IDE. I think it's much better ! -> Don't need to import mod. when you build your prog, the IDE will made the imports for you :) |
| ||
I would love this automatic handling of modules. Please make it happen. |
| ||
I think I will write a program that will determine this for you. However, it will take me an annoyingly long time to write because of all of the commands. Anyone care to help? (ooh, perhaps I can write a module parser much like Blitz help does...) |
| ||
i'm in if you want to ! |
| ||
NB: its about the IDE, don't you ? |
| ||
Hrm? |
| ||
sorry, i'm french and i've got a very bad language ? my fault ! |
| ||
Just don't understand what you're trying to say is all... |
| ||
just to make an IDE for BMX with the obvious module parser included -> so i'm in :) |
| ||
sorry, i'm french and i've got a very bad language ? my fault ! Bad language? Mind your french! ;-) Anyway - I definitely want automatic module importing too. It would be nice if it did it automatically until it found dupicate commands, or had some other problems, and at that point gave a compilation error and told you to do it yourself. As for speed, surely it wouldn't be that slow to keep an index of commands and which modules they belong to?! Afterall, it keep an index of commands just for syntax highlighting! |
| ||
The main sticking point is things like imageloaders, the fact you are using the LoadImage command has no bearing on which image loader modules are included. I like the idea of the higher level solution (implement it at IDE level). The .i intermediate files BlitzMax produces should be a lot easier to parse than .bmx so it may not be such a difficult task either. |
| ||
a clever parser inside the "B'Max IDe", that is not an utopia. |
| ||
It would be nice if you use the parser for something for useful, likeFramework BRL[LinkedList,System,PixMaps] Pub[OpenGL] Lua[LuaScript] Also, the ability to read frameworks from a file..so you could create custome framework defs like the above and place them in a framework folder, then like for the above, FrameWork Minimal_App FrameWork Brl[Etc.] - Then, FrameWork Minimal_app in blitz will use that.. I hate the idea of it being tied to the ide. that means click this, click that...i'd rather type it, but not have to retype a ton of headers for every source. |
| ||
well, agreed with you Antony ! |
| ||
If you have a given "Framework Setup" as standard that you use you could create a new module directory called "Frameworks" where you simply create modules that just imports the module you would need for the given type of app. ( just an idea ... created one for my base framework setup :) ) I like the way it actually works but might be because I use protean BM beta where I can simple browse the stuff to see what module I need ... |
| ||
hey dreamora - how do you like protean, do you recommend it? |
| ||
Although it is only Beta at the moment I can recommend it, especially for those that plan to program fully on OO and not using the "flat functions" which is the only thing in the help, because the module viewer shows all types and their functions / internal values / methods of the modules in the mod directory. |
| ||
Protean is the equivalent of taking an elephant and giving it a rocketship. =] |