Got basic code to set pixels up

This commit is contained in:
InventorXtreme 2023-12-02 22:54:00 -05:00
parent b97fca038c
commit 03aeac765d

32
c3d.c
View file

@ -1,24 +1,44 @@
#include <stdio.h> #include <stdio.h>
#include "raylib.h" #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() { int main() {
SetConfigFlags(FLAG_WINDOW_UNDECORATED); SetConfigFlags(FLAG_WINDOW_UNDECORATED);
InitWindow(800, 450, "raylib [core] example - basic window"); InitWindow(SCREENWIDTH, SCREENHEIGHT, "raylib [core] example - basic window");
// SetWindowPosition(0,1080); // SetWindowPosition(0,1080);
Vector2 a = GetMonitorPosition(0); Vector2 a = GetMonitorPosition(0);
int mh = GetMonitorHeight(0); int mh = GetMonitorHeight(0);
int mw = GetMonitorWidth(0); int mw = GetMonitorWidth(0);
int w = 800; int w = SCREENWIDTH;
int h = 450; int h = SCREENHEIGHT;
printf("mh:%d mw:%d w:%d h:%d\n", mh, mw, w, h); 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)); SetWindowPosition(a.x + (0.5 * mw) - (w / 2), a.y + (0.5 * mh) - (0.5 * h));
RenderTexture2D renderTexture = LoadRenderTexture(RENDERWIDTH,RENDERHEIGHT);
while (!WindowShouldClose()) { while (!WindowShouldClose()) {
BeginDrawing(); BeginTextureMode(renderTexture);
ClearBackground(RAYWHITE); ClearBackground(WHITE);
DrawText("Congrats! You created your first window!", 190, 200, 20, DrawText("Congrats! You created your first window!", 190, 200, 20,
LIGHTGRAY); 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(); EndDrawing();
} }
CloseWindow(); CloseWindow();