Jump to content
Sign in to follow this  
  • entries
    37
  • comments
    46
  • views
    22094

My engine

Sign in to follow this  
Drakkcon

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, *destination
Rect 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 surface

friend Image, Application

Flip() <- 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 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  


0 Comments


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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!