Compare commits
No commits in common. "d0b248d09ddceee0bdf86ca8bdb45fd30077070c" and "c2f30cc948f46c35ccc55bc50f8df58e0aecad61" have entirely different histories.
d0b248d09d
...
c2f30cc948
47
src/main.c
47
src/main.c
@ -3,9 +3,6 @@
|
|||||||
#include "resource_dir.h" // utility header for SearchAndSetResourceDir
|
#include "resource_dir.h" // utility header for SearchAndSetResourceDir
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
const short int WINDOW_WIDTH = 1280;
|
|
||||||
const short int WINDOW_HEIGHT = 800;
|
|
||||||
|
|
||||||
int main ()
|
int main ()
|
||||||
{
|
{
|
||||||
struct MenuItem item[] = {
|
struct MenuItem item[] = {
|
||||||
@ -16,41 +13,26 @@ int main ()
|
|||||||
size_t current_item = 0;
|
size_t current_item = 0;
|
||||||
size_t items_len = sizeof(item) / sizeof(struct MenuItem);
|
size_t items_len = sizeof(item) / sizeof(struct MenuItem);
|
||||||
|
|
||||||
// SetConfigFlags(FLAG_VSYNC_HINT | FLAG_WINDOW_HIGHDPI);
|
// Tell the window to use vsync and work on high DPI displays
|
||||||
SetConfigFlags(FLAG_VSYNC_HINT);
|
SetConfigFlags(FLAG_VSYNC_HINT | FLAG_WINDOW_HIGHDPI);
|
||||||
|
|
||||||
// Create the window and OpenGL context
|
// Create the window and OpenGL context
|
||||||
InitWindow(WINDOW_WIDTH, WINDOW_HEIGHT, "Touhou Jikuusen ~ Apotheotic Heterochronicity");
|
InitWindow(1280, 800, "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);
|
|
||||||
|
|
||||||
// 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
|
// 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");
|
SearchAndSetResourceDir("resources");
|
||||||
|
|
||||||
// Load a texture from the resources directory
|
// Load a texture from the resources directory
|
||||||
Texture wabbit = LoadTexture("wabbit_alpha.png");
|
Texture wabbit = LoadTexture("wabbit_alpha.png");
|
||||||
|
|
||||||
RenderTexture2D canvas = LoadRenderTexture(WINDOW_WIDTH, WINDOW_HEIGHT);
|
|
||||||
|
|
||||||
// game loop
|
// game loop
|
||||||
while (!WindowShouldClose()) // run the loop untill the user presses ESCAPE or presses the Close button on the window
|
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
|
// drawing
|
||||||
// in fullscreen mode
|
BeginDrawing();
|
||||||
BeginTextureMode(canvas);
|
|
||||||
|
|
||||||
// Setup the back buffer for drawing (clear color and depth buffers)
|
// Setup the back buffer for drawing (clear color and depth buffers)
|
||||||
ClearBackground(GREEN);
|
ClearBackground(BLACK);
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < items_len; i++) {
|
for (int i = 0; i < items_len; i++) {
|
||||||
@ -67,27 +49,12 @@ int main ()
|
|||||||
current_item--;
|
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
|
// draw some text using the default font
|
||||||
DrawText("TOUHOU!!!!", 200,200,20,WHITE);
|
DrawText("TOUHOU!!!!", 200,200,20,WHITE);
|
||||||
|
|
||||||
// draw our texture to the screen
|
// draw our texture to the screen
|
||||||
DrawTexture(wabbit, 400, 200, WHITE);
|
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...)
|
// end the frame and get ready for the next one (display frame, poll input, etc...)
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user