formating; alyson licence; Camera2D
This commit is contained in:
parent
04d7c97e93
commit
39abfaa978
6 changed files with 85 additions and 49 deletions
|
@ -1,4 +1,3 @@
|
|||
|
||||
#include <alyson.hpp>
|
||||
#include <raylib.h>
|
||||
#include <iostream>
|
||||
|
@ -16,31 +15,42 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
Texture2D logo = LoadTexture(MANGLE_RES_PATH("Raylib_logo.png"));
|
||||
|
||||
std::cout << "alyson: init" << std::endl;
|
||||
|
||||
int g = init();
|
||||
if(g != 0) {
|
||||
std::cout << "alyson: init failed with error code " << g << std::endl;
|
||||
return g;
|
||||
}
|
||||
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();
|
||||
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
|
||||
);
|
||||
BeginMode2D(camera);
|
||||
ClearBackground(RAYWHITE);
|
||||
camera.rotation += dt;
|
||||
camera.rotation = (int)camera.rotation % 360;
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue