Add AS0 files

master
John Montagu, the 4th Earl of Sandvich 2026-02-01 16:50:14 -08:00
parent de69de5ef1
commit 6ff0ede331
Signed by: sandvich
GPG Key ID: 9A39BE37E602B22D
2 changed files with 45 additions and 0 deletions

12
as0/CMakeLists.txt 100644
View File

@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 3.18)
project(as0 CXX)
set(CMAKE_CXX_STANDARD 20)
# adding this option to make clangd work
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_subdirectory(../raylib-cpp raylib)
add_executable(as0 as0.cpp)
target_link_libraries(as0 PUBLIC raylib raylib_cpp)

33
as0/as0.cpp 100644
View File

@ -0,0 +1,33 @@
#include "Color.hpp"
#include "raylib.h"
#include <raylib-cpp.hpp>
int main() {
raylib::Window window(800, 600, "AS0");
window.SetState(FLAG_WINDOW_RESIZABLE);
while (!window.ShouldClose()) {
raylib::Text text;
int fontHeight = 20;
text.SetText("Hello World");
text.SetFontSize(fontHeight);
text.SetSpacing(2);
text.SetColor(raylib::Color::Gray());
window.BeginDrawing();
window.ClearBackground(raylib::Color::RayWhite());
int width = window.GetWidth();
int height = window.GetHeight();
int middleX = (width - text.Measure()) / 2;
int middleY = (height - fontHeight) / 2;
text.Draw(middleX, middleY);
window.EndDrawing();
}
return 0;
}