Initial commit
This commit is contained in:
59
src/template/marl.c
Normal file
59
src/template/marl.c
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Template for a Marl implementation.
|
||||
*/
|
||||
|
||||
#include "marl.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
struct Marl_Window {};
|
||||
struct Marl_Font {};
|
||||
|
||||
Marl_Window* _marl_createWindow(const char* title, int width, int height) {
|
||||
return malloc(sizeof(Marl_Window));
|
||||
}
|
||||
|
||||
Marl_Event _marl_poll(Marl_Window* window) {
|
||||
return (Marl_Event){Marl_None, 0, 0, Marl_MouseLeft};
|
||||
}
|
||||
|
||||
void _marl_clearScreen(Marl_Window* window, uint32_t colour) {}
|
||||
|
||||
void _marl_drawRect(Marl_Window* window, int x, int y, int width, int height, uint32_t colour) {}
|
||||
|
||||
void _marl_drawText(Marl_Window* window, Marl_Font* font, const char* text, int x, int y, uint32_t colour) {}
|
||||
|
||||
int _marl_render(Marl_Window* window) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void _marl_destroyWindow(Marl_Window** windowptr) {
|
||||
free(*windowptr);
|
||||
*windowptr = NULL;
|
||||
}
|
||||
|
||||
Marl_Font* _marl_font_load(const char* path, float size) {
|
||||
return malloc(sizeof(Marl_Font));
|
||||
}
|
||||
|
||||
void _marl_font_destroy(Marl_Font** font) {
|
||||
free(*font);
|
||||
*font = NULL;
|
||||
}
|
||||
|
||||
int _marl_font_textWidth(Marl_Font* font, const char* text) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct _Marl Marl = {
|
||||
/*
|
||||
* General rendering
|
||||
*/
|
||||
_marl_createWindow, _marl_poll, _marl_clearScreen, _marl_drawRect, _marl_drawText, _marl_render, _marl_destroyWindow,
|
||||
/*
|
||||
* Text and fonts
|
||||
*/
|
||||
{ _marl_font_load, _marl_font_destroy, _marl_font_textWidth }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user