sgx - includefile for screen gagdets

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
#NULL
Addict
Addict
Posts: 1440
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

sgx - includefile for screen gagdets

Post by #NULL »

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.
for the last update see this post

<screenshot>

<download> (1,3mb) ..you should start with the introduction 'sgxDoc\sgx.html'
Last edited by #NULL on Tue Jun 21, 2016 5:21 pm, edited 6 times in total.
Inf0Byt3
PureBasic Fanatic
PureBasic Fanatic
Posts: 2236
Joined: Fri Dec 09, 2005 12:15 pm
Location: Elbonia

Post by Inf0Byt3 »

Excellent code! This will be very usefull!
#NULL
Addict
Addict
Posts: 1440
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Post by #NULL »

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.
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Post by Dare »

Very nice. Thank you.
Dare2 cut down to size
User avatar
thyphoon
Enthusiast
Enthusiast
Posts: 327
Joined: Sat Dec 25, 2004 2:37 pm

Post by thyphoon »

Very great code !
it's only available for Windows
Do you think add Linux and MacOsX support ?
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Excellent. Thank you.
I may look like a mule, but I'm not a complete ass.
Num3
PureBasic Expert
PureBasic Expert
Posts: 2810
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Post by Num3 »

Found a small bug in the sxeditor... When you press capslock, and type, it repeats twice the capitalized letter...

Code: Select all

Ii there
BRILLIANT STUFF btw :D
#NULL
Addict
Addict
Posts: 1440
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Post by #NULL »

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 :P .
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.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Very impressive, thanks !
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
#NULL
Addict
Addict
Posts: 1440
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Post by #NULL »

thanks, you're welcome too!

i forgot to say:
i just changed the order of parameters for sgxCellAssign(). i/k comes first now.
#NULL
Addict
Addict
Posts: 1440
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Post by #NULL »

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()
User avatar
Raybarg
User
User
Posts: 54
Joined: Mon Apr 30, 2007 7:02 am

Post by Raybarg »

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 ;)
X
Enthusiast
Enthusiast
Posts: 311
Joined: Tue Apr 04, 2006 6:27 am

Post by X »

This was linked to from the other GUI thread ...

To the poster above ... could you post your changes here? That would be nice ..

Also, to the person who created this. Have you made any chances since posting this code? How is the devel-package coming along?
#NULL
Addict
Addict
Posts: 1440
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Post by #NULL »

i think it schould be enough to add this line at the end of the procedure sgxExamine:

Code: Select all

Procedure sgxExamine(...
  
  ; [...]
  
  ProcedureReturn topID
EndProcedure
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..)
#NULL
Addict
Addict
Posts: 1440
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Post by #NULL »

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'.
Post Reply