64 lines
1.9 KiB
C++
64 lines
1.9 KiB
C++
// #pragma once
|
|
|
|
// #include "waymini.h"
|
|
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include "datatypes.cpp"
|
|
#include "draw.cpp"
|
|
// #include "triangle.cpp"
|
|
// #include "buffer.cpp"
|
|
// #include "surface.cpp"
|
|
|
|
static void onKey(void *user, uint32_t keycode, uint32_t state) {
|
|
if (keycode == 1) {
|
|
exit(1);
|
|
}
|
|
(void)user;
|
|
const char *label = state ? "down" : "up ";
|
|
printf("key %s: %u\n", label, keycode);
|
|
fflush(stdout);
|
|
}
|
|
|
|
int main(void) {
|
|
uint32_t w = 800, h = 480;
|
|
UwU::Color fuchsia = UwU::Color(0xb00b6940);
|
|
UwU::Color red = UwU::Color(0xff0000ff);
|
|
UwU::Color green = UwU::Color(0x00ff00ff);
|
|
UwU::Color blue = UwU::Color(0x0000ffff);
|
|
UwU::Color alpha = UwU::Color(0x00000000);
|
|
printf("r: %u, g:%u, b:%u, a:%u\n", fuchsia.r, fuchsia.g, fuchsia.b, fuchsia.a);
|
|
|
|
// struct waymini *wm = waymini_create(w, h, on_key, NULL);
|
|
UwU::Draw draw = UwU::Draw(w, h, onKey);
|
|
|
|
draw.rainbow();
|
|
|
|
|
|
draw.rectangle(UwU::Coord2(69, 69), UwU::Coord2(420, 420), fuchsia);
|
|
draw.rectangleGradient(UwU::Coord2(200, 200), UwU::Coord2(600, 400), red, blue, alpha, red);
|
|
|
|
draw.trapezoid(UwU::Trapezoid(300, 400, 360, 380, 600, 480), green);
|
|
draw.triangle(280, 100, 240, 290, 320, 300, green);
|
|
|
|
|
|
draw.point(UwU::Coord2(387, 43), green);
|
|
draw.line(UwU::Coord2(300, 100), UwU::Coord2(250, 469), green);
|
|
draw.line(UwU::Coord2(250, 100), UwU::Coord2(300, 469), green);
|
|
draw.line(UwU::Coord2(300, 100), UwU::Coord2(469, 250), green);
|
|
draw.line(UwU::Coord2(469, 100), UwU::Coord2(300, 250), green);
|
|
draw.line(UwU::Coord2(100, 300), UwU::Coord2(250, 469), green);
|
|
draw.line(UwU::Coord2(250, 300), UwU::Coord2(100, 469), green);
|
|
draw.line(UwU::Coord2(100, 300), UwU::Coord2(469, 250), green);
|
|
draw.line(UwU::Coord2(469, 300), UwU::Coord2(100, 250), green);
|
|
draw.present();
|
|
|
|
while (!draw.shouldClose()) {}
|
|
|
|
draw.destroy();
|
|
return 0;
|
|
}
|