Compare commits

..

No commits in common. "148dec2d3d972aa6fd3252916c267e3f3773e3fe" and "dc5d252c904afcc3ed88beb7eff7e815b157698d" have entirely different histories.

4 changed files with 4 additions and 23 deletions

View File

@ -1,3 +1,3 @@
# Compositor test
# SDL Boilerplate
Test for building a basic node-based compositing application
Boilerplate for setting up a simple SDL program that creates a window and a renderer and handles the quit event.

View File

@ -10,7 +10,6 @@
typedef struct point point_t;
typedef struct line line_t;
typedef struct triangle triangle_t;
typedef struct rect rect_t;
typedef struct window window_t;
struct point {
@ -29,12 +28,6 @@ struct triangle {
point_t p2;
};
struct rect {
point_t topleft;
i32 w;
i32 h;
};
struct window {
u64 width;
u64 height;
@ -59,6 +52,5 @@ void draw_point(const window_t *wnd, point_t p, colour_t colour);
void draw_line(const window_t *wnd, const line_t *ln, colour_t colour);
void draw_triangle(const window_t *wnd, const triangle_t *triangle,
colour_t colour);
void draw_rect(const window_t *wnd, const rect_t *rect, colour_t colour);
#endif // !WINDOW_H

View File

@ -36,8 +36,6 @@ i32 run_main_loop(void) {
comp.running = true;
SDL_EventState(SDL_DROPFILE, SDL_ENABLE);
colour_t bg_colour = {.abgr = 0xffffffff};
colour_t fg_colour = {.abgr = 0xff000000};

View File

@ -1,8 +1,7 @@
#include "window.h"
#include "SDL_render.h"
#include "SDL_video.h"
#include "aliases/aliases.h"
#include <SDL2/SDL_rect.h>
#include <SDL2/SDL_render.h>
#include <SDL2/SDL_video.h>
#include <stdbool.h>
bool init_window(window_t *wnd, const char *title, u64 width, u64 height) {
@ -73,11 +72,3 @@ void draw_triangle(const window_t *wnd, const triangle_t *triangle,
draw_line(wnd, &ln1, colour);
draw_line(wnd, &ln2, colour);
}
void draw_rect(const window_t *wnd, const rect_t *rect, colour_t colour) {
set_colour(wnd, colour);
SDL_Rect dst = {rect->topleft.x, rect->topleft.y, rect->w, rect->h};
SDL_RenderDrawRect(wnd->renderer, &dst);
}