• entries
37
46
• views
22094

# My engine

260 views

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.

There are no comments to display.

## Create an account

Register a new account