Author Topic: so im working on a gui  (Read 1764 times)

0 Members and 1 Guest are viewing this topic.

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
so im working on a gui
as i started adding new features to my scripts i decided that at some point in time id need to script a ui system from scratch. some time last week started working a system to add buttons to menues, however i decided to keep adding element types. im working on a complete general purpose user interface for freespace. the idea is to provide a set of generic elements with which to build a complete interface with. each element will be skinable or can be rendered with primitives. here are the primitives im currently thinking about:

buttons (single action and toggle)
sliders
scroll bars (maybe implemented as a slider and buttons)
radio button arrays
check boxes (may be the same as buttons)
knobs (radial version of a slider)
frames (contains elements)
captions (essentially text labels)
text boxes
menu boxes

feel free to suggest more

once i got my buttons working i needed to come up with some way to make them do stuff, i thought that maybe they would just change a value that scripts would use. but then i decided to make use of lua's table capabilities. i realized you could put a function into a table with all its arguments, store it for as long as you like, then execute it at the proper time. i decided call these tables deferred functions. you create one by calling create_deferred_function(), where its first argument is a function and the remaining arguments are transferred to that function when it is called. you then can assign the table (deferred function!) that it returns to a key in that element's events table. so every time that event happens, the deferred function assigned to that event's table key is executed.

one more feature ive decided to add was element hierarchy, which will allow you to create windows and such, so things like position are in relation to the parent's position, it will also affect rendering order.

its nowhere near ready enough for any code to be posted, maybe after i get 4 or 5 kinds of elements working. i just kinda wanted to get the idea out while its being developed to stir up some ideas. once done it will be one step closer to a complete scripted user interface alternative for freespace. there has been some talk about making the values of interface elements in the freespace ui script reachable. put the two together and you can replace the whole interface with one of your own design, instead of just a reskin of the hard coded system.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline redsniper

  • 211
  • Aim for the Top!
Re: so im working on a gui
Wait, where would we see this? Is it a replacement for the default UI or would this be in-mission or something?
"Think about nice things not unhappy things.
The future makes happy, if you make it yourself.
No war; think about happy things."   -WouterSmitssm

Hard Light Productions:
"...this conversation is pointlessly confrontational."

 

Offline The E

  • He's Ebeneezer Goode
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Re: so im working on a gui
Theoretically, anywhere you want.

Provided that nuke releases it.
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline Galemp

  • Actual father of Samus
  • 212
  • Ask me about GORT!
    • Steam
    • User page on the FreeSpace Wiki
Re: so im working on a gui
If anyone can do this, Nuke can. :yes:

Even something very rudimentary would be excellent to distribute free with the engine, or to use with multiplayer-only standalone deployments.
"Anyone can do any amount of work, provided it isn't the work he's supposed to be doing at that moment." -- Robert Benchley

Members I've personally met: RedStreblo, Goober5000, Sandwich, Splinter, Su-tehp, Hippo, CP5670, Terran Emperor, Karajorma, Dekker, McCall, Admiral Wolf, mxlm, RedSniper, Stealth, Black Wolf...

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: so im working on a gui
il post some code when it gets to version 0.3 or 0.4, i add point 1 every time i complete one of the interface elements. so far buttons are complete and have had most of the bugs smashed. i was working on sliders but i havent got them working yet. i might throw in some simple stuff in the mean time, like captions and frames. captions are just labels and dont really need any interface at all. frames on the other hand will require that i add some kinda hierarchy to all the other elements, so if you move a frame, or make it invisible, all the elements will inherit those traits. i just kinda wanted to stir up some discussion about it at this point which might be helpful and give me ideas.

even if the ui is completed, some scripting interfaces (possibly in the form of hook variables) would be needed to make it control things that the hard-coded interface does. a ui is just one essential thing that needs to be done before the hard coded interface can be eliminated. but even without a way to control game settings the ui can still be useful in scripts that need some user friendly way to change settings for scripts (wanderer's mousescript for example) which arent managed at all by the c code at all (usually output to a file and then loaded by a parser), and theres no reason it cant be used in game (freespacelancer,fsrts,capship control interface to name a few). another usage would be in modding utils could be written in lua and run right in the game engine's lab.

a settings interface would be very useful, but it would need to be done in c. basically allowing you to read and write whatever setting variables the default interface lets users change. a gui need not be used with a setting interface, it would be very easy to write a console type interface which takes typed commands, not sure why anyone would use it over a gui though.
« Last Edit: March 17, 2010, 07:40:55 pm by Nuke »
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN