This commit is contained in:
vurtun 2015-03-20 10:58:11 +01:00
parent 0633e10938
commit 6f78f0bcff
4 changed files with 664 additions and 515 deletions

View File

@ -6,8 +6,8 @@ CC = gcc
DCC = clang
# Flags
CFLAGS = -std=c89 -pedantic-errors -Wdeprecated-declarations
CFLAGS = -g -Wall -Wextra -Wformat-security -Wunreachable-code
CFLAGS = -std=c89 -pedantic -Wdeprecated-declarations
CFLAGS += -g -Wall -Wextra -Wformat-security -Wunreachable-code
CFLAGS += -fstack-protector-strong -Winline -Wshadow -Wwrite-strings -fstrict-aliasing
CFLAGS += -Wstrict-prototypes -Wold-style-definition -Wconversion -Wfloat-equal
CFLAGS += -Wredundant-decls -Wnested-externs -Wmissing-include-dirs

899
gui.c

File diff suppressed because it is too large Load Diff

152
gui.h
View File

@ -5,31 +5,16 @@
*/
#ifndef GUI_H_
#define GUI_H_
/*
* ------------- TODO-List ------------
* - Input cursor is fucked!!!
* - Scrollbar is fucked!!!
* - Header is fucked!!!
* - Visual bugs!!!
* - panel
* o group title
* o included tabs
* o Moveable
* o Scaleable
* o Tabs (2)
* o Icon
* o combobox
* o treeView
* o textBox
* ---------------------------------------
*/
#define GUI_UTF_SIZE 4
#define GUI_INPUT_MAX 16
typedef int gui_int;
typedef unsigned int gui_uint;
typedef short gui_short;
typedef long gui_long;
typedef int gui_bool;
typedef unsigned long gui_ulong;
typedef unsigned int gui_bool;
typedef unsigned int gui_flags;
typedef unsigned char gui_char;
typedef float gui_float;
@ -49,6 +34,13 @@ struct gui_vec2 {gui_float x,y;};
struct gui_rect {gui_float x,y,w,h;};
struct gui_key {gui_int down, clicked;};
enum gui_error {
GUI_OK = 0x00,
GUI_ERROR_NOMEM = 0x01,
GUI_ERROR_INVAL = 0x02,
GUI_ERROR_INVOP = 0x04
};
struct gui_memory {
void *memory;
gui_size vertex_size;
@ -121,12 +113,12 @@ struct gui_input {
struct gui_vec2 mouse_prev;
struct gui_vec2 mouse_delta;
gui_bool mouse_down;
gui_int mouse_clicked;
gui_uint mouse_clicked;
struct gui_vec2 mouse_clicked_pos;
};
struct gui_font_glyph {
gui_int code;
gui_ulong code;
gui_float xadvance;
gui_short width, height;
gui_float xoff, yoff;
@ -174,18 +166,24 @@ struct gui_button {
enum gui_button_behavior behavior;
struct gui_color background;
struct gui_color foreground;
struct gui_color font;
struct gui_color content;
struct gui_color highlight;
struct gui_color highlight_font;
struct gui_color highlight_content;
};
enum gui_toggle_type {
GUI_TOGGLE_CHECK,
GUI_TOGGLE_OPTION
};
struct gui_toggle {
gui_float x, y;
gui_float w, h;
gui_float pad_x, pad_y;
gui_int active;
gui_bool active;
gui_size length;
const gui_char *text;
enum gui_toggle_type type;
struct gui_color font;
struct gui_color background;
struct gui_color foreground;
@ -230,7 +228,7 @@ enum gui_input_filter {
GUI_INPUT_DEC,
GUI_INPUT_HEX,
GUI_INPUT_OCT,
GUI_INPUT_BIN,
GUI_INPUT_BIN
};
struct gui_input_field {
@ -247,20 +245,6 @@ struct gui_input_field {
struct gui_color font;
};
struct gui_spinner {
gui_float x, y;
gui_float w, h;
gui_float pad_x, pad_y;
gui_bool active;
gui_int step;
gui_int max;
gui_int min;
struct gui_color background;
struct gui_color foreground;
struct gui_color button;
struct gui_color font;
};
struct gui_plot {
gui_float x, y;
gui_float w, h;
@ -294,8 +278,10 @@ enum gui_colors {
GUI_COLOR_BUTTON_BORDER,
GUI_COLOR_BUTTON_HOVER,
GUI_COLOR_BUTTON_HOVER_FONT,
GUI_COLOR_TOGGLE,
GUI_COLOR_TOGGLE_ACTIVE,
GUI_COLOR_CHECK,
GUI_COLOR_CHECK_ACTIVE,
GUI_COLOR_OPTION,
GUI_COLOR_OPTION_ACTIVE,
GUI_COLOR_SCROLL,
GUI_COLOR_SCROLL_CURSOR,
GUI_COLOR_SLIDER,
@ -306,7 +292,8 @@ enum gui_colors {
GUI_COLOR_INPUT_BORDER,
GUI_COLOR_SPINNER,
GUI_COLOR_SPINNER_BORDER,
GUI_COLOR_SPINNER_BUTTON,
GUI_COLOR_SELECTOR,
GUI_COLOR_SELECTOR_BORDER,
GUI_COLOR_HISTO,
GUI_COLOR_HISTO_BARS,
GUI_COLOR_HISTO_NEGATIVE,
@ -321,13 +308,11 @@ enum gui_colors {
};
struct gui_config {
gui_float global_alpha;
struct gui_vec2 panel_padding;
struct gui_vec2 panel_min_size;
struct gui_vec2 item_spacing;
struct gui_vec2 item_padding;
gui_float scrollbar_width;
gui_float scroll_factor;
struct gui_color colors[GUI_COLOR_COUNT];
};
@ -335,9 +320,13 @@ enum gui_panel_flags {
GUI_PANEL_TAB = 0x01,
GUI_PANEL_HEADER = 0x02,
GUI_PANEL_BORDER = 0x04,
GUI_PANEL_MINIMIZABLE = 0x08,
GUI_PANEL_MINIMIZABLE = 0x8,
GUI_PANEL_CLOSEABLE = 0x10,
GUI_PANEL_SCROLLBAR = 0x20
GUI_PANEL_SCROLLBAR = 0x20,
GUI_PANEL_HIDDEN = 0x40,
GUI_PANEL_MOVEABLE = 0x80,
GUI_PANEL_SCALEABLE = 0x100,
GUI_PANEL_OVERLAP = 0x100,
};
struct gui_panel {
@ -350,7 +339,7 @@ struct gui_panel {
gui_float row_height;
gui_size row_columns;
gui_float offset;
gui_int minimized;
gui_bool minimized;
struct gui_draw_buffer *out;
const struct gui_font *font;
const struct gui_input *in;
@ -361,7 +350,7 @@ struct gui_panel {
void gui_input_begin(struct gui_input *in);
void gui_input_motion(struct gui_input *in, gui_int x, gui_int y);
void gui_input_key(struct gui_input *in, enum gui_keys key, gui_int down);
void gui_input_button(struct gui_input *in, gui_int x, gui_int y, gui_int down);
void gui_input_button(struct gui_input *in, gui_int x, gui_int y, gui_bool down);
void gui_input_char(struct gui_input *in, gui_glyph glyph);
void gui_input_end(struct gui_input *in);
@ -376,15 +365,15 @@ void gui_text(struct gui_draw_buffer *buf, const struct gui_text *text,
gui_size gui_text_wrap(struct gui_draw_buffer *buf, const struct gui_text *text,
const struct gui_font *font);
void gui_image(struct gui_draw_buffer *buf, const struct gui_image *image);
gui_int gui_button_text(struct gui_draw_buffer *buf, const struct gui_button *button,
gui_bool gui_button_text(struct gui_draw_buffer *buf, const struct gui_button *button,
const char *text, gui_size len, const struct gui_font *font,
const struct gui_input *in);
gui_int gui_button_triangle(struct gui_draw_buffer *buffer, struct gui_button* button,
gui_bool gui_button_triangle(struct gui_draw_buffer *buffer, struct gui_button* button,
enum gui_heading heading, const struct gui_input *in);
gui_int gui_button_image(struct gui_draw_buffer *buffer, struct gui_button* button,
gui_bool gui_button_image(struct gui_draw_buffer *buffer, struct gui_button* button,
gui_texture tex, struct gui_texCoord from, struct gui_texCoord to,
const struct gui_input *in);
gui_int gui_toggle(struct gui_draw_buffer *buf, const struct gui_toggle *toggle,
gui_bool gui_toggle(struct gui_draw_buffer *buf, const struct gui_toggle *toggle,
const struct gui_font *font, const struct gui_input *in);
gui_float gui_slider(struct gui_draw_buffer *buf, const struct gui_slider *slider,
const struct gui_input *in);
@ -394,15 +383,9 @@ gui_size gui_progress(struct gui_draw_buffer *buf, const struct gui_progress *pr
const struct gui_input *in);
gui_size gui_progress_vertical(struct gui_draw_buffer *buf, const struct gui_progress *prog,
const struct gui_input *in);
gui_int gui_input(struct gui_draw_buffer *buf, gui_char *buffer, gui_size *length,
gui_bool gui_input(struct gui_draw_buffer *buf, gui_char *buffer, gui_size *length,
const struct gui_input_field *input,
const struct gui_font *font, const struct gui_input *in);
gui_size gui_command(struct gui_draw_buffer *buf, gui_char *buffer, gui_size *length,
gui_int *active, const struct gui_input_field *input,
const struct gui_font *font, const struct gui_input *in);
gui_int gui_spinner(struct gui_draw_buffer *buf, gui_int *value,
const struct gui_spinner *spinner, const struct gui_font *font,
const struct gui_input *in);
gui_float gui_scroll(struct gui_draw_buffer *buf, const struct gui_scroll *scroll,
const struct gui_input *in);
gui_int gui_histo(struct gui_draw_buffer *buf, const struct gui_histo *histo,
@ -414,45 +397,52 @@ gui_int gui_plot(struct gui_draw_buffer *buf, const struct gui_plot *plot,
void gui_default_config(struct gui_config *config);
void gui_panel_init(struct gui_panel *panel, const struct gui_config *config,
const struct gui_font *font, const struct gui_input *input);
gui_int gui_panel_begin(struct gui_panel *panel, struct gui_draw_buffer *buffer,
const char *text, gui_flags flags,
gui_float x, gui_float y, gui_float w, gui_float h);
gui_bool gui_panel_begin(struct gui_panel *panel, struct gui_draw_buffer *buffer,
const char *text, gui_float x, gui_float y, gui_float w,
gui_float h, gui_flags flags);
void gui_panel_layout(struct gui_panel *panel, gui_float height, gui_size cols);
void gui_panel_seperator(struct gui_panel *panel, gui_size cols);
void gui_panel_text(struct gui_panel *panel, const char *str, gui_size len);
gui_int gui_panel_button_text(struct gui_panel *panel, const char *str, gui_size len,
gui_bool gui_panel_check(struct gui_panel *p, const char *s, gui_size l, gui_bool a);
gui_bool gui_panel_option(struct gui_panel *p, const char *s, gui_size l, gui_bool a);
gui_bool gui_panel_button_text(struct gui_panel *panel, const char *str, gui_size len,
enum gui_button_behavior behavior);
gui_int gui_panel_button_invisible(struct gui_panel *panel, const char *str, gui_size len,
gui_bool gui_panel_button_invisible(struct gui_panel *panel, const char *str, gui_size len,
enum gui_button_behavior behavior);
gui_int gui_panel_button_color(struct gui_panel *panel, const struct gui_color color,
gui_bool gui_panel_button_color(struct gui_panel *panel, const struct gui_color color,
enum gui_button_behavior behavior);
gui_int gui_panel_button_triangle(struct gui_panel *panel, enum gui_heading heading,
gui_bool gui_panel_button_triangle(struct gui_panel *panel, enum gui_heading heading,
enum gui_button_behavior behavior);
gui_int gui_panel_button_image(struct gui_panel *panel, gui_texture tex,
gui_bool gui_panel_button_image(struct gui_panel *panel, gui_texture tex,
struct gui_texCoord from, struct gui_texCoord to,
enum gui_button_behavior behavior);
gui_int gui_panel_button_toggle(struct gui_panel *panel, const char *str, gui_size len,
gui_int value);
gui_int gui_panel_toggle(struct gui_panel *panel, const char *str, gui_size len,
gui_int active);
gui_float gui_panel_slider(struct gui_panel *panel, gui_float min, gui_float v,
gui_bool gui_panel_button_toggle(struct gui_panel *panel, const char *str, gui_size len,
gui_bool value);
gui_float gui_panel_slider(struct gui_panel *panel, gui_float min, gui_float val,
gui_float max, gui_float step, enum gui_direction d);
gui_size gui_panel_progress(struct gui_panel *panel, gui_size cur, gui_size max,
gui_bool modifyable, enum gui_direction d);
gui_int gui_panel_input(struct gui_panel *panel, gui_char *buffer, gui_size *len,
gui_bool gui_panel_input(struct gui_panel *panel, gui_char *buffer, gui_size *len,
gui_size max, enum gui_input_filter filter, gui_bool active);
gui_size gui_panel_command(struct gui_panel *panel, gui_char *buffer, gui_size *length,
gui_size max, gui_int *active);
gui_int gui_panel_spinner(struct gui_panel *panel, gui_int min, gui_int *value,
gui_int max, gui_int step, gui_int active);
gui_size max, gui_bool *active);
gui_bool gui_panel_spinner(struct gui_panel *panel, gui_int min, gui_int *value,
gui_int max, gui_int step, gui_bool active);
gui_size gui_panel_selector(struct gui_panel *panel, const char *items[],
gui_size item_count, gui_size item_current);
gui_int gui_panel_plot(struct gui_panel *panel, const gui_float *values,
gui_size value_count);
gui_int gui_panel_histo(struct gui_panel *panel, const gui_float *values,
gui_size value_count);
gui_float gui_panel_list(struct gui_panel *panel, gui_bool *selected,
const char *items[], gui_size item_count, gui_float offset);
void gui_panel_group_begin(struct gui_panel *panel, const char *t, struct gui_panel *tab);
void gui_panel_group_end(struct gui_panel *tab);
void gui_panel_end(struct gui_panel *panel);
gui_int gui_panel_text_box(struct gui_panel *panel, char *text, gui_size *len,
gui_float *offset, gui_int active);
gui_float gui_panel_list(struct gui_panel *panel, gui_bool *selected, const char *items[],
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 *tab);
void gui_panel_hook(struct gui_panel *panel, struct gui_panel *tab);
gui_uint gui_panel_end(struct gui_panel *panel);
/* Window */
#endif

124
opengl.c
View File

@ -31,7 +31,7 @@
#define WIN_WIDTH 800
#define WIN_HEIGHT 600
#define DTIME 33
#define MAX_BUFFER (32 * 1024)
#define MAX_BUFFER (64 * 1024)
#define INPUT_MAX 64
#define LEN(a)(sizeof(a)/sizeof(a)[0])
@ -47,19 +47,22 @@ struct XWindow {
XWindowAttributes gwa;
Window win;
GLXContext glc;
int running;
gui_bool running;
};
struct GUI {
struct XWindow *win;
struct gui_memory memory;
struct gui_memory main;
struct gui_memory combo;
struct gui_memory_status status;
struct gui_draw_buffer out;
struct gui_draw_call_list draw_list;
struct gui_input in;
struct gui_font *font;
struct gui_config config;
struct gui_panel panel;
gui_bool selection[4];
struct gui_panel tab;
gui_bool selection[6];
gui_float seloff;
/* State */
@ -67,16 +70,19 @@ struct GUI {
gui_char cmd_input[INPUT_MAX];
gui_size input_len;
gui_size cmd_len;
gui_int typing;
gui_bool typing;
gui_float slider;
gui_float vslider;
gui_size prog;
gui_size vprog;
gui_size vprog2;
gui_size vprog3;
gui_int spinner;
gui_int selected;
gui_int spinning;
gui_bool check;
gui_bool option;
gui_bool spinning;
gui_size submit;
gui_int submitting;
gui_bool submitting;
gui_size select;
};
/* functions */
@ -95,7 +101,6 @@ static void resize(struct GUI*, XEvent*);
static GLuint ldbmp(gui_byte*, uint32_t*, uint32_t*);
static struct gui_font *ldfont(const char*, unsigned char);
static void delfont(struct gui_font*);
static void draw(int, int, const struct gui_draw_call_list*);
/* gobals */
static void
@ -304,6 +309,9 @@ ldfont(const char *name, unsigned char height)
uint32_t img_width, img_height;
short max_height = 0;
size_t i = 0;
size_t mem;
gui_byte *iter;
struct gui_font_glyph *glyphes;
uint16_t num;
uint16_t indexes;
@ -318,9 +326,9 @@ ldfont(const char *name, unsigned char height)
memcpy(&tex_height, &buffer[0x06], sizeof(uint16_t));
/* glyphes */
gui_byte *iter = &buffer[0x08];
size_t mem = sizeof(struct gui_font_glyph) * ((size_t)indexes + 1);
struct gui_font_glyph *glyphes = xcalloc(mem, 1);
iter = &buffer[0x08];
mem = sizeof(struct gui_font_glyph) * ((size_t)indexes + 1);
glyphes = xcalloc(mem, 1);
for(i = 0; i < num; ++i) {
uint16_t id, x, y, w, h;
float xoff, yoff, xadv;
@ -377,16 +385,17 @@ delfont(struct gui_font *font)
}
static void
draw(int width, int height, const struct gui_draw_call_list *list)
draw(int width, int height, const struct gui_draw_call_list **list, gui_size count)
{
gui_size i = 0;
const struct gui_draw_command *cmd;
gui_size n = 0;
GLint offset = 0;
const gui_byte *vertexes;
const struct gui_draw_command *cmd;
static const size_t v = sizeof(struct gui_vertex);
static const size_t p = offsetof(struct gui_vertex, pos);
static const size_t t = offsetof(struct gui_vertex, uv);
static const size_t c = offsetof(struct gui_vertex, color);
const gui_byte *vertexes;
if (!list) return;
glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT | GL_TRANSFORM_BIT);
@ -408,21 +417,24 @@ draw(int width, int height, const struct gui_draw_call_list *list)
glPushMatrix();
glLoadIdentity();
vertexes = (const gui_char*)list->vertexes;
glVertexPointer(2, GL_FLOAT, (GLsizei)v, (const void*)(vertexes + p));
glTexCoordPointer(2, GL_FLOAT, (GLsizei)v, (const void*)(vertexes + t));
glColorPointer(4, GL_UNSIGNED_BYTE, (GLsizei)v, (const void*)(vertexes + c));
for (n = 0; n < count; ++n) {
vertexes = (const gui_char*)list[n]->vertexes;
glVertexPointer(2, GL_FLOAT, (GLsizei)v, (const void*)(vertexes + p));
glTexCoordPointer(2, GL_FLOAT, (GLsizei)v, (const void*)(vertexes + t));
glColorPointer(4, GL_UNSIGNED_BYTE, (GLsizei)v, (const void*)(vertexes + c));
for (i = 0; i < list->command_size; ++i) {
cmd = &list->commands[i];
const int x = (int)cmd->clip_rect.x;
const int y = height - (int)(cmd->clip_rect.y + cmd->clip_rect.h);
const int w = (int)cmd->clip_rect.w;
const int h = (int)cmd->clip_rect.h;
glScissor(x, y, w, h);
glBindTexture(GL_TEXTURE_2D, (GLuint)(unsigned long)cmd->texture);
glDrawArrays(GL_TRIANGLES, offset, (GLsizei)cmd->vertex_count);
offset += (GLint)cmd->vertex_count;
for (i = 0; i < list[n]->command_size; ++i) {
int x,y,w,h;
cmd = &list[n]->commands[i];
x = (int)cmd->clip_rect.x;
y = height - (int)(cmd->clip_rect.y + cmd->clip_rect.h);
w = (int)cmd->clip_rect.w;
h = (int)cmd->clip_rect.h;
glScissor(x, y, w, h);
glBindTexture(GL_TEXTURE_2D, (GLuint)(unsigned long)cmd->texture);
glDrawArrays(GL_TRIANGLES, offset, (GLsizei)cmd->vertex_count);
offset += (GLint)cmd->vertex_count;
}
}
glDisableClientState(GL_COLOR_ARRAY);
@ -441,10 +453,11 @@ main(int argc, char *argv[])
struct XWindow xw;
struct GUI gui;
long dt, started;
static const char *s[] = {"inactive", "active"};
const struct gui_draw_call_list *list;
static const gui_float values[] = {10.0f, 12.5f, 18.0f, 15.0f, 25.0f, 30.0f};
static GLint att[] = {GLX_RGBA, GLX_DEPTH_SIZE,24, GLX_DOUBLEBUFFER, None};
static const char *sel[] = {"item0", "item1", "item2", "item3"};
static const char *sel[] = {"item0", "item1", "item2", "item3", "item4", "item5"};
static const char *select[] = {"Fist", "Pistol", "Shotgun", "Railgun", "BFG"};
/* Window */
UNUSED(argc); UNUSED(argv);
@ -475,18 +488,22 @@ main(int argc, char *argv[])
xw.glc = glXCreateContext(xw.dpy, xw.vi, NULL, GL_TRUE);
glXMakeCurrent(xw.dpy, xw.win, xw.glc);
/* GUI */
gui.win = &xw;
gui.option = 0;
gui.select = 0;
gui.prog = 60;
gui.vprog = 70;
gui.vprog2 = 30;
gui.vprog3 = 50;
gui.spinner = 100;
gui.slider = 5.0f;
gui.vslider = 2.0f;
/* GUI */
gui.font = ldfont("mono.sdf", 16);
gui.memory.memory = xcalloc(MAX_BUFFER, 1);
gui.memory.clip_size = MAX_BUFFER / 16;
gui.memory.command_size = MAX_BUFFER / 6;
gui.memory.vertex_size = MAX_BUFFER - gui.memory.clip_size - gui.memory.command_size;
gui.main.memory = xcalloc(MAX_BUFFER, 1);
gui.main.clip_size = MAX_BUFFER / 32;
gui.main.command_size = MAX_BUFFER / 6;
gui.main.vertex_size = MAX_BUFFER - gui.main.clip_size - gui.main.command_size;
gui_default_config(&gui.config);
gui_panel_init(&gui.panel, &gui.config, gui.font, &gui.in);
@ -506,37 +523,42 @@ main(int argc, char *argv[])
gui_input_end(&gui.in);
/* ------------------------- GUI --------------------------*/
gui_begin(&gui.out, &gui.memory);
xw.running = gui_panel_begin(&gui.panel, &gui.out, "Demo",
GUI_PANEL_HEADER|GUI_PANEL_CLOSEABLE|GUI_PANEL_MINIMIZABLE|GUI_PANEL_SCROLLBAR,
20, 20, 200, 400);
gui_begin(&gui.out, &gui.main);
xw.running = gui_panel_begin(&gui.panel, &gui.out, "Demo", 20, 20, 200, 400,
GUI_PANEL_HEADER|GUI_PANEL_CLOSEABLE|GUI_PANEL_MINIMIZABLE|GUI_PANEL_SCROLLBAR);
gui_panel_layout(&gui.panel, 30, 1);
if (gui_panel_button_text(&gui.panel, "button", 6, GUI_BUTTON_SWITCH))
fprintf(stdout, "button pressed!\n");
gui.slider = gui_panel_slider(&gui.panel, 0.0f, gui.slider, 10.0f, 1.0f, GUI_HORIZONTAL);
gui.prog = gui_panel_progress(&gui.panel, gui.prog, 100, gui_true, GUI_HORIZONTAL);
gui.selected = gui_panel_toggle(&gui.panel, s[gui.selected],
strlen(s[gui.selected]), gui.selected);
gui.check = gui_panel_check(&gui.panel, "advanced", 8, gui.check);
gui_panel_layout(&gui.panel, 30, 2);
if (gui_panel_option(&gui.panel, "easy", 4, gui.option == 0)) gui.option = 0;
if (gui_panel_option(&gui.panel, "hard", 4, gui.option == 1)) gui.option = 1;
gui_panel_layout(&gui.panel, 30, 1);
gui.typing = gui_panel_input(&gui.panel, gui.input_text, &gui.input_len, INPUT_MAX,
GUI_INPUT_DEFAULT, gui.typing);
gui.submit = gui_panel_command(&gui.panel, gui.cmd_input, &gui.cmd_len, INPUT_MAX,
&gui.submitting);
gui.spinning = gui_panel_spinner(&gui.panel, 0, &gui.spinner, 250, 10, gui.spinning);
gui_panel_layout(&gui.panel, 100, 2);
gui.vslider = gui_panel_slider(&gui.panel, 0.0f, gui.vslider, 6.0f, 1.0f, GUI_VERTICAL);
gui.select = gui_panel_selector(&gui.panel, select, LEN(select), gui.select);
gui_panel_layout(&gui.panel, 100, 3);
gui.vprog = gui_panel_progress(&gui.panel, gui.vprog, 100, gui_true, GUI_VERTICAL);
gui.vprog2 = gui_panel_progress(&gui.panel, gui.vprog2, 100, gui_true, GUI_VERTICAL);
gui.vprog3 = gui_panel_progress(&gui.panel, gui.vprog3, 100, gui_true, GUI_VERTICAL);
gui_panel_layout(&gui.panel, 100, 1);
gui_panel_plot(&gui.panel, values, LEN(values));
gui.seloff = gui_panel_list(&gui.panel, gui.selection, sel, LEN(sel), gui.seloff, 30);
gui_panel_histo(&gui.panel, values, LEN(values));
gui.seloff = gui_panel_list(&gui.panel, gui.selection, sel, LEN(sel), gui.seloff);
gui_panel_plot(&gui.panel, values, LEN(values));
gui_panel_end(&gui.panel);
gui_end(&gui.out, &gui.draw_list, NULL);
gui_end(&gui.out, &gui.draw_list, &gui.status);
/* ---------------------------------------------------------*/
/* Draw */
glClearColor(120.0f/255.0f, 120.0f/255.0f, 120.0f/255.0f, 120.0f/255.0f);
glClear(GL_COLOR_BUFFER_BIT);
draw(xw.gwa.width, xw.gwa.height, &gui.draw_list);
list = &gui.draw_list;
draw(xw.gwa.width, xw.gwa.height, &list, 1);
glXSwapBuffers(xw.dpy, xw.win);
/* Timing */
@ -546,7 +568,7 @@ main(int argc, char *argv[])
}
/* Cleanup */
free(gui.memory.memory);
free(gui.main.memory);
delfont(gui.font);
XFree(xw.vi);
glXMakeCurrent(xw.dpy, None, NULL);