March 8th, 2014, 04:40 PM
My game engine project
Firstly, I want to talk about a project I have been engaging in for 3-5 months which started with building a simple high level graphics library and came to a point that I can make and use my own tools to help the process of making game.I will add new features on occasion as always. My intention here was to create miscellaneous, small library packets like graphics, matrices, font, gui, geometry, physics, file system, string and and lastly merge all these together in order to transform these total code base to an engine.I use OpenGL 3.3+ for rendering, SDL for basic needs of user interaction and GLEW for context binding.
Let me dig into what I did first days,
I started graphics library with adding an abstraction for drawings of basic shape which old OpenGL version users should be familiar with because it is very similar to Begin-End structure.It is very useful with its simplicity, suitable for fast prototyping and preferable instead of having to write same functions like glGenBuffers, glBindBuffers, glBufferData, glDrawArray/Elements etc. each time.It can be used with static mode too for performance reasons.Vertex and Fragment shader is fixed pipeline for now but I will write new shaders later for optimisation.It meets all 2D/3D drawing needs and effects for a primitive game like stickman I did to test my first physical interaction class written with OOP method
For vital matrix operation in 2D and especially 3D games, I wrote another library called linear algebra which performs similar or same tasks that can be done with old glRotate*, glScale*, glTranslate*, glLookAt, gluPerspective stuff or GLM library.After I proved inner workings of these matrices on paper with trigonometer, similarity and simple logic, with a weird insistence of doing every thing by myself, I passed these formulas to the computer.
I subsequently dealed with text processing as a preparation to the basic font library to use in gui project which is the point I reach and can create projects on top of that anymore.Font library basicly inludes a class to load my invented format FNT(which stands for "font" as you will guess) and a style class to specify the font file that will be used, and configurations of the text that will be able to be showed in form of different size, italicness, boldness and horizontal and vertical text spacing.It has useful functions such as getting width and height of the text according to current style that bound to the context.
Then, I started building the actual gui that I will use in most of my tool project.It was a terrible experience at fist due to the overwhelming majority of task that will be fullfilled; however, this didn't prevent me from bring the basic frame layer system I toided and moiled to a middleware consisting of a set of reusable class.It can be used for layered windows, and contents like buttons, textarea, clickable images, sliders, checkbox, table on them or menus like "copy, paste, delete, cut" when right-clicking with mouse.
Afterwards I made my first program to draw basic shapes that can be drawn by MS-Paint too.I was ready to draw somethings on the canvas to use in other projects later, after I imitated its most important features by reverse-engineering (namely approximation).Tools like Pencil, Paint Bucket, ColorPicker, Color Management, and vectorial shortcuts such as line, rectangle, circle is completed.I can easily add new features because I can expand the basic layer.For example, the line drawer is suitable to coin new shape like diamond so it is open to extra tools using same logic or for further improvements on the usage of drawings such as uncovering another image when drawing top layer with normal drawing tools.
You can download my image editor from here.
File size : 1.22 MB
Valid keyboard shortcuts:
ctrl + z : undos the last operation
ctrl + y : redos
ctrl + s : saves to the file path specified at file manager.(Do not forget to add .bmp at the end of the file name.It is one format you can deal with ) Saves to same folder as of the program if you don't specify a sub-folder
ctrl + l : loads the image at the written file path in file manager
ctrl + alt + r : can be used to resize canvas.(A canvas can't be larger than 1000x1000 px for now)
not : ctrl + z and y can be seen only when mouse hovers the canvas(This is a bug I couldn't fix it yet and put on one side)
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!