I have had this idea hatch in my mind for some while... To make a programming IDE little similar to Lazarus, although much simpler. It would require only FPC compiler to make executables. User would use written and possibly some visual designing aswell to program games. IDE would create a full fpc source code out of it, adding all the "carbage code" required in freepascal language.
Theoretically a full application that draws image on screen could look something like this:
This is just first sketch of idea, but i think it would greatly simplify game making. A package in this case would be a wrapper unit that adds available commands, types and variables. It would be required to make a system unit which adds all basic functions, and that would be autoincluded. I just added nxpascal as example, but basically you can use many graphics libraries in a big mix, if they are all based on OpenGL.Code:using Window, Input window = MakeWindow // I guess name overloading with packages is allowed. // It could make it var_window for the fpc source code. using nxpascal UseOpenGL(window) texture = LoadTexture("test.png") // Or have the texture list in the IDE, call LoadTextures(TexList1), and Draw using index 0 // Here could start thread instead, example below repeat Draw(texture) // or Draw(texture, 0, 0) FlipOpenGL wait // This calls Application.ProcessMessages until keys[KEY_ENTER] FreeOpenGL(window) end //window.Free // Not exactly sure if this is needed, or it it should be written like that, or //FreeWindow(window) end
Also, most importantly, through packages it is possible to make a very powerful code completion. Opening lists of available commands as you type, completing lines with tab key. Language insist of automatically indenting code where proper blocks exists, so it won't be possible to make 2 commands on 1 line. This is for clarity, and requirement for possibly cool features for the IDE.
Finally thread possibility:
Small issues i didn't fix in that yet:Code:... StartThread(gameThread) ... thread gameThread repeat Draw(texture) // or Draw(texture, 0, 0) FlipOpenGL wait // This calls Application.ProcessMessages until keys[KEY_ENTER] CloseProc end // Auto initialize all procedures and functions in source code. // It shouldn't reduce performance or add to the exe size, but lets use them in other procs before it. proc CloseProc FreeOpenGL(window) end
- Keyboard and mouse Input is not updated (attach it to Wait?)
- Threads and procs need own "using" blocks, or write them inside the first blocks?
Suggestions, ideas welcome...