Add AS0 files
parent
de69de5ef1
commit
6ff0ede331
|
|
@ -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)
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue