- Changed CMake file to use C++ instead of C and also to use the project name as the target name.
- Changed the macro-constants to constexpr constants and removed void as the parameter to main.
This commit is contained in:
parent
310e32006f
commit
bdab2b8a6e
2 changed files with 9 additions and 9 deletions
33
src/main.cpp
Normal file
33
src/main.cpp
Normal file
|
@ -0,0 +1,33 @@
|
|||
#include "raylib.h"
|
||||
|
||||
constexpr auto SCREEN_WIDTH = 800;
|
||||
constexpr auto SCREEN_HEIGHT = 450;
|
||||
|
||||
int main()
|
||||
{
|
||||
InitWindow(SCREEN_WIDTH, SCREEN_HEIGHT, "Window title");
|
||||
SetTargetFPS(60);
|
||||
|
||||
Texture2D texture = LoadTexture(ASSETS_PATH"test.png");
|
||||
|
||||
while (!WindowShouldClose())
|
||||
{
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
const int texture_x = SCREEN_WIDTH / 2 - texture.width / 2;
|
||||
const int texture_y = SCREEN_HEIGHT / 2 - texture.height / 2;
|
||||
DrawTexture(texture, texture_x, texture_y, WHITE);
|
||||
|
||||
const char* text = "OMG! IT WORKS!";
|
||||
const Vector2 text_size = MeasureTextEx(GetFontDefault(), text, 20, 1);
|
||||
DrawText(text, SCREEN_WIDTH / 2 - text_size.x / 2, texture_y + texture.height + text_size.y + 10, 20, BLACK);
|
||||
|
||||
EndDrawing();
|
||||
}
|
||||
|
||||
CloseWindow();
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue