Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

My engine

Sign in to follow this  


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):

VideoSurface source, *destination
Rect source, dest
virtual Load(filename)
virtual Draw()

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:

VideoSurface surface

friend Image, Application

Flip() <- these are called by "Update()"

SetVideoMode(width, height, bpp, vidMem, hwPal, dBuf, fs)

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.

MainLoop() <-Called every frame, not called by the user
Screen screen
Event event

bool 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.
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!