sgx is a library for creating simple GUI stuff in a screen..
sgx is a screen-gadget library for PureBasic programmers to create and manage simple GUI-elements in a fullscreen or windowed screen.
it's available as sourcecode to be included in your projects. it's currently only available for Windows Operating Systems (though the code is pretty straight PB code). there are two versions: a single-file version that only contains the necessary files to just use sgx and a multi-file version in case you want to make changes to the sgx code, including the gimp files for the image files and some tools to build a single-file version from that.
with this library you can create simple GUI objects statically or dynamically of different type and appearance, modify them, display them easily, examine user actions and process events. sgx elements are accessed by ID (index-like, starting with index 1). the appearance is defined by designs, whereas you can create own designs with sets of images (there is also an instant design "lowbudget" which does not need any image files). currently there is no event queue, you will recognize events by checking for fields of your sgx elements.
currently available gadget types:
- sgxCursor
- sgxButton (including toggle buttons and buttons with a user sprite)
- sgxText
- sgxCheckbox
- sgxCombo
- sgxScrollbar
- sgxTrackbar
- sgxEdit
- sgxWin
- sgxTable
- sgxSpriteGadget
- sgxArea
- option gadgets / radio buttons are available through grouping
the documentation includes
- a quick start (sgxDoc\sgx.html)
- a full reference (sgxDoc\sgxDocFull.html)
- a smaller reference (sgxDoc\sgxDoc.html) without sgx internals (some links to sgx internals may not work in that document thought!)
- examples in the directory 'sgxDoc\'
- _README.TXT contains further informations
[...]
thanks to the PureBasic team and the community / the forums.
thanks, you're welcome!
btw: if someone is interested further into the code, i could also make a devel-package, where sgx comes in multiple sources as i'm coding it myself.
thank you guys.
@num3
that edit issue should work now. (updated)
@thyphoon
i have no MacOsX programming experience at all neither that OS, so i cannot do something about that.
i could compile and run it under linux already after taking out some things, but performance was quite bad, some colors were distored, and there is a pb TextHeight() bug. so alltogether it wasn't nice to look at .
i never got 2dddrawing/screen stuff working under linux without problems or loss of performance, but i have only humble linux expierence i must admid.
added some infos to the quickstart (sgx.html) about useful functions / variables
- you can use sgxSetGroup() to goup togglebuttons and/or checkboxes, so that only one element of that group will be toggled/checked at a time:
[...]
- sgxTipDelay defines the delay (in milliseconds) for showing tooltips
- sgxWinAnimSpeed defines the speed of min/maximizing windows ect.
- sgxHoldDelay defines the delay (in milliseconds) until hold events occur
- sgxHoldStep defines the interval (in frames) for hold events.
- iterate through all valid sgx-IDs with EACHSGX()
[...]
- get the ID of a table cell with sgxCellID()
- free elements with sgxFree() and sgxFreeChildsOf()
- move elements with sgxMove()
- bring up windows and elements in z-order with sgxMoveOnTop()
- refresh elements with sgxRefresh()
- use sgxSetText() and sgxSetState() for field-modifications that need a refresh to be visible (type dependent)
- let sgx access your general timer-variable using sgxSetEmsContainer()
Hey there, I chose to pick this screengadgetry for the game I have been working on. I had it planned I write something like this (although alot simpler) by myself but I can skip that part
Very nice code.
What I have already changed to better implement this code in my game UI is how sgxExamine() returns hovering information which I can use to avoid making mouse actions within the game field when user is clicking gadgets instead. It was just addinitonal variable which sgxExamine() returns as true/false if mouse is over a gadget.
I will list any bugs I come up with instead of just dirty fixing them
so it will return the gadget-id under the mouse, or -1 if none is there. you could also adapt it to return 0 for no hover istead of -1 if that suits you more.
besides there is the function sgxGetTopWindow(), which is used in sgxExamine() to get the value for 'topID' anyway.
i will see how i can make the devel-package. (i need to include tools, change *.bat scripts and tidy up the directory a bit..)
i added a download for the complete project directory (see first post).
also some changes (some where possibly uploaded already undocumented):
- sgxCloseLevel() got a parameter to close all levels.
- sgxExamine() returns hover information like sgxGetTopWindow().
- sgxSpriteGadget() added.
- (toggle)buttons can have an additional user sprite to be displayed.
there is also one more design, but it's only slightly different from 'outdoor'.