aboutsummaryrefslogtreecommitdiff
#include "game.h"

/**
    TODO:   Shadows
            Fix timing
            Scenes
            Materials
            Text
            Fix particle emission rate

            +improve skybox
            |
            +->fog
            +->day/night

            +mouse picking (is it working perfectly?)

            +add cell shading?

            improve math package
            repair gui on renderer.c
            improve shape loading (normal generation) (support other formats)
**/

int main(int args, char *argv[])
{
    SDL_Init(SDL_INIT_EVERYTHING);

    Game game;
    game.gameState = RUNNING;
    game.window = window_new("Test", WINDOW_WIDTH, WINDOW_HEIGHT);

    game.camera = camera_new();
    game.camera->projectionMatrix = mat4_perspective(60.0f, WINDOW_ASPECT_RATIO, 0.1f, 900.0f);

    LoadResources(&game);

    Time_Init();
    SDL_GL_SetSwapInterval(1);
    Time_SetMaxFramesPerSecond(60);
    while(game.gameState != EXIT)
    {
        Time_Begin();
        ProcessInput(&game);
        Player_Update(&game.player, game.terrain);
        Particles_Update(&game.camera->position);
        Draw(&game);

        float FPS = Time_End();

        if( !( Time_GetCountedFrames() % (int)FPS ) )
        {
            fprintf(stderr, "FPS: %.4f\n", FPS);
        }
    }

    window_destroy(game.window);
    CleanUp(&game);
    SDL_Quit();
    return 0;
}