Addapt for android

Center the tree texture on the screen
This commit is contained in:
Nikola Petrov 2024-03-03 22:36:53 +01:00
parent 462f27aa26
commit 1755c18496

View File

@ -1,19 +1,26 @@
#include "raylib.h" #include "raylib.h"
#include "Tree.hpp" #include "Tree.hpp"
const int screenWidth = 800;
const int screenHeight = 800;
int main(void) 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); SetTargetFPS(60);
{ {
Tree tree(800); Tree tree(800);
tree.newTree(); tree.newTree();
Rectangle dest = {0, 0, screenWidth, screenHeight}; int yPos = (screenHeight - screenWidth) / 2;
Rectangle dest = {yPos, 0, screenWidth, screenWidth};
float rotation = 0.0f; float rotation = 0.0f;
while (!WindowShouldClose()) while (!WindowShouldClose())
{ {