Crafter.Graphics/examples/HelloDrawing/main.cpp

22 lines
549 B
C++
Raw Normal View History

2025-06-13 23:59:36 +02:00
import Crafter.Graphics;
2025-11-16 18:52:52 +01:00
import std;
2025-04-16 00:43:33 +02:00
using namespace Crafter;
2025-06-13 23:59:36 +02:00
int main() {
2025-11-18 22:06:17 +01:00
constexpr std::uint_fast32_t width = 1280;
constexpr std::uint_fast32_t height = 720;
2025-06-13 23:59:36 +02:00
2025-11-23 04:04:53 +01:00
WindowWayland window(width, height, "Hello Drawing!");
2025-11-18 22:06:17 +01:00
for(std::uint_fast32_t x = 0; x < width; x++) {
for(std::uint_fast32_t y = 0; y < height; y++) {
window.framebuffer[x*height+y].r = 255;
window.framebuffer[x*height+y].g = 0;
window.framebuffer[x*height+y].b = 0;
window.framebuffer[x*height+y].a = 255;
2025-11-16 18:52:52 +01:00
}
}
2025-06-13 23:59:36 +02:00
2025-11-18 22:06:17 +01:00
window.Render();
2025-06-13 23:59:36 +02:00
window.StartSync();
}