From 1755c184966c926b550af375842e8088bc77525d Mon Sep 17 00:00:00 2001 From: Nikola Petrov Date: Sun, 3 Mar 2024 22:36:53 +0100 Subject: [PATCH] Addapt for android Center the tree texture on the screen --- main.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/main.cpp b/main.cpp index a1c5a37..3d324c1 100644 --- a/main.cpp +++ b/main.cpp @@ -1,19 +1,26 @@ #include "raylib.h" #include "Tree.hpp" -const int screenWidth = 800; -const int screenHeight = 800; - int main(void) { - InitWindow(screenWidth, screenHeight, "raylib"); + char *name = "treender"; + int screenWidth = 800; + int screenHeight = 800; +#ifdef MY_ANDROID + InitWindow(0, 0, name); + screenWidth = GetScreenWidth(); + screenHeight = GetScreenHeight(); +#else + InitWindow(screenWidth, screenHeight, name); +#endif SetTargetFPS(60); { Tree tree(800); tree.newTree(); - Rectangle dest = {0, 0, screenWidth, screenHeight}; + int yPos = (screenHeight - screenWidth) / 2; + Rectangle dest = {yPos, 0, screenWidth, screenWidth}; float rotation = 0.0f; while (!WindowShouldClose()) {