Esempio n. 1
0
//----------------------------------------------------------------------------------
// Main entry point
//----------------------------------------------------------------------------------
int main(void)
{
	// Initialization
	//---------------------------------------------------------
	const char windowTitle[30] = "SKULLY ESCAPE [KING GAMEJAM]";

    InitWindow(screenWidth, screenHeight, windowTitle);

    // Global data loading (assets that must be available in all screens, i.e. fonts)
    InitAudioDevice();
    
    music = LoadMusicStream("resources/audio/come_play_with_me.ogg");
    PlayMusicStream(music);
    
    font = LoadSpriteFont("resources/textures/alagard.png");
	doors = LoadTexture("resources/textures/doors.png");
    sndDoor = LoadSound("resources/audio/door.ogg");
    sndScream = LoadSound("resources/audio/scream.ogg");
	
    InitPlayer();
    
    // Setup and Init first screen
    currentScreen = LOGO;
    InitLogoScreen();

#if defined(PLATFORM_WEB)
    emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
#else
    SetTargetFPS(60);   // Set our game to run at 60 frames-per-second
    //--------------------------------------------------------------------------------------

    // Main game loop
    while (!WindowShouldClose())    // Detect window close button or ESC key
    {
        UpdateDrawFrame();
    }
#endif

    // De-Initialization
    //--------------------------------------------------------------------------------------
    
    // Unload all global loaded data (i.e. fonts) here!
	UnloadPlayer();
    UnloadSpriteFont(font);
    UnloadTexture(doors);
    UnloadSound(sndDoor);
    UnloadSound(sndScream);
    
    UnloadMusicStream(music);
    
    CloseAudioDevice();
    
    CloseWindow();        // Close window and OpenGL context
    //--------------------------------------------------------------------------------------
	
    return 0;
}
Esempio n. 2
0
// Mission Screen Unload logic
void UnloadMissionScreen(void)
{
    // Unload MISSION screen variables here!
    UnloadTexture(texBackground);
    UnloadTexture(texBackline);
    UnloadSound(fxTransmit);
    UnloadMusicStream(musMission);
    free(missions);
}
Esempio n. 3
0
int main()
{
    // Initialization
    //--------------------------------------------------------------------------------------
    static unsigned char key = 0;

    InitAudioDevice();

    Sound fxWav = LoadSound("resources/audio/weird.wav");         // Load WAV audio file
    Sound fxOgg = LoadSound("resources/audio/tanatana.ogg");      // Load OGG audio file

    Music music = LoadMusicStream("resources/audio/guitar_noodling.ogg");
    PlayMusicStream(music);

    printf("\nPress s or d to play sounds...\n");
    //--------------------------------------------------------------------------------------

    // Main loop
    while (key != KEY_ESCAPE)
    {
        if (kbhit()) key = getch();

        if (key == 's')
        {
            PlaySound(fxWav);
            key = 0;
        }

        if (key == 'd')
        {
            PlaySound(fxOgg);
            key = 0;
        }

        UpdateMusicStream(music);
    }

    // De-Initialization
    //--------------------------------------------------------------------------------------
    UnloadSound(fxWav);         // Unload sound data
    UnloadSound(fxOgg);         // Unload sound data

    UnloadMusicStream(music);   // Unload music stream data

    CloseAudioDevice();
    //--------------------------------------------------------------------------------------

    return 0;
}
Esempio n. 4
0
//----------------------------------------------------------------------------------
// Main entry point
//----------------------------------------------------------------------------------
int main(void) 
{
	// Initialization (Note windowTitle is unused on Android)
	//---------------------------------------------------------
    InitWindow(screenWidth, screenHeight, "KOALA SEASONS");

    // Load global data here (assets that must be available in all screens, i.e. fonts)
    font = LoadFont("resources/graphics/mainfont.png");

    atlas01 = LoadTexture("resources/graphics/atlas01.png");
    atlas02 = LoadTexture("resources/graphics/atlas02.png");
    
#if defined(PLATFORM_WEB) || defined(PLATFORM_RPI) || defined(PLATFORM_ANDROID)
    colorBlend = LoadShader("resources/shaders/glsl100/base.vs", "resources/shaders/glsl100/blend_color.fs");
#else
    colorBlend = LoadShader("resources/shaders/glsl330/base.vs", "resources/shaders/glsl330/blend_color.fs");
#endif

    InitAudioDevice();
    
    // Load sounds data
    fxJump = LoadSound("resources/audio/jump.ogg");
    fxDash = LoadSound("resources/audio/dash.ogg");
    fxEatLeaves = LoadSound("resources/audio/eat_leaves.ogg");
    fxHitResin = LoadSound("resources/audio/resin_hit.ogg");
    fxWind = LoadSound("resources/audio/wind_sound.ogg");
    fxDieSnake = LoadSound("resources/audio/snake_die.ogg");
    fxDieDingo = LoadSound("resources/audio/dingo_die.ogg");
    fxDieOwl = LoadSound("resources/audio/owl_die.ogg");
    
    
    music = LoadMusicStream("resources/audio/jngl.xm");
    PlayMusicStream(music);
    SetMusicVolume(music, 1.0f);

    // Define and init first screen
    // NOTE: currentScreen is defined in screens.h as a global variable
    currentScreen = TITLE;

    InitLogoScreen();
    //InitOptionsScreen();
    InitTitleScreen();
    InitGameplayScreen();
    InitEndingScreen();

#if defined(PLATFORM_WEB)
    emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
#else
    SetTargetFPS(60);   // Set our game to run at 60 frames-per-second
    //--------------------------------------------------------------------------------------
    
    // Main game loop
    while (!WindowShouldClose()) UpdateDrawFrame();
#endif

    // De-Initialization
    //--------------------------------------------------------------------------------------
    UnloadEndingScreen();
    UnloadTitleScreen();
    UnloadGameplayScreen();
    UnloadLogoScreen();
    
    UnloadTexture(atlas01);
    UnloadTexture(atlas02);
    UnloadFont(font);
    
    UnloadShader(colorBlend);   // Unload color overlay blending shader
    
    UnloadSound(fxJump);
    UnloadSound(fxDash);
    UnloadSound(fxEatLeaves);
    UnloadSound(fxHitResin);
    UnloadSound(fxWind);
    UnloadSound(fxDieSnake);
    UnloadSound(fxDieDingo);
    UnloadSound(fxDieOwl);
    
    UnloadMusicStream(music);
    
    CloseAudioDevice();         // Close audio device

    CloseWindow();              // Close window and OpenGL context
    //--------------------------------------------------------------------------------------

    return 0;
}
Esempio n. 5
0
//----------------------------------------------------------------------------------
// Main entry point
//----------------------------------------------------------------------------------
int main(int argc, char *argv[])
{
	// Initialization
	//---------------------------------------------------------
#if defined(PLATFORM_DESKTOP)
    // TODO: Support for dropped files on the exe
    
    // Support command line argument for custom music file
    if (argc > 1)
    {
        // Just supporting an input argument parameter!!! o__O
        
        if ((IsFileExtension(argv[1], ".ogg")) ||
            (IsFileExtension(argv[1], ".wav")))
        {
            if (sampleFilename != NULL) free(sampleFilename);
            
            sampleFilename = (char *)malloc(256);
            strcpy(sampleFilename, argv[1]);
            
            printf("Custom audio file: %s", sampleFilename);
        }
    }
#endif

#ifndef PLATFORM_ANDROID
    SetConfigFlags(FLAG_MSAA_4X_HINT);
#endif
    // Note windowTitle is unused on Android
    InitWindow(screenWidth, screenHeight, "GGJ17 - WAVE COLLECTOR");

    // Global data loading (assets that must be available in all screens, i.e. fonts)
    InitAudioDevice();

    font = LoadFont("resources/font.fnt");
    music = LoadMusicStream("resources/audio/wave.ogg");
    
    SetMusicVolume(music, 1.0f);

    // Setup and Init first screen
    currentScreen = LOGO;
    InitLogoScreen();
    //InitTitleScreen();
    //InitGameplayScreen();
    //InitEndingScreen();

#if defined(PLATFORM_WEB)
    emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
#else
    SetTargetFPS(60);   // Set our game to run at 60 frames-per-second
    //--------------------------------------------------------------------------------------

    // Main game loop
    while (!WindowShouldClose())    // Detect window close button or ESC key
    {
        UpdateDrawFrame();
    }
#endif

    // De-Initialization
    //--------------------------------------------------------------------------------------
    switch (currentScreen)
    {
        case LOGO: UnloadLogoScreen(); break;
        case TITLE: UnloadTitleScreen(); break;
        case GAMEPLAY: UnloadGameplayScreen(); break;
        case ENDING: UnloadEndingScreen(); break;
        default: break;
    }
    
    // Unload all global loaded data (i.e. fonts) here!
    UnloadFont(font);
    UnloadMusicStream(music);

    CloseAudioDevice();     // Close audio context
    
    CloseWindow();          // Close window and OpenGL context
    //--------------------------------------------------------------------------------------

    return 0;
}
Esempio n. 6
0
//----------------------------------------------------------------------------------
// Main entry point
//----------------------------------------------------------------------------------
int main(void)
{
	// Initialization
	//---------------------------------------------------------
    InitWindow(screenWidth, screenHeight, "GGJ16 - LIGHT MY RITUAL!");

    // Global data loading (assets that must be available in all screens, i.e. fonts)
    InitAudioDevice();

    Image image = LoadImage("resources/lights_map.png");  // Load image in CPU memory (RAM)
    
    lightsMap = GetImageData(image);            // Get image pixels data as an array of Color
    lightsMapWidth = image.width;
    lightsMapHeight = image.height;
    
    UnloadImage(image);                         // Unload image from CPU memory (RAM)
    
    font = LoadSpriteFont("resources/font_arcadian.png");
	//doors = LoadTexture("resources/textures/doors.png");
    //sndDoor = LoadSound("resources/audio/door.ogg");
    
    music = LoadMusicStream("resources/audio/ambient.ogg");
    PlayMusicStream(music);
    SetMusicVolume(music, 1.0f);

    // Setup and Init first screen
    currentScreen = LOGO_RL;
    //InitTitleScreen();
    //InitGameplayScreen();
    rlInitLogoScreen();

#if defined(PLATFORM_WEB)
    emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
#else
    SetTargetFPS(60);   // Set our game to run at 60 frames-per-second
    //--------------------------------------------------------------------------------------

    // Main game loop
    while (!WindowShouldClose())    // Detect window close button or ESC key
    {
        UpdateDrawFrame();
    }
#endif

    // De-Initialization
    //--------------------------------------------------------------------------------------
    switch (currentScreen)
    {
        case LOGO_RL: rlUnloadLogoScreen(); break;
        case TITLE: UnloadTitleScreen(); break;
        case GAMEPLAY: UnloadGameplayScreen(); break;
        default: break;
    }
    
    // Unload all global loaded data (i.e. fonts) here!
    UnloadSpriteFont(font);
    //UnloadSound(sndDoor);
    
    UnloadMusicStream(music);
    
    free(lightsMap);
    
    CloseAudioDevice();
    
    CloseWindow();        // Close window and OpenGL context
    //--------------------------------------------------------------------------------------
	
    return 0;
}