Source

pyGAP / game / src / main / main_win32.cpp

Full commit
#include <windows.h>

#include "game/game_win32.h"
#include "game/game_loop_sample.h"
#include "common/log.h"

#include "common/list.h"
class Test {
public:
    Test(int value) : value_(value) {}

    int value_;
    common::ListNode    node_;
};

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    LPSTR lpCmdLine, int nCmdShow)
{
#if defined(DEBUG)
    AllocConsole();
    freopen("CONIN$", "r", stdin);
    freopen("CONOUT$", "w", stdout);
    freopen("CONOUT$", "w", stderr);
    common::Log* log_ = common::Log::get("main");
#endif
    LOG("starting game...\n");

    Test* test[10];
    for (int i = 0; i < 10; ++i)
        test[i] = new Test(i);

    common::List<Test>* list = new INTRUSIVE_LIST(Test, node_);

    for (int i = 0; i < 10; ++i)
        list->push_back(test[i]);

    delete test[5]; test[5] = 0;
    delete test[8]; test[8] = 0;

    Test* current = list->first();
    if (current)
    do {
        if (current)
            LOG("%X : %d\n", current, current->value_);
    } while (current = list->next(current));

    for (int i = 0; i < 10; ++i)
        if (test[i])
            delete test[i];
    delete list;

    //game::GameLoopSample game_loop;
    //game::GameWin32 *game;
    //game = new game::GameWin32(&game_loop);
    //
    //game->run();
    //
    //delete game;

#if defined(DEBUG)
    common::Log::clear();
    getchar();
#endif

    return 0;
}