Crafter.Graphics/examples/HelloDrawing/main.cpp

28 lines
769 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-17 00:44:45 +01:00
Window window("HelloWindow", 1280, 720);
2025-06-13 23:59:36 +02:00
2025-11-16 20:42:48 +01:00
for(std::uint_fast32_t x = 0; x < 1280; x++) {
for(std::uint_fast32_t y = 0; y < 720; y++) {
2025-11-16 18:52:52 +01:00
window.framebuffer[x*720+y].r = 255;
window.framebuffer[x*720+y].g = 0;
window.framebuffer[x*720+y].b = 0;
window.framebuffer[x*720+y].a = 255;
}
}
2025-06-13 23:59:36 +02:00
//Semi transparant version:
2025-11-16 20:42:48 +01:00
// for(std::uint_fast32_t x = 0; x < 1280; x++) {
// for(std::uint_fast32_t = 0; y < 720; y++) {
2025-06-13 23:59:36 +02:00
// window.framebuffer[x*720+y].r = 128;//alpha channel must be premultiplied
// window.framebuffer[x*720+y].g = 0;
// window.framebuffer[x*720+y].b = 0;
// window.framebuffer[x*720+y].a = 128;
// }
// }
window.StartSync();
}