Skip to content

ec429/libatg

Repository files navigation

atg - a tiny gui

atg is a small, simple GUI library/toolkit for SDL, providing things like buttons and clickables to allow you to concentrate on your program logic.  atg is loosely based on Spiffy's GUI, though genericised.

atg Event Queue:
	atg will poll SDL for events, and if these events trigger any atg elements, these elements' events will be placed on the queue.  In any case all SDL events will be placed on the atg queue, in case the application wishes to further process them.  Note that if the application calls SDL_PollEvent() or SDL_WaitEvent(), these events will not be 'seen' by atg.  Thus, the application should instead call atg_poll_event() or atg_wait_event().

Custom Widgets:
	atg can be extended with custom widgets.  When handling an element, atg will use its callbacks to render, handle clicks, pack in new elements, copy, and free.
	An example of this is the 'selector' widget created in widget.c.  It consists of a box containing four buttons.  When one of these buttons is clicked, the value is set (written through the "userdata" pointer), and the selected option is highlighted.
	The render callback, selector_render_callback, applies the highlighting of the currently selected option, and then hands off the actual rendering to atg_render_box.  Consequently, the box and its contents are rendered in the normal way.  This is usually what you want when your widget is based on a box.
	The click-handler callback, selector_match_click_callback, uses atg__match_click_recursive to pass the click to the child elements (the four buttons), but then catches their events itself and interprets them, instead of passing them back down the stack.  It generates a value-change event if the selected value has changed.
	The pack callback is left at the default; since the widget was created with atg_create_element_box, this is atg_pack_box.  Consequently, extra elements can be added into a selector with atg_ebox_pack.
	The copy callback is left at the default; since the widget was created with atg_create_element_box, this is atg_copy_box.
	The free callback is left at the default; since the widget was created with atg_create_element_box, this is atg_free_box.

About

A Tiny GUI toolkit for SDL

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •