Beispiel #1
0
INT WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR lpCmdLine, INT nCmdShow) {
#else
int main(int argc, char *argv[]) {
#endif
    Kernel Core;
    bool running = true;

    try {
        cout << "Loading plugins..." << endl;
        Core.loadPlugin("SDL2");
        Core.loadPlugin("ACPlugin");
        cout << endl;

        cout << string(79, '*') << endl;
        cout << endl;

        cout << "Available graphics drivers:" << endl;
        listGraphicsDrivers(Core.getGraphicsServer());
        cout << "Available game plugins:" << endl;
        listGamePlugins(Core.getGameServer());
    } catch(const exception &exception) {
        cout << "Unhandled error: " << exception.what() << endl;
    }

    /* Update the plugins */
    while (running) {
        if (Core.getGameServer().getPlugin(0).updateGame()) {
            Core.getGameServer().getPlugin(0).closeConnection();
        }
    }

    return EXIT_SUCCESS;
}
/// Tells us to register our functionality to an engine kernel
extern "C" DEF_Export void registerPlugin(Kernel &K)
{
	K.getGraphicsServer().addGraphicsDriver(
	  auto_ptr<GraphicsServer::GraphicsDriver>(new OpenGLGraphicsDriver())
	);
}