Егор всё видел
This commit is contained in:
parent
ceba81a37f
commit
8874d02a66
6 changed files with 76 additions and 1 deletions
8
Makefile
8
Makefile
|
@ -3,9 +3,12 @@ HEADERSDIR = $(PREFIX)/include/glazir
|
||||||
LIBDIR = $(PREFIX)/lib64
|
LIBDIR = $(PREFIX)/lib64
|
||||||
|
|
||||||
HEADERS = src/glazir.h \
|
HEADERS = src/glazir.h \
|
||||||
|
src/types.h \
|
||||||
|
src/window.h \
|
||||||
src/version.h
|
src/version.h
|
||||||
|
|
||||||
OBJ = src/main.o
|
OBJ = src/window.o \
|
||||||
|
src/main.o
|
||||||
|
|
||||||
libglazir.a: $(OBJ)
|
libglazir.a: $(OBJ)
|
||||||
ar rcs libglazir.a $(OBJ)
|
ar rcs libglazir.a $(OBJ)
|
||||||
|
@ -27,3 +30,6 @@ uninstall/static:
|
||||||
rm $(LIBDIR)/libglazir.a
|
rm $(LIBDIR)/libglazir.a
|
||||||
|
|
||||||
uninstall: uninstall/headers uninstall/static
|
uninstall: uninstall/headers uninstall/static
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm src/*.o
|
||||||
|
|
|
@ -2,5 +2,12 @@
|
||||||
#define GLAZIR
|
#define GLAZIR
|
||||||
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
#include "window.h"
|
||||||
|
|
||||||
|
void gr_init(int argc, char *argv[]);
|
||||||
|
|
||||||
|
void gr_event(gr_Event *event);
|
||||||
|
|
||||||
|
void gr_frame();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
36
src/main.c
36
src/main.c
|
@ -0,0 +1,36 @@
|
||||||
|
#define SDL_MAIN_USE_CALLBACKS 1
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
|
#include <SDL3/SDL_main.h>
|
||||||
|
|
||||||
|
#include "glazir.h"
|
||||||
|
|
||||||
|
SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
|
||||||
|
{
|
||||||
|
if (!SDL_Init(SDL_INIT_VIDEO)) {
|
||||||
|
SDL_Log("Не удалось инициализировать SDL: %s", SDL_GetError());
|
||||||
|
return SDL_APP_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
gr_init(argc, argv);
|
||||||
|
|
||||||
|
return SDL_APP_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
|
||||||
|
{
|
||||||
|
gr_event(event);
|
||||||
|
|
||||||
|
return SDL_APP_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_AppResult SDL_AppIterate(void *appstate)
|
||||||
|
{
|
||||||
|
gr_frame();
|
||||||
|
|
||||||
|
return SDL_APP_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SDL_AppQuit(void *appstate, SDL_AppResult result)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
10
src/types.h
Normal file
10
src/types.h
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
|
|
||||||
|
struct _gr_Window {
|
||||||
|
SDL_Window* w;
|
||||||
|
SDL_Renderer* r;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct _gr_Window gr_Window;
|
||||||
|
|
||||||
|
typedef SDL_Event gr_Event;
|
11
src/window.c
Normal file
11
src/window.c
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#include "window.h"
|
||||||
|
|
||||||
|
int gr_createWindow(const char* title, int width, int height, gr_Window* window)
|
||||||
|
{
|
||||||
|
return SDL_CreateWindowAndRenderer(title, width, height, 0, &window->w, &window->r);
|
||||||
|
}
|
||||||
|
|
||||||
|
void gr_drawWindow(gr_Window* window)
|
||||||
|
{
|
||||||
|
SDL_RenderPresent(window->r);
|
||||||
|
}
|
5
src/window.h
Normal file
5
src/window.h
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
#include "types.h"
|
||||||
|
|
||||||
|
int gr_createWindow(const char* title, int width, int height, gr_Window* window);
|
||||||
|
|
||||||
|
void gr_drawWindow(gr_Window* window);
|
Loading…
Add table
Add a link
Reference in a new issue