Difference between revisions of "New menu editing"

From Platinum Arts Sandbox Free 3D Game Maker
Jump to: navigation, search
(BorderedImage)
(Conditional)
Line 157: Line 157:
 
* '''Arguments:''' Condition Children
 
* '''Arguments:''' Condition Children
 
* '''Forks:''' 2
 
* '''Forks:''' 2
** fork1: false?
+
** fork1: True
** fork2: true?
+
** fork2: False
 
* '''Siblings:''' None
 
* '''Siblings:''' None
 
* '''Children:''' None
 
* '''Children:''' None
 
* '''Provided By:''' uicond
 
* '''Provided By:''' uicond
  
???
+
If you only want it to display stuff while false, use "uifill 0 0" as the true child. If you do not wish to have anything display in the false case, you can use uifill 0 0 or not provide a child.
  
 
==ConditionalButton==
 
==ConditionalButton==

Revision as of 17:52, 17 June 2010

the new UI is not provided by default, to access it, you will need to compile sandbox with -DNEWGUI

Windows Users
using codeblocks follow these steps after opening the project

  • click on project
  • click on build options
  • click on defines
  • type -DNEWGUI in the box that appears

Linux Users
users using codeblocks should follow the above steps, people using the Makefile follow these

  • open the desired makefile in a text editor
  • add -DNEWGUI into the CXXFLAGS string
  • make clean && make install

OSX

???

How it works

It should be noted that even we are still trying to figure out how it works.

Forks

Each fork represents a state, or even a combined state. Each one of these corresponds to a child. Any additional children are always interacted with and rendered.
For example, if you have an element with 2 forks, depending on its state, it'll either use the first child or the second child. If any additional children are provided, they will always be present.
In this below example we declare a uibutton element with 4 children. uibutton has 3 forks, so it'll choose from the first 3 children depending on its state. "data/hud/2.1/icons/action.jpg" will be drawn when idle, "data/hud/2.2/icons/action.jpg" will be drawn when hovered over and "data/hud/2.3/icons/action.jpg" will be drawn if it's selected. "data/hud/blackfog/icons/action.jpg" will always be drawn.

 uibutton [echo "Hello World"] [
   uiimage "data/hud/2.1/icons/action.jpg" .05 .05
   uiimage "data/hud/2.2/icons/action.jpg" .05 .05
   uiimage "data/hud/2.3/icons/action.png" .05 .05
   uiimage "data/hud/blackfog/icons/action.png" .02 .02
 ]

Siblings

When looking for a sibling item, the element in question first looks at its parent, and then it's parent (etc). Siblings elements are declared alongside the element, or as its parent. In this example, uiscroll and uiscrollbar are declared as siblings and uiscrollbutton is declared as a child of uiscrollbar.

 uiscroll .94 1 [
   ...
 ]
 uiscrollbar .06 1 [
   ....
   uiscrollbutton [
     ...
   ]
 ]

Children

When searching for a specific child element, the element searches its children and then its children. Simply, child elements are defined as part of its children. In the above example, uiscrollbutton is declared as a child of uiscrollbar.

States

  • Idle - when your cursor is not hovering over the element, nor is it selected
  • Hovering - when your cursor hovers over the element without clicking it
  • Selected - when you click the element, you do not necessarily have to be hovering over it

Creating

When making menus or other miscellaneous UIs through this, you should place the showui command within an alias named showMYMENU, where MYMENU is substituted for the name of the menu. For example...

 showMYMENU = [
   showui MYMENU [
     ...
   ]
 ]


Commands

hideui

  • Arguments: Name

Hides the UI which matches the name

replaceui

  • Arguments: Name Tag Children

within the named UI, it finds the tag which matches the provided name replaces its children

showui

  • Arguments: Name Children On-Hide

Creates a UI named Name which contains the provided children. The On-Hide script (if provided) is executed when the UI is closed

uialign

  • Arguments: X Y

both arguments can be one of -1, 0 or 1. -1 refers to the top left and 1 to the bottom right. For example, uialign 1 0 will align things to the right.

uialtimage

  • Arguments: Image

Replaces the image of the prior element with this one, should it fail to load. It only works if the prior item uses an Image!

uiclamp

  • Arguments: Left Right Bottom Top

It essentially snaps the element to the edges to which you gave a one.

Elements

NOTE: these names of the classes do not necessarily correspond to the names of the commands to call them. if you want information of a specific command, please use ctrl-F to find it

BorderedImage

  • Arguments: Image TexBorder ScreenSize Children
  • Forks: 0
  • Siblings: None
  • Children: None
  • Provided By: uiborderedimage

This turns the provided image into a border, or a frame. ScreenSize determines the border size and TexBorder determines a texture offset from which to create the borders. If the the literal provided to TexBorder contains a lowercase p somewhere after the number, it will be interpretted as pixels. Also note that without any children, only the corners will be rendered.
A handy tip for creating the children is to use uispace to offset them away from the border: ie uispace ScreenSize ScreenSize [children here]

Button

  • arguments: Action Children
  • forks: 3
    • fork1: default
    • fork2: hovering
    • fork3: selected
  • siblings: None
  • children: None
  • provided by: uibutton

Clipper

  • Arguments: X-Size y-Size Children
  • Forks: 0
  • Siblings: None
  • Children: None
  • Provided By: uiclip
  • See Also: Scroller

This is like Scroller, except you cannot scroll

CroppedImage

  • Arguments: Image X-Size Y-Size X-Start Y-Start X-End Y-End
  • Forks: 0
  • Siblings: None
  • Children: None
  • Provided By: uicroppedimage

For the *-Start and *-End arguments, if there's a p present somewhere after the number, it'll be interpreted as an amount of pixels instead of a percentage. You can enter whatever you want before or after the p, it will be interpreted as pixels as long a lower case p is present.

Conditional

  • Arguments: Condition Children
  • Forks: 2
    • fork1: True
    • fork2: False
  • Siblings: None
  • Children: None
  • Provided By: uicond

If you only want it to display stuff while false, use "uifill 0 0" as the true child. If you do not wish to have anything display in the false case, you can use uifill 0 0 or not provide a child.

ConditionalButton

  • Arguments: Condition On-Select Children
  • Forks: 4
    • fork1: false idle
    • fork2: true idle
    • fork3: true hover
    • fork4: true select
  • Siblings: None
  • Children: None
  • Provided By: uicondbutton

???

Filler

  • Arguments: X-Size Y-Size Children
  • Forks: 0
  • Siblings: None
  • Children: None
  • Provided By: uifill

Use this if you want to create a UI without a backdrop

Image

  • arguments: Image W-Size H-Size Children
  • forks: 0
  • siblings: None
  • children: None
  • provided by: uiimage
  • See Also: StretchedImage CroppedImage BorderImage SlotViewer

List

  • arguments: Space Children
  • forks: 0
  • siblings: None
  • children: None
  • provided by: uihlist uivlist

Space is the amount of padding between the contained elements.

Offsetter

  • Arguments: W-Offset H-Offset Children
  • Forks: 0
  • Siblings: None
  • Children: None
  • Provided By: uioffset

it essentially moves the elements this much

Rectangle

  • Arguments1: R G B A W-Size H-Size Children (uicolor)
  • Arguments2: R G B W-Size H-Size Children (uimodcolor)
  • Forks: 0
  • Siblings: None
  • Children: None
  • Provided By: uicolor uimodcolor

The difference between the two is that the first draws a solid rectangle, and the second draws one which modulates the colour of the UI.

ScrollBar

  • arguments: Image W-Size H-Size Children
  • forks: 5
    • fork1: default
    • fork2: hovering over up/left arrow
    • fork3: selected up/left arrow
    • fork4: hovering over down/right arrow
    • fork5: selected down/right arrow
  • siblings: Scroller
  • children: ScrollButton
  • provided by: uihscrollbar uivscrollbar

ScrollButton

  • arguments: Children
  • forks: 3
    • fork1: default
    • fork2: hovering
    • fork3: selected
  • siblings: None
  • children: None
  • provided by: uiscrollbutton

Scroller

  • Arguments: W-Size H-Size Children
  • Forks: 0
  • Siblings: None
  • Children: None
  • Provided By: uiscroll

SlotViewer

  • Arguments: Slot W-Size H-Size Children
  • Forks: 0
  • Siblings: None
  • Children: None
  • Provided By: uiviewslot

Spacer

  • Arguments: X-padding Y-Padding Children
  • Forks: 0
  • Siblings: None
  • Children: None
  • Provided By: uispace

uispace places the padding around its children, so the space consumed is essentially twice as much as you tell it to. This is useful for getting the elements away from the edges.

StretchedImage

  • Arguments: Image W-Size H-Size Children
  • Forks: 0
  • Siblings: None
  • Children: None
  • Provided By: uistretchedimage

Table

  • Arguments: Columns Padding Children
  • Forks: 0
  • Siblings: None
  • Children: None
  • Provided By: uitable

Should you exhaust all the columns, the table will start afresh on a new row. We recommend using this to generate items for Scroller.

Tag

  • arguments: Name Children
  • forks: 0
  • siblings: None
  • children: None
  • provided by: uitag

replaceui can be used to replace the contents of a tag

Text

  • Arguments1: Text Size Children (uitext)
  • Arguments2: Text Size R G B Children (uicolortext)
  • Forks: 0
  • Siblings: None
  • Children: None
  • Provided By: uitext uicolortext

TextEditor

  • Arguments: Name Length Height Scale InitialValue Keep Filter Children
  • Forks: 0
  • Siblings: None
  • Children: None
  • Provided By: uitexteditor

Name refers to a unique name for the editor. Any editor with a matching name edits the same items.
Length and Width state how many characters wide and how many characters high the field is.
If Keep is true, focus is not lost should the mouse move away from the field.
Filter is a collection of characters. Any characters within this list can't be used. for example "aeiou" will prevent the use of vowels.

Toggle

  • Arguments: Condition On-Select Split Children
  • Forks: 4
    • fork1: false idle
    • fork2: false hovering
    • fork3: true idle
    • fork4: true hovering
  • Siblings: None
  • Children: None
  • Provided By: uitoggle

???