Tutorial 1 - Cómo crear la clase principal del juego

// game.h
#pragma once

#include <sstream>
#include "zakengine/zak.h"

using namespace zak;

class TestGame : public Game {
public:

        void OnFrame();
        bool OnShutdown();
        bool OnInit();
        void OnDraw();


        TestGame();
        ~TestGame();

private:

};

// game.cpp
#include "game.h"

TestGame::TestGame() {

}

TestGame::~TestGame() { 

}
bool TestGame::OnInit() {

        _clearScreen = true;

        return true;
}

void TestGame::OnFrame() {
        if (KeyDown(DIK_ESCAPE))
                PostQuitMessage(0);
}

void TestGame::OnDraw() {
        wstringstream ss;

        ss << ZAK_ENGINE_NAME << endl << "FPS: " << _fpsMeter.GetFps() << endl;
        g_renderer.SetFontColor(0xFFFF0000);
        g_renderer.DrawString(ss.str(),10,10,800-20,600-20,ZAK_TEXT_LEFT);
}

bool TestGame::OnShutdown() {
        return true;
}

// main.cpp
#include "game.h"

using namespace zak;

//#define USING_DIRECTX81

#ifdef USING_DIRECTX81

#ifdef _DEBUG
#pragma comment (lib, "zakengine81d.lib")
#else
#pragma comment (lib, "zakengine81.lib")
#endif

#else

#ifdef _DEBUG
#pragma comment (lib, "zakengined.lib")
#else
#pragma comment (lib, "zakengine.lib")
#endif

#endif

int main () {
        string desc;
        TestGame game;
        GameConfig config;

        if (!config.Load("config.ini"))
                return false;

        if (game.StartUp(&config)) {
                game.Loop();
        } else {
                game.Shutdown();

                MessageBoxA(g_window.GetHWnd(),Log.GetLastMessage(),"Error",MB_ICONERROR|MB_OK);

                return 1;
        }

        if (!game.Shutdown()) {

                MessageBoxA(g_window.GetHWnd(),Log.GetLastMessage(),"Error",MB_ICONERROR|MB_OK);
                return 1;
        }
        
        return 0;
}

Generado el Tue May 29 14:46:15 2007 para Zak Engine v1.1.0 por  doxygen 1.5.1-p1