My engine

Published April 01, 2006
Advertisement
I've restarted my game engine about a billion times, but I've finally got a design that I'm sort of happy with. Since this is my first time really making an engine, I want suggestions and advice! I'm sure you all will come thru for me!

First off, I have an image class, which looks something like this (in psuedo code):

Image-------------------VideoSurface source, *destinationRect source, dest-------------------virtual Load(filename)virtual Draw()SetDestination(Screen)SetLocation(x, y)SetSourceRect(x, y, w, h)SetColorKey(r, g, b)Ctor(filename, screen)virtual Dtor


I will use an image as just a static image that wraps SDL's surface and blitting functions. Later I shall derive a Sprite class from it (hence the virtuals).

The screen they draw to is not actually an SDL_Surface, but a screen class that I created:

Screen-----------------VideoSurface surfacefriend Image, ApplicationFlip() <- these are called by "Update()"Clear()Lock()Unlock()-----------------SetVideoMode(width, height, bpp, vidMem, hwPal, dBuf, fs)Update()-----------------


Then there is the "StratusGame" class (the game engine is 'Stratus', yes I know it's corny), which should be inherited
from so that you can create your own SDL_Event handlers and
DrawScene() function.

StratusGame-----------------MainLoop() <-Called every frame, not called by the user-----------------Screen screenEvent eventbool running?-----------------static StratusGame* Initialize();bool SetVideoMode("same as above");void Uninitialize();virtual void DrawScene();virtual void HandleKeyboard();virtual void HandleWindow();----------------



That's all for now. I'm kind of worried that I'm doing something wrong, but I'm going to keep going.

Again, please comment, since most of you are more knowledgable than I.

Edit: I'll probably end up removing the Application stuff, and just writing a bunch of sprite libraries. Then I'll write sprite managers and map handling classes and see how they fit in with an Application layer.
Previous Entry I hate the world
Next Entry The ACT
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement

Latest Entries

..............

550 views

Untitled

990 views

Untitled

1013 views

Back

1006 views

I'm finally back

1039 views

Random updates

915 views

Hou zhou bu jien

940 views

Update

1032 views
Advertisement