Hey there,

Firstly, all credits to Lukas for his awesome LBGUI contribution. grin

I posted this here because I've been using this code in a lot of my tests
and things I've been doing lately, so I thought someone else might like it too smile

Anyway, A couple of weeks ago I made a little header (a wrapper-for-a-wrapper,
so to speak) from various bits of Lukas's demo code, and also some of my own.

I think the best way to describe it is with a script:
Code:
#include <acknex.h>

#include "lbgui_simple.h" //this header automatically includes lbgui.h, so don't worry about that

LBG_WINDOW* a_window = NULL;

void button_ok()
{
	LBG_destroy_window(a_window);
}

void create_window()
{
	a_window = //We're making a window
		LBG_create_window_d(NULL, 128, 128, 256, 256, 2, 2, "A Window", 1, NULL, WF_SHOW | WF_DISABLEGUI);
		
	LBG_BUTTON* button_ok =
		LBG_create_button_d(a_window, 100, 100, 20, 2, "OK?", button_ok, BF_SHOW); 
}

void main()
{
	init_gui(WINDOWS_DEFAULT); // Can also be 'BITMAP_DEFAULT'
	
	wait(3); //Need to wait 'till the engine's ready..
	
	LBG_BUTTON* a_button = //Create a button with the default bitmaps
		LBG_create_button_d(NULL, 100, 100, 20, 2, "Create", create_window, BF_SHOW); 
	
	LBG_INFOBOX* infbox = //Then we can create an infobox for that button
		LBG_create_infobox_d(a_button, 0.1, 10, 10, 5, 5, "This will (hopefully) create a window", IF_SHOW);
}



'What's this wierd '_d' at the end of Lukas's beautiful functions?!' you may ask.

Well, my good sir, those functions with '_d' at the end do not
need bitmap definitions, as they sImply use defaults, defined in the header,
and placed in a folder called 'gui' into the project folder.

Here are the prototypes:
Code:
LBG_BUTTON* LBG_create_button_d(LBG_WINDOW* _parent, var pos_x, var pos_y, var tpos_x, var tpos_y, STRING* caption, void *Event, long flags)
LBG_WINDOW* LBG_create_window_d(LBG_WINDOW* _parent, var pos_x, var pos_y, var size_x, var size_y, var tpos_x, var tpos_y, STRING* caption, var ctype, void* content,long flags)
LBG_CHECKBOX* LBG_create_checkbox_d(LBG_WINDOW* _parent, var pos_x, var pos_y, var tpos_x, var tpos_y, STRING* caption, long flags)
LBG_INFOBOX* LBG_create_infobox_d(LBG_WINDOW* _target, var time, var pos_x, var pos_y, var tpos_x, var tpos_y, STRING* caption, long flags)
LBG_PROGRESSBAR* LBG_create_progressbar_d(LBG_WINDOW* _parent, var pos_x, var pos_y, var width, var barpos_x, var barpos_y, var tpos_x, var tpos_y, STRING* format, long flags, var maximum, var progress)
LBG_SLIDER* LBG_create_slider_d(LBG_WINDOW* _parent, var pos_x, var pos_y, var width, var minimum, var maximum, var value, long flags)
LBG_LISTBOX* LBG_create_listbox_d(LBG_WINDOW* _parent, var pos_x, var pos_y, var size_x, var size_y, var ipos_x, var ipos_y, var isize_x, var isize_y, long flags)
LBG_HSCROLLBAR* LBG_create_hscrollbar_d(LBG_WINDOW* _target, long flags)
LBG_VSCROLLBAR* LBG_create_vscrollbar_d(LBG_WINDOW* _target, long flags)
LBG_RIGHTCLICK* LBG_create_rightclick_d(LBG_WINDOW* _target, var size_x, var ipos_x, var ipos_y, var isize_x, long flags)
LBG_COMBOBOX* LBG_create_combobox_d(LBG_WINDOW* _parent, var pos_x, var pos_y, var width, var tpos_x, var tpos_y, STRING* caption, var ipos_x, var ipos_y, var isize_x, long flags)
LBG_EDITBOX* LBG_create_editbox_d(LBG_WINDOW* _parent, var pos_x, var pos_y, var width, var tpos_x, var tpos_y, STRING* caption, long flags)



Other than this, the functions perform and return things exactly the same as their LBGUI counterparts.

The function of 'init_gui()' is pretty obvious I think, and you can use either the WINDOWS_DEFAULT or BITMAP_DEFAULT
flags to determine the mouse behavior, WINDOWS being standard
arrows and things, BITMAP being a bitmap mouse respectively.

So, what the script does, in a very easy sense, is to just load a ton of defaults, so that if
you're doing a test, or simply need a placeholder GUI, 'lbgui_simple.h' should do the trick.


You can download it here. (I might change file-host later) done.

(This also includes a demo, and the 'real' LBGUI in the same package)

Also, all the bitmaps are defined at the top of 'lbgui_simple.h',
so they should be pretty easy to edit if you like.

Any questions? feel free to ask smile


Last edited by the_mehmaster; 12/21/10 02:37. Reason: Changed filehost..