Compare commits

..

No commits in common. "d0b248d09ddceee0bdf86ca8bdb45fd30077070c" and "c2f30cc948f46c35ccc55bc50f8df58e0aecad61" have entirely different histories.

View File

@ -3,9 +3,6 @@
#include "resource_dir.h" // utility header for SearchAndSetResourceDir
#include <stddef.h>
const short int WINDOW_WIDTH = 1280;
const short int WINDOW_HEIGHT = 800;
int main ()
{
struct MenuItem item[] = {
@ -16,23 +13,11 @@ int main ()
size_t current_item = 0;
size_t items_len = sizeof(item) / sizeof(struct MenuItem);
// SetConfigFlags(FLAG_VSYNC_HINT | FLAG_WINDOW_HIGHDPI);
SetConfigFlags(FLAG_VSYNC_HINT);
// Tell the window to use vsync and work on high DPI displays
SetConfigFlags(FLAG_VSYNC_HINT | FLAG_WINDOW_HIGHDPI);
// Create the window and OpenGL context
InitWindow(WINDOW_WIDTH, WINDOW_HEIGHT, "Touhou Jikuusen ~ Apotheotic Heterochronicity");
HideCursor();
// see what display we are on right now
int display = GetCurrentMonitor();
const int MONITOR_WIDTH = GetMonitorWidth(display);
const int MONITOR_HEIGHT = GetMonitorHeight(display);
printf("Size of monitor: %dx%d\n", MONITOR_WIDTH, MONITOR_HEIGHT);
// Set the framerate to 60fps
SetTargetFPS(60);
InitWindow(1280, 800, "Touhou Jikuusen ~ Apotheotic Heterochronicity");
// Utility function from resource_dir.h to find the resources folder and set it as the current working directory so we can load from it
SearchAndSetResourceDir("resources");
@ -40,17 +25,14 @@ int main ()
// Load a texture from the resources directory
Texture wabbit = LoadTexture("wabbit_alpha.png");
RenderTexture2D canvas = LoadRenderTexture(WINDOW_WIDTH, WINDOW_HEIGHT);
// game loop
while (!WindowShouldClose()) // run the loop untill the user presses ESCAPE or presses the Close button on the window
{
// drawing onto the game screen buffer, which may be centered and surrounded in black bars
// in fullscreen mode
BeginTextureMode(canvas);
// drawing
BeginDrawing();
// Setup the back buffer for drawing (clear color and depth buffers)
ClearBackground(GREEN);
ClearBackground(BLACK);
for (int i = 0; i < items_len; i++) {
@ -67,27 +49,12 @@ int main ()
current_item--;
}
}
if (IsKeyPressed(KEY_ENTER) && (IsKeyDown(KEY_LEFT_ALT) || IsKeyDown(KEY_RIGHT_ALT))) {
// toggle the state
ToggleFullscreen();
}
// draw some text using the default font
DrawText("TOUHOU!!!!", 200,200,20,WHITE);
// draw our texture to the screen
DrawTexture(wabbit, 400, 200, WHITE);
// finish rendering to canvas
EndTextureMode();
BeginDrawing();
// place the contents of the canvas onto the screen
ClearBackground(WHITE);
DrawTextureRec(canvas.texture, (Rectangle){.x = 0, .y = 0, .width = WINDOW_WIDTH, .height = -WINDOW_HEIGHT}, (Vector2){.x = 0, .y=0}, WHITE);
DrawCircle(GetMouseX(), GetMouseY(), 10, WHITE);
// end the frame and get ready for the next one (display frame, poll input, etc...)
EndDrawing();
}