About this blog
Curious about how to build a 2D engine??
Me too, let's resolve this together making one.
Entries in this blog
here is the last version...
tell me what you thought...give me ideas...
I'm a very bad layouter eauhuah
this layout is very...very ugly I know...but Is the better(believe me) that I get..
Just copy and paste the font file to the c:\windows\fonts please ehehhe
the last link of the game was broked..
Hi my friends...
here is the new version of Predator Engine with some basic controls...
download this file:
Next controls will be the check box, the check button, radio buttons, numeric updown, another panels...
give me ideas..give me =D
Just to keep you informed...
I'm rewriting all the Predator Engine... =D
There was very bugs and the code organization was going to the hell..
I'm writing carefully all components and after the primary controls be ready...I'll post the demo here...
Firstly I would like to left done:
with good features to have few work in get amazing effects...
Ladies and gentlemans..
I present you..
the Predator Engine =P
(clap clap clap clap)
Download it from this address
and test what we got until now..
I made the follow components..
no laughs please...I haven't much time = (
test and send me the bugs and new ideas for I implement it...
Thanx a lot...
Hi my friends...
After this late in post here...
I bring some news...
The PLabel class supports the Outline Fonts, Bitmap Fonts and Texture mapped fonts..
the PPanel class is almost done, it's working now, except by some details that I'll implement tomorrow, like caption align, borders visible, etc...
the PGraphicObjectCollection is dead...it just brought me problems...
PPanel : PInputEventReceiver
unsigned int FTexture;
unsigned int FDisplayListRectWireFrame;
unsigned int FDisplayListRect;
unsigned int FDisplayListRectTexture;
PPanel(SRect* ABounds, int ARectType, IVideoDriver* AVideoDriver);
void SetCaption(PLabel* AValue);
void SetBackgroundColor(SColor* AValue);
void SetBorderColor(SColor* AValue);
void SetTextureFileName(std::string AValue);
void SetBorderWidth(int AValue);
void SetFilled(bool AValue);
The IVideoDriver have some new methods too
virtual AUX_RGBImageRec* LoadBMPRec(std::string AFileName) = 0;
virtual void SetBlend(bool AValue) = 0;
virtual void SetTexture(bool AValue) = 0;
virtual unsigned int GenerateDisplayList(int AListSize) = 0;
virtual void CallDisplayList(unsigned int ADisplayList) = 0;
virtual void DestroyDisplayList(unsigned int ADisplayList, int ASize) = 0;
virtual void LoadTexture(std::string AFileName, unsigned int &ATextureBuffer, int ATextureType) = 0;
virtual void BindTexture(unsigned int ATextureBuffer) = 0;
virtual void DrawText(std::string AText, float ASize, SColor* AColor, SCoord* ACoord, unsigned int ADisplayList, int AFontType) = 0;
virtual unsigned int GenerateDisplayListRectWireFrame(SRect* ABounds, SColor* ABorderColor, int ABorderWidth) = 0;
virtual unsigned int GenerateDisplayListRect(SRect* ABounds, SColor* ABackgroundColor) = 0;
virtual unsigned int GenerateDisplayListRectTexture(SRect* ABounds, SColor* AColor) = 0;
I'm using display list for everything, if someone has any suggestion in how I can approach the performance...tell me...
I have made a little demo with two panels and one running label to show the use of layers and what we have until now:
well...I hope you like the system...
I think that our next step is make some buttons..right?
after some days without post here, I show you the PLabel class...
unsigned int FDisplayList;
PLabel(std::string ACaption, std::string AFontName, int AFontSize, SCoord* ACoord);
void SetCaption(std::string AValue);
void SetColor(SColor* AValue);
void SetFontName(std::string AValue);
void SetWireFrame(bool AValue);
void SetSize(int AValue);
void SetWeight(int AValue);
void SetItalic(bool AValue);
void SetUnderline(bool AValue);
void SetStrikeOut(bool AValue);
This class is quite simple, some properties...
the BuildFont Method, have to be called before the Draw Method
Well, like the title says...I have made some changes in our mechanism...
Now, we have a PGraphicObjectCollection class, that have a list of PGraphicObjects (=P)...
virtual void Sync(void);
the sync method, just distribute the FVideoDriver component(that is unique) between its FObjects...
The Sync Method, must to be called after all objects are inserted and before call methods that uses the FVideoDriver of them.
Okay, I'll try to be more fast and keep on posting everyday...
This is like our 2d engine looks after namespace organization:
(PLabel, PPanel, etc...)
Well..any suggestions =D
After that, I'll start the GUI programming..
I have spent my time reading about create my own engine and use some of existents...
I think about and get in none result = (
I'm here to ask you, what you think?
my next mission is dismember my engine in namespaces,
tomorrow I'll show the engine's new organization
I hope you like...
PS: please give your suggestion about my doubt
Hi my friends...
this is my first post in 2006 =D
I present you the PLayer class:
PLayer : PInputEventReceiver
PLayer(std::string ALayerID, SRect* ABounds, IVideoDriver* AVideoDriver);
void SetLayerID(std::string AValue);
This class will be responsible for Keep all objects in the screen, I prefered use the layers because it has the order benefit...
For while, this class just has this few methods, I have not thought in another funcionallity for it.
The draw method just will draw its graphic objects =D
Tomorrow I'll show the PPanel class and after that, I'll need your help to know "what path I have to follow" =P
PS: I'm sorry about the late...
I'm in home yet...so...I cannot write any code here heheheu
Monday I'll continue our engine and write new content =D
I would like wish you a happy new year =D
I'm home and without my computer with the codes, so...I decided improvise some visual look of our engine...
Above, the images with what we have until now...
Well my friends...I don't know what I'll write until monday, I'm without the computer with the codes...so...be patient =D
Hi everyone, I'm a little hurried, so I will just write here our first main.cpp =D
We can already create some windows and show...
If you are following the previous days, check how simple is the code:
PDevice* MainApplication= new PDevice(vdOpenGL);
MainApplication->CreateNewWindow("MyWindow", new SRect(0, 100, 500, 500));
When we create a PDevice instance, we pass by parameter, the type of API we want to use. In this case, is OpenGL..
Well...tomorrow I'll show the first "visual" version of our engine, with what we have until now..
Hi, how are you??
well, proceeding, let me explain the IVideoDriver class...
Check out the code:
virtual void RestoreDefaultSettings(void) = 0;
virtual void PrepareScene(void) = 0;
virtual void DrawScene(HDC AHDC) = 0;
virtual void ResizeDriver(SRect* ADimension) = 0;
virtual void SetClearColor(SColor* AColor)= 0;
The IVideoDriver is just an interface that contains all the drawing functions (until now just the "prepare" functions, none of REAL drawing is done) of the engine... the POpenGLDriver only implement this interface with OpenGL methods.
All the graphicobjects have a pointer to IVideoDriver to perform its drawing.
Now..the PWindow class..one of most important classes:
PWindow(std::string AWindowName, SRect* ABounds, IVideoDriver* AVideoDriver);
void SetFullScree(bool AValue);
void SetNeedResize(bool AValue);
void SetCaption(std::string AValue);
void SetBackgroundColor(SColor* AValue);
void SetHandle(HWND AValue);
void SetHDC(HDC AValue);
void SetHGLRC(HGLRC AValue);
This class control the windows of the application. Until now there are no complex methods that need explanation..maybe in the future =P
Okay, tomorrow I'll show the example of a simple Main.cpp that create and show a window with a background color.
Any suggestion or question...comment please =D
See you tomorrow..
Today I should explain the PWindow class and IVideoDriver interface..but...looking the project, I decided to show the PGraphicObject (all the graphic objects will derive from it, so...) and the PInputEventReciever first, because the PWindow class derives from PInputEventReciever =D
Check the code:
PGraphicObject(SRect* ABounds, IVideoDriver* AVideoDriver);
void SetVisible(bool AValue);
void SetBounds(SRect* AValue);
void SetVideoDriver(IVideoDriver* AValue);
virtual void Draw(void) = 0;
This class have not much to explain...any doubt ask me please...
void (*FOnMouseMove)(SCoord* AMousePosition);
void (*FOnMouseDown)(SCoord* AMousePosition, ENMouseButton AMouseButton);
void (*FOnMouseUp)(SCoord* AMousePosition, ENMouseButton AMouseButton);
void (*FOnKeyDown)(int AKey);
void (*FOnKeyUp)(int AKey);
virtual void DoMouseMove(SCoord* AMousePosition);
virtual void DoMouseDown(SCoord* AMousePosition, ENMouseButton AMouseButton);
virtual void DoMouseUp(SCoord* AMousePosition, ENMouseButton AMouseButton);
virtual void DoKeyDown(int AKey);
virtual void DoKeyUp(int AKey);
PInputEventReciever(SRect* ABounds, IVideoDriver* AVideoDriver);
void OnMouseMove(void (*AOnMouseMove)(SCoord* AMousePosition));
void OnMouseDown(void (*AOnMouseDown)(SCoord* AMousePosition, ENMouseButton AMouseButton));
void OnMouseUp(void (*AOnMouseUp)(SCoord* AMousePosition, ENMouseButton AMouseButton));
void OnKeyDown(void (*AOnKeyDown)(int AKey));
void OnKeyUp(void (*AOnKeyDown)(int AKey));
virtual void Draw() = 0;
This class just have the pointers to the methods. All the PInputEventReceivers objects, will be registered in the MouseDriver and KeyboardDriver on PDevice and the events will be fired from these drivers to the recievers.
just like I said, the PWindow class derives from PInputEventReceiver.
Tomorrow I'll show the PWindow class and the IVideoDriver interface..
at this time, I promisse..hehe
leave comments with suggestions, critics or love phrases =P
well..see you tomorrow..
Well, yesterday, because my xmas party, I didn't post here =D
But, like I said, here is my first engine description:
S[name_of_class] = Classes that describe structs;
P[name_of_class] = Standard classes;
I[name_of_class] = Interfaces;
EN[name] = Enumerators;
F[name] = Attributes;
A[Name] = Parameters;
From the beginning:
I have made some classes (I have not used any structs until now and I don't pretend), to describe the structs that I'll need to use.
SRect, SCoord, SColor. This classes are being used in all the standard classes until now.
My main class, is the PDevice:
void RegisterInstance(LPCSTR AWindowName);
void BuildWindow(const LPCTSTR AWindowName, SRect* ADimension, PWindow* ANewWindow);
void PrepareWindowToDraw(PWindow* ANewWindow);
static private LRESULT CALLBACK PDevice::WindowProcedure(HWND AHandle, UINT AMessage, WPARAM AWParam, LPARAM ALParam);
PWindow* CreateNewWindow(std::string AWindowName, SRect* ABounds);
void Show(std::string AWindowName);
void Hide(std::string AWindowName);
This class, have a list of PWindows, that are the windows of application =P. The stack with OpenWindows serve to set the DeviceContext to the previous window when another window is about to be closed.
The video driver, contains the drawing functions (that aren't implemented yet, except the "prepare" and "refresh" routines).
Mouse and keyboard drivers will handle the respective messages.
Another methods are explained by itselves.
Tomorrow I will talk about the PWindow and PVideoDriver class.
Remember, I'm building this framework yet, neither the windows system are ready. I will appreciate any suggestions in how can I approach my system.
Tell me what you think.
Hi, my name is Matheus Von Der Kerkhoff, I'm new in game programming.
For this day forward, my journal will show you a little bit about my experience in the game programming world.
My first project is a graphical engine 2D, in C++.
My idea is quite simple. First, I need to make a little engine, and after that, I can begin with some little games (I have already done some games without an engine, but didn't like), like plataform games and something like Counter Strike 2D.
If my engine support the skills of Counter Strike 2D or Soldat(is just some examples), I'll be very happy. =D
A little piece of my engine is already done. Tomorrow I'll explain you how I plan build it and will appreciate all the suggestions.