android.gameengine.icadroids.forms
Class GameForm

java.lang.Object
  extended by android.gameengine.icadroids.forms.GameForm

public class GameForm
extends java.lang.Object

With GameForm you can create (and delete) views on top of the current view. Always create a GameForm inside a triggerAlarm! Else the GameForm will not be shown! When you show a view, the GameView will still be running! You must pause this view by yourself. The layout of the views are made in a android XML layout file. You can use the UI builder from android to make one. Layouts are saved in the /res/layout folder. To receive touch inputs, you must implement the IFormInput interface.

Author:
Bas van der Zandt

Constructor Summary
GameForm(GameEngine gameEngine)
          Make a GameForm without adding a new layout.
GameForm(java.lang.String layoutName, IFormInput IformInput, GameEngine gameEngine)
          Make a GameForm and show immediately the given Layout
 
Method Summary
 View findViewElementByName(java.lang.String idName)
          Get the view of a elementname
 java.lang.String getElementName(View viewElement)
          Get the ID name of an view element, like a button or textbox.
 java.lang.String getTextFromTextfield(java.lang.String textfieldName)
          Get text from a textfield.
 void removeView(java.lang.String layoutName)
          Remove the specified view from the screen.
 void sendToast(java.lang.String text, int duration)
          Toast are little grey boxes with text in it that appear a few seconds on the screen.
 void showView(java.lang.String layoutName, IFormInput IformInput)
          Add a new view (layout) on the top of the current view.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GameForm

public GameForm(java.lang.String layoutName,
                IFormInput IformInput,
                GameEngine gameEngine)
Make a GameForm and show immediately the given Layout

Parameters:
layoutName - The layout name given in the res/layout folder. Give the name without .XML extension! . So if your layout is called 'main.xml', this parameter should be "main" .
IformInput - The IFormInput object that will receive touch inputs of this layout
gameEngine - The GameEngine which this game is currently running on.

GameForm

public GameForm(GameEngine gameEngine)
Make a GameForm without adding a new layout.

Parameters:
gameEngine - The GameEngine which the game is currently running on
Method Detail

showView

public void showView(java.lang.String layoutName,
                     IFormInput IformInput)
Add a new view (layout) on the top of the current view.

Parameters:
layoutName - The layout name given in the res/layout folder. Give the name without .XML extension! . So if your layout is called 'main.xml', this parameter should be "main" .
IformInput - The IFormInput object that will receive touch inputs of this layout

getElementName

public java.lang.String getElementName(View viewElement)
Get the ID name of an view element, like a button or textbox.

Parameters:
viewElement -
Returns:
The name of the view element. This name is specified in android:id in your android layout xml.

sendToast

public void sendToast(java.lang.String text,
                      int duration)
Toast are little grey boxes with text in it that appear a few seconds on the screen. You can make a toast with this method.

Parameters:
text - The text that will be visible in the toast
duration - The duration of the toast in seconds

getTextFromTextfield

public java.lang.String getTextFromTextfield(java.lang.String textfieldName)
Get text from a textfield.

Parameters:
textfieldName - The android:id name of the textfield specified in your android layout xml file
Returns:
Text in textfield

removeView

public void removeView(java.lang.String layoutName)
Remove the specified view from the screen.

Parameters:
layoutName - The layout name given in the res/layout folder. Give the name without .XML extension! . So if your layout is called 'main.xml', this parameter should be "main" .

findViewElementByName

public View findViewElementByName(java.lang.String idName)
Get the view of a elementname

Parameters:
idName - the id name of the view
Returns:
The coresponding View