The current features I have so far:
* Create a game window in 1 line (including title, width, height, and optional fullscreen).
* A scene manager that contains wraps around everything within the scene.
* Sprites which can be
* - Scaled.
* - Rotated (and you can defined pivot aswell)
* - Tinted a colour.
* - Given a depth (closer sprites are drawn first).
* - Can be attached to a camera.
* A 2D camera (basically contains a 2D point which offsets a sprite at render time).
* Basic input handling (bool IsKeyDown([key]) at the moment).
This is an example program I've made with the framework so far: (it draws 2 bimaps on the screen and rotates one).
Code: Select all
#include <iostream>
#include <mgf.h>
using namespace MGF;
using namespace Core;
void Update();
Game *game;
Sprite *sampleSprite;
Sprite *sampleSprite2;
Camera2D *camera;
int main()
{
game = new Game();
if(!game->CreateGameWindow("Sample Game", 640, 480))
{
std::cout << "ERROR: Can't create game window.";
return 1;
}
sampleSprite = game->GetScene()->CreateSprite(game->GetScene()->GetTexture("test.bmp"),Vector2Di(10,10));
sampleSprite2 = game->GetScene()->CreateSprite(game->GetScene()->GetTexture("test.bmp"),Vector2Di(10,10));
camera = game->GetScene()->CreateCamera2D();
sampleSprite->SetScaling(Vector2Di(2,2));
sampleSprite->SetCentre(); // sets the pivot point to the centre (only needed since we're scaling)
sampleSprite->SetTint(Core::Colour(1.0f,1.0f,0.5f)); // tint the sprite a bright yellow
sampleSprite->AttachCamera(camera);
sampleSprite->SetDepth(0); // draw at the very front
sampleSprite2->SetDepth(.1); // draw behind
camera->SetPosition(Core::Vector2Di(-20,-20));
game->Run(Update);
delete game;
return 0;
}
void Update()
{
sampleSprite->SetRotation(game->GetTimeInMilliseconds()/500.0f);
game->GetScene()->Render();
}
Code: Select all
sampleSprite = new Sprite(game->GetScene()->GetTexture("test.bmp"),Vector2Di(10,10));
game->GetScene()->AddSprite(sampleSprite);
I haven't released anything yet until I finish writing a sample game with it (it's a turn-based war game - a little more complex than your average Pong game). This way I'll have implemented most features a 2D game would require and have tested them in a real-world example before making a release.
I'll later be adding sound and network. Sounds will be able to be attached to cameras too (for stereo left/right). But they're not my main priorities at the moment. Once I have a stable and mature 2D game framework I'll work my way up to supporting 3D primitives, then eventually loading meshes. But I'm holding 3D off until I fully implement 2D, input, sound, and network because it'll take up most of my time when I get around to it.
Is there anything I seem to be missing from my game framework so far?
(Unrelated, I've finished a 3D variation of Pacman with rockets and destructable walls: http://messiahandrw.netfast.org/portfol ... pacand.htm What do you guys think?)