moved opengl to demo directory

This commit is contained in:
vurtun 2015-03-27 17:19:49 +01:00
parent 7b69fd8b76
commit 3489caac85
4 changed files with 15 additions and 24 deletions

View File

@ -16,7 +16,7 @@ CFLAGS += -Wswitch-default -Wundef -Wno-unused -Wstrict-overflow=5 -Wsign-conver
CFLAGS += -Winit-self -Wstrict-aliasing -fsanitize=address -fsanitize=undefined -ftrapv
CFLAGS += -Wswitch-enum -Winvalid-pch -Wbad-function-cast
SRC = gui.c opengl.c
SRC = gui.c demo/opengl.c
OBJ = $(SRC:.c=.o)
# Modes

View File

@ -12,7 +12,7 @@
#include <GL/glu.h>
#include <SDL2/SDL.h>
#include "gui.h"
#include "../gui.h"
/* macros */
#define LEN(a) (sizeof(a)/sizeof(a)[0])
@ -448,10 +448,8 @@ main(int argc, char *argv[])
gui_begin_panel(ctx, subpanel, "Error",
GUI_PANEL_HEADER|GUI_PANEL_BORDER|GUI_PANEL_MOVEABLE);
gui_panel_layout(subpanel, 30, 2);
if (gui_panel_button_text(subpanel, "ok", 2, GUI_BUTTON_SWITCH))
break;
if (gui_panel_button_text(subpanel, "cancel", 6, GUI_BUTTON_SWITCH))
break;
if (gui_panel_button_text(subpanel, "ok", 2, GUI_BUTTON_SWITCH)) break;
if (gui_panel_button_text(subpanel, "cancel", 6, GUI_BUTTON_SWITCH)) break;
gui_end_panel(ctx, subpanel, NULL);
gui_end(ctx, &output, NULL);
/* ---------------------------------------------------------*/

20
gui.c
View File

@ -5,6 +5,12 @@
*/
#include "gui.h"
#ifndef NDEBUG
#include <assert.h>
#else
#define assert(expr)
#endif
#define NULL (void*)0
#define UTF_INVALID 0xFFFD
#define MAX_NUMBER_BUFFER 64
@ -20,12 +26,6 @@
#define ALIGNOF(t) ((char*)(&((struct {char c; t _h;}*)0)->_h) - (char*)0)
#define ALIGN(x, mask) (void*)((gui_size)((gui_byte*)(x) + (mask-1)) & ~(mask-1))
#ifndef NDEBUG
#include <assert.h>
#else
#define assert(expr)
#endif
#define col_load(c,j,k,l,m) (c).r = (j), (c).g = (k), (c).b = (l), (c).a = (m)
#define vec2_load(v,a,b) (v).x = (a), (v).y = (b)
#define vec2_mov(to,from) (to).x = (from).x, (to).y = (from).y
@ -303,6 +303,7 @@ gui_input_char(struct gui_input *in, const gui_glyph glyph)
{
gui_size len = 0;
gui_long unicode;
assert(in);
if (!in) return;
len = utf_decode(glyph, &unicode, GUI_UTF_SIZE);
if (len && ((in->text_len + len) < GUI_INPUT_MAX)) {
@ -2459,13 +2460,13 @@ gui_panel_frame_end(struct gui_panel *tab)
gui_panel_end(tab);
}
gui_uint
void
gui_panel_end(struct gui_panel *panel)
{
const struct gui_config *config;
assert(panel);
if (!panel) return 0;
if (panel->flags & GUI_PANEL_HIDDEN) return 0;
if (!panel) return;
if (panel->flags & GUI_PANEL_HIDDEN) return;
gui_pop_clip(panel->out);
panel->at_y += panel->row_height;
@ -2511,7 +2512,6 @@ gui_panel_end(struct gui_panel *panel)
gui_draw_line(panel->out, panel->x + width, panel->y, panel->x + width,
padding_y, config->colors[GUI_COLOR_BORDER]);
}
return GUI_OK;
}
struct gui_context*

9
gui.h
View File

@ -75,13 +75,6 @@ struct gui_input {
struct gui_vec2 mouse_clicked_pos;
};
enum gui_error {
GUI_OK = 0x00,
GUI_ERROR_NOMEM = 0x01,
GUI_ERROR_INVAL = 0x02,
GUI_ERROR_INVOP = 0x04
};
struct gui_vertex {
struct gui_vec2 pos;
struct gui_texCoord uv;
@ -444,7 +437,7 @@ gui_float gui_panel_list(struct gui_panel*, gui_bool *selected, const char *item
gui_size item_count, gui_float offset, gui_float item_height);
void gui_panel_frame_begin(struct gui_panel *panel, struct gui_panel *tab, const char *title);
void gui_panel_frame_end(struct gui_panel*);
gui_uint gui_panel_end(struct gui_panel*);
void gui_panel_end(struct gui_panel*);
/* Context */
struct gui_context;