Skip to content

Commit

Permalink
playtest 001 is ready. Beware if color sensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjones91 committed Oct 30, 2024
1 parent dd15af8 commit ff512de
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Binary file modified src/build/raylib_game.wasm
Binary file not shown.
29 changes: 28 additions & 1 deletion src/raylib_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ typedef enum {
SCREEN_ENDING
} GameScreen;

Color rainbow[7] = {RED, ORANGE, YELLOW, GREEN, BLUE, PURPLE, VIOLET};

int note = 1;

// TODO: Define your custom data types here

//----------------------------------------------------------------------------------
Expand All @@ -61,6 +65,8 @@ static RenderTexture2D target = { 0 }; // Render texture to render our game
//----------------------------------------------------------------------------------
static void UpdateDrawFrame(void); // Update and Draw one frame

static int getNote(int);

//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
Expand Down Expand Up @@ -117,6 +123,14 @@ void UpdateDrawFrame(void)
// TODO: Update variables / Implement example logic at this point
//----------------------------------------------------------------------------------

if (IsKeyDown(KEY_UP)) {
getNote(-1);
}
else if (IsKeyDown(KEY_DOWN)) {
getNote(1);

}

// Draw
//----------------------------------------------------------------------------------
// Render game screen to a texture,
Expand All @@ -127,7 +141,14 @@ void UpdateDrawFrame(void)
// TODO: Draw your game screen here
DrawText("Welcome to raylib NEXT gamejam!", 150, 140, 30, BLACK);
DrawRectangleLinesEx((Rectangle){ 0, 0, screenWidth, screenHeight }, 16, BLACK);

TraceLog(1, "Top Color: %i", getNote(0) + 1);
TraceLog(1, "Current Color: %i", getNote(0));
TraceLog(1, "Bottom Color: %i", getNote(0) - 1);
DrawRectangle(0, 2 * (screenHeight/3), screenWidth, screenHeight/3, rainbow[getNote(0) - 1]);
DrawRectangle(0, (screenHeight/3), screenWidth, screenHeight/3, rainbow[getNote(0)]);
DrawRectangle(0, 0, screenWidth, screenHeight/3, rainbow[getNote(0) + 1]);
DrawCircle(screenWidth/2, screenHeight/2, 40, GRAY);

EndTextureMode();

// Render to screen (main framebuffer)
Expand All @@ -141,4 +162,10 @@ void UpdateDrawFrame(void)

EndDrawing();
//----------------------------------------------------------------------------------
}

//get current note
int getNote(int change) {
note += change;
return note % 7;
}

0 comments on commit ff512de

Please sign in to comment.