38 lines
1.1 KiB
C++
38 lines
1.1 KiB
C++
#include "Color.hpp"
|
|
#include "raylib.h"
|
|
#include <raylib-cpp.hpp>
|
|
|
|
int main() {
|
|
raylib::Window window(800, 600, "CS381 - Assignment 0");
|
|
window.SetState(FLAG_WINDOW_RESIZABLE);
|
|
|
|
const std::string msg = "I LOVE CS 381 AND RAYLIB!!!!";
|
|
const char *msgCstr = msg.c_str();
|
|
const float fontSize = 20;
|
|
const float spacing = 2.0f;
|
|
|
|
window.SetTargetFPS(60); // save cpu cycles
|
|
|
|
while (!window.ShouldClose()) {
|
|
window.BeginDrawing();
|
|
|
|
window.ClearBackground(raylib::Color::RayWhite());
|
|
|
|
int width = window.GetWidth();
|
|
int height = window.GetHeight();
|
|
|
|
Font font = GetFontDefault();
|
|
int textWidth = MeasureText(msgCstr, fontSize);
|
|
Vector2 origin = Vector2(textWidth / 2.0f, fontSize / 2.0f);
|
|
Vector2 position = Vector2(width / 2.0f, height / 2.0f);
|
|
float rotation = GetTime() * 22.5f; // 22.5 deg/s
|
|
Color color = raylib::Color::Gray();
|
|
|
|
DrawTextPro(font, msgCstr, position, origin, rotation, fontSize, spacing, color);
|
|
|
|
window.EndDrawing();
|
|
}
|
|
|
|
return 0;
|
|
}
|