Lephisto/src/toolkit.h

89 lines
3.3 KiB
C

#pragma once
#include <SDL.h>
#include "opengl.h"
#include "font.h"
extern int toolkit;
/* Creation. */
unsigned int window_create(char* name, const int x, const int y,
const int w, const int h);
void window_addButton(const unsigned int wid, const int x, const int y,
const int w, const int h, char* name, char* display,
void(*call)(char*));
void window_addText(const unsigned int wid, const int x, const int y,
const int w, const int h, const int centered, char* name,
glFont* font, glColour* colour, char* string);
void window_addImage(const unsigned int wid, const int x, const int y,
char* name, glTexture* image, int border);
void window_addList(const unsigned int wid,
const int x, const int y, /* Position. */
const int w, const int h, /* Size. */
char* name, char** items, int nitems, int defitem,
void(*call)(char*));
void window_addRect(const unsigned int wid,
const int x, const int y, /* Position. */
const int w, const int h, /* size. */
char* name, glColour* colour, int border); /* Properties. */
void window_addCust(const unsigned int wid,
const int x, const int y, /* Position. */
const int w, const int h, /* Size. */
char* name, const int border,
void(*render) (double x, double y, double w, double h),
void(*mouse) (SDL_Event* event, double x, double y));
void window_addInput(const unsigned int wid,
const int x, const int y,
const int w, const int h,
char* name, const int max, const int oneline);
/* Popups and alerts. */
/* Does not pause execution. */
void dialogue_alert(const char* fmt, ...);
void dialogue_msg(char* caption, const char* fmt, ...);
/* Yes = 1, No = 0. */
int dialogue_YesNo(char* caption, const char* fmt, ...);
char* dialogue_input(char* title, int min, int max, const char* fmt, ...);
/* Modification. */
void window_setFptr(const unsigned int wid, void(*fptr)(char*));
/* Text. */
void window_modifyText(const unsigned int wid, char* name, char* newstring);
/* Button. */
void window_disableButton(const unsigned int wid, char* name);
void window_enableButton(const unsigned int wid, char* name);
/* Image. */
void window_modifyImage(const unsigned int wid, char* name, glTexture* image);
void window_imgColour(const unsigned int wid, char* name, glColour* colour);
/* Get the window by name. */
int window_exists(const char* wdwname);
unsigned int window_get(const char* wdwname);
char* toolkit_getList(const unsigned int wid, char* name);
int toolkit_getListPos(const unsigned int wid, char* name);
glTexture* window_getImage(const unsigned int wid, char* name);
char* window_getInput(const unsigned int wid, char* name);
/* Destroy window. */
void window_destroy(const unsigned int wid);
void window_destroyWidget(unsigned wid, const char* wgtname);
/* Render. */
void toolkit_render(void);
/* Input. */
int toolkit_input(SDL_Event* event);
void toolkit_update(void);
/* Init/Exit. */
int toolkit_init(void);
void toolkit_exit(void);