This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

RcCookie
RcCookie presents ...

2020/8/8

Reusable UI - demo

This is a showcase of my UI elements for Greenfoot. Try them out below!


HOW TO REUSE:
The elements are all inside of my "ui" package. To access it, go to your downloads folder and open the folder "UI demo" that was downloaded with the gfar. It contains a folder "packages", which includes most of my custom stuff, including the ui and vectors, which are needed, too. To use it in a programm, there are two options:
Quick: Copy the folder into the folder of your scenario. It can be used now by writing "import packages.ui.*" at the very top. This has to be done for every of your scenarios.
Longtime-solution: Zip the packages folder. Then put it into "C:/programs/Greenfoot/lib/userlib/". The location may differ if from your install location. Now you can use this from any scenario!


Including:

Button - Can be pressed, can call a function or switch to a different world when pressed. Uses simple click animation. Can be coloured like most other elements, too.

Switch - A button that saves its state and displays it in a colour. Can call functions, too.

Slider - Select a value in the selected range by pulling the handle. Can be set to only allow integer values.

Drop-down menu - Click to select between a list of options, or go back to the default option. Can call methods depending on the selection and return the current selection (and if it's the default value).

Text - A simple text display that looks a bit better than the "showText"-function from World. Background and letter colour can be changed.

UIPlane - A plane to put the UI elements on. Uses fractions to save where elements on the plane are to scale them when being scaled. Can have a colour or can be transparent. Can also hold any other actors.

UIWorld - Similar to the UIPlane, it saves the location of objects as fractions. Allows to easily modify the worlds size without having to redo the UI positioning. It can save locations as pixel location as well. Extend from this to modify the world.


Important:
The online version does not display the animations correctly. They are nicer if you open this in real Greenfoot!

1898 views / 14 in the last 7 days

1 vote | 0 in the last 7 days

Tags: mouse game demo with-source

This scenario is a member of: Reusable actors & support classes


open in greenfoot
Your browser is ignoring the <APPLET> tag.
A new version of this scenario was uploaded on 2020-08-08 12:11:27 UTC
A new version of this scenario was uploaded on 2020-08-08 20:27:03 UTC Added Drop-down menu!
A new version of this scenario was uploaded on 2020-08-09 06:02:30 UTC Improved Animation
A new version of this scenario was uploaded on 2020-08-09 12:45:13 UTC - Added support to use a text object as a button input - Added fps-display that switches modes when clicked on - Added some documentation (not all, rest will come later)
A new version of this scenario was uploaded on 2020-08-09 13:19:44 UTC Drop-down menu now closes when clicked on somthing else

Want to leave a comment? You must first log in.

Who likes this?

Game/maniac