diff --git a/c3d.c b/c3d.c index 2fd2835..75d3c49 100644 --- a/c3d.c +++ b/c3d.c @@ -1,24 +1,44 @@ #include #include "raylib.h" +const int RENDERWIDTH = 1920; +const int RENDERHEIGHT = 1080; + +const int SCREENWIDTH = 1280; +const int SCREENHEIGHT = 720; + +const float WIDTHSCALE = (float)RENDERWIDTH / SCREENWIDTH; +const float HEIGHTSCALE = (float) RENDERHEIGHT / SCREENHEIGHT; + int main() { SetConfigFlags(FLAG_WINDOW_UNDECORATED); - InitWindow(800, 450, "raylib [core] example - basic window"); + InitWindow(SCREENWIDTH, SCREENHEIGHT, "raylib [core] example - basic window"); // SetWindowPosition(0,1080); Vector2 a = GetMonitorPosition(0); int mh = GetMonitorHeight(0); int mw = GetMonitorWidth(0); - int w = 800; - int h = 450; + int w = SCREENWIDTH; + int h = SCREENHEIGHT; printf("mh:%d mw:%d w:%d h:%d\n", mh, mw, w, h); SetWindowPosition(a.x + (0.5 * mw) - (w / 2), a.y + (0.5 * mh) - (0.5 * h)); + + RenderTexture2D renderTexture = LoadRenderTexture(RENDERWIDTH,RENDERHEIGHT); + + while (!WindowShouldClose()) { - BeginDrawing(); - ClearBackground(RAYWHITE); + BeginTextureMode(renderTexture); + ClearBackground(WHITE); DrawText("Congrats! You created your first window!", 190, 200, 20, - LIGHTGRAY); - EndDrawing(); + BLACK); + EndTextureMode(); + + //Copytexture to main display :0 + + BeginDrawing(); + DrawTexturePro(renderTexture.texture, (Rectangle){0,0,renderTexture.texture.width,-renderTexture.texture.height},(Rectangle){0,0,SCREENWIDTH,SCREENHEIGHT},(Vector2){0,0},0,WHITE); + EndDrawing(); + } CloseWindow();