Jump to content

new gui stuff =)

AnniXa

1,176 views

Today and yesterday i wrote alot of new gui stuff:

 

GuiFrameView, wich is adding just a rect that shows a frame from an timage object to the vertexbuffer of the containing window,

This can be a classic max2d like frame or my new IMP frame system.

same as a new TextButton, wich is adding 3 rechts, to the buffer, 2 for the both "end piceces" and a stretched one, also it adds a ttexthandle to the buffer.

Width can be auto assigned from the text, or manually setted (in this case the text will centrated in the button)

 

Also i added a (not so) simple text lists, that got a buildin support for the mouse stuff, detecting wich entry was hovered/klicked, the possiblity to set a function pointer that is called when a list entry is clicked, and some methods for getting the last clicked ID or Text.

Also included is autscroll down when new text entry appears, and a "max entrys" setting.

When a flag is set you cann scroll the menu when you with the mouse over with the mousewheel

 

Also the first visibile entry can be used to point them into pointer buttons, or then in future comming pointer scroller, wich can modify the var behind the pointer depending on how you scroll it.

 

And another nice extra are "Entity buttons", a button that can be atached to an entity, and fixes up its position to the entity, also there is a special extend of that that uses 2 extra pivots to "stretch" the button over the entity, wich can be handy maybe sometimes B)

 

This the first implement of the entity buttons is just using tann2d´s drawimagerect instead of adding the button to the buffer arrays of the windows, because the buttons will "delete" them self from the carrier window when the entity to wich them attached is Freed, and so i would neet to rebuild the whole window array anytime when a new entity button apears or is getting deleted.

 

Maybe i create a differend kind later that means to be more a "static entity button" wich is more for entitys that stay over the whole time, but im not sure if this is a good idea, sinc when i have like 100 entitys thate are not in view, there would still be room in the windowarray for them, and the quads/tris would be still drawn (because i dont use an arrayindex)

 

 

so At least here some screenshots =)

 

Some textbuttons, textfields, iconbuttons with differend modes in action.

blogentry-3456-0-62927200-1314980738_thumb.jpg

 

The new textlist in action

blogentry-3456-0-04622400-1314980749_thumb.jpg

 

Some "EntityButtons" in action

blogentry-3456-0-54829700-1314980843_thumb.jpg

 

 

Enjoy life!



5 Comments


Recommended Comments

Are the controls just 1 image file or how does that work?

 

How do we handle events?

 

What language is this library you have written in?

 

This looks like so just curious about how you did it.

Link to comment

Hi Rick

 

The whole gui uses just 1 image in my case, of course you can use more than one if its neccesary, every guicore can have its own "skin" and you can have as much gui cores as you want (in my project i have differend cores for the main menu, the edit mode, the simulation mode, so that i dont need to turn on/off a bunch of windows when i switch between those modes)

 

The buttons, window borders,and all the stuff that the gui needs (expect text) are on this image file (to reduce the needed bindtexture()) calls, also the most stuff is a builded Array for the openGL draw arrays thingy / VBO (so they need to be all on the same texture also for this reason).

 

so on the image there are areas of the image, that i call "frames" even when they are not frames in the classic sence like they was in original max2d timage type, since they can all have a individual size, and position, also overlapping is possible.

 

The language is bmx, its just a .bmx file to include, not really a library for now, maybe when i get more further into it and i think that its worth to share this with other ppl then i would make it as blitz-module or something.

 

The "events" are not really existing i think, you can do 2 things for now with buttons:

 

give them an int ptr that they are modifing, depending on the settings of the button, the variable behind the int ptr will be modified, there are differede modes:

 

1 - Increase/Decrease the int by given values, for example +5,-1 or something, also with max and min values that the int can have.

 

2 - "swapmode" , the int is switchting between 0 and 1 on each click (and also the button shows itselfs "pressed" when the int is 1"

 

3 - "setmode", the int is setted to a specified value when the button is clicked, (also the button shows itself "pressed" when this value is settted.

 

 

Also you can give the button function pointers, the functions will be called when the button was clicked, in combination with the int ptr stuff you can do alot things (i think i can do everything i need with this system):

 

Just increase/decrease a value, without need for any function

Modify a value und call a function that do something with it.

Modify objects fields by just give the fields as int ptr

Also its pretty nice to make more buttons that modify the same int variable, every button with "setmode", and then you can make easy category switch thingies with this (on button click -> set int to a value, and run a function that do stuff depending on the int)

Link to comment

Looks great to me AnniXa. The idea with a simple image based GUI is quite good. I did that in some demo some years ago. The whole GUI was not one image though. In my case each button was an own image, but essential it was done in the same style and it work very good.

 

Having a full fledged GUI with buttons, dragbars, checkboxes and good knows what can be overkill for most games, where its just a matter of give the user some simple information and the ability to select och click on some choices.

 

Keep up the good work :blink:

Link to comment

I think the idea of a single entitie and image to draw on can be a great performance improvement !

Like single surface particules ?

For all the GUI elements that are always on screen and don't change like no new buttons that apperas or disappear, this systel could be great.

Perhaps someoen could make some version for C#, C++ or Lua ?

Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...