New menu editing

From Platinum Arts Sandbox Free 3D Game Maker
Revision as of 06:29, 17 June 2010 by Hirato (Talk | contribs) (Toggle)

Jump to: navigation, search

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

The forks basically represent how it can be interacted with. Generally there is an image when not selected and an additional two for each hovering and selected case. For each of these forks it is requires that a child image exists (an image is a class derived from Filler, such as those provided by uiimage and uicolor). For example, an element with 3 forks...

 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
 ]

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

Note that TexSize will interpret a given size as pixels if a p is provided. At the moment this seems broken, and we can't decide if it's meant to be the frame or turn its parent into a frame. At best, it only shows 25% of the provided image.

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: false?
    • fork2: true?
  • Siblings: None
  • Children: None
  • Provided By: uicond

???

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

???