colysis/alyson/src/alyson.cpp

60 lines
1.4 KiB
C++

#include <alyson.hpp>
#include <raylib.h>
#include <iostream>
#include <string>
#include <rlyson.h>
#define WINDOW_TITLE "Alyson Engine"
int main(int argc, char *argv[]) {
SetTargetFPS(60);
InitWindow(900, 500, WINDOW_TITLE " -- 900x500");
Texture2D logo = LoadTexture(MANGLE_RES_PATH("Raylib_logo.png"));
Camera2D camera = { 0 };
camera.target = (Vector2){ 0, 0 };
camera.offset = (Vector2){ 0, 0 };
camera.rotation = 0.0f;
camera.zoom = 1.0f;
init(0);
while (!WindowShouldClose()) {
float dt = GetFrameTime();
if (IsWindowResized()) {
SetWindowTitle((std::string(WINDOW_TITLE) + " -- " + std::to_string(GetScreenWidth()) + "x" + std::to_string(GetScreenHeight())).c_str());
}
BeginDrawing();
BeginMode2D(camera);
ClearBackground(RAYWHITE);
camera.rotation += dt;
camera.rotation = (int)camera.rotation % 360;
DrawTexture(logo, GetScreenWidth() / 2 - logo.width / 2, GetScreenHeight() / 2 - logo.height / 2, WHITE);
DrawTextFull(
GetFontDefault(),
WINDOW_TITLE,
{ GetScreenWidth() / 2.f, GetScreenHeight() - 60.f },
TEXT_ORIENTATION_CENTER, 0.f,
40.f, 5.f,
0.f, BLACK
);
update(dt);
render(dt);
EndMode2D();
EndDrawing();
}
UnloadTexture(logo);
CloseWindow();
return 0;
}