Oblivision
A simple UI library rendered directly from a pixel buffer
Loading...
Searching...
No Matches
oblivision.h
Go to the documentation of this file.
1/*Copyright (c) 2023, Tristan Wellman*/
2
9#ifndef RENDERER_GRAPHICS_H
10#define RENDERER_GRAPHICS_H
11#include <stdio.h>
12#include <stdlib.h>
13#include <string.h>
14#include <math.h>
15#include <stdint.h>
16#define SDL_MAIN_HANDLED
17#include <SDL2/SDL.h>
18#include <SDL2/SDL_ttf.h>
19
20#include "colors.h"
21
22
23#define OV_DEBUG_ENABLE 1
24
28typedef struct color_s {
29 int color;
31
35typedef struct vec2_s {
36 int x, y;
38
43#define MAXWID 7680
44#define MAXHEI 4320
45#define MAX_WIGS 256
51struct windata {
52
53 int ovflag;
54 SDL_Window *window;
55 SDL_Renderer *renderer;
56
57 SDL_Texture *target_texture;
58 SDL_Texture *texture;
59
60 SDL_Surface *text_surface[MAX_WIGS];
61 SDL_Texture *text_texture[MAX_WIGS];
62
63 const char *fonttitle;
64 TTF_Font *font;
65
66 OV_COLOR bg_color;
67
68 int pixel_data[MAXWID*MAXHEI];
69 char *last_pixel_data;
70
71 int height, width;
72 int in_window;
73
74};
75
76
81 int num_wigs;
82 const char *names[MAX_WIGS];
83 vec2 wig_sizes[MAX_WIGS];
84 vec2 wig_pos[MAX_WIGS];
85};
86
91void OV_colorTest();
92
97void OV_setBackground(OV_COLOR bg_color);
98
108int OV_createWindow(int width, int height, vec2 pos, const char *name);
109
115void OV_pollEvent(SDL_Event event);
116
117
118void OV_renderFrame(SDL_Event event);
119void OV_setFlags(int flag);
120void OV_setFont(const char *font);
121int OVInit(SDL_Window *window, int width, int height, const char *winname);
122void OV_free();
123
124#endif
color header for the Oblivision API.
struct vec2_s vec2
Vector data for things like window position/sizes.
void OV_setBackground(OV_COLOR bg_color)
Sets the background color of your Oblivision window.
Definition oblivision.c:25
void OV_pollEvent(SDL_Event event)
runs the SDL event poll loop to register key events and update window positions
Definition oblivision.c:183
struct color_s OV_COLOR
A "non-proprietary" typedef holding colordata.
void OV_colorTest()
Runs a simple color tester.
Definition oblivision.c:11
int OV_createWindow(int width, int height, vec2 pos, const char *name)
Initializes and creates an Oblivision window.
Definition oblivision.c:39
Definition oblivision.h:28
Definition oblivision.h:35
Structure to hold all widget(OV window) data.
Definition oblivision.h:80
Main structure for managing all pixel data, textures, sizes, etc.
Definition oblivision.h:51