ch.aplu.nxt
Class NxtContext

java.lang.Object
  extended by ch.aplu.nxt.NxtContext

public class NxtContext
extends java.lang.Object

Dummy class to make NxtJLib source compatible with NxtSim. All methods are empty.


Field Summary
static Obstacle box
          Box obstacle.
static Obstacle channel
          Channel obstacle.
 
Method Summary
static void setLocation(int x, int y)
          Sets the location of the playground (pixel coordinates of the upper left vertex).
static void setStartDirection(double direction)
          Sets the Nxt starting direction (zero to EAST).
static void setStartPosition(int x, int y)
          Sets the Nxt starting position (x-y-coordinates 0..500, origin at upper left).
static void showNavigationBar()
          Shows the navigation bar of the GameGrid and runs the simulation immediately.
static void showNavigationBar(boolean doRun)
          Shows the navigation bar of the GameGrid.
static void useBackground(java.lang.String filename)
          Use the give image as background (playground size 501 x 501).
static void useObstacle(Obstacle obstacle)
          Uses the given obstacle at the center of the playground.
static void useObstacle(java.lang.String filename, int x, int y)
          Defines the give images as an obstacle.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

box

public static Obstacle box
Box obstacle.


channel

public static Obstacle channel
Channel obstacle.

Method Detail

useBackground

public static void useBackground(java.lang.String filename)
Use the give image as background (playground size 501 x 501).

Parameters:
filename - the image file to use as background.

setStartPosition

public static void setStartPosition(int x,
                                    int y)
Sets the Nxt starting position (x-y-coordinates 0..500, origin at upper left).

Parameters:
x - the x-coordinate of the starting position
y - the y-coordinate of the starting position

setStartDirection

public static void setStartDirection(double direction)
Sets the Nxt starting direction (zero to EAST).

Parameters:
direction - the starting direction in degrees)

setLocation

public static void setLocation(int x,
                               int y)
Sets the location of the playground (pixel coordinates of the upper left vertex).

Parameters:
x - the x-pixel-coordinate of the upper left vertex (positive to the right)
y - the y-pixel-coordinate of the upper left vertex (positive to the bottom)

useObstacle

public static void useObstacle(java.lang.String filename,
                               int x,
                               int y)
Defines the give images as an obstacle. It will be shown at the given position. More than one obstacle may be defined.

Parameters:
filename - the image file of the obstacle
x - the x-coordinate of the image center
y - the y-coordinate of the image center

useObstacle

public static void useObstacle(Obstacle obstacle)
Uses the given obstacle at the center of the playground. Mainly used for predefined obstacles.

Parameters:
obstacle - the obstacle to use.

showNavigationBar

public static void showNavigationBar(boolean doRun)
Shows the navigation bar of the GameGrid.

Parameters:
doRun - if true, runs the simulation immediatetly; otherwise the start button must be hit to run the simulation

showNavigationBar

public static void showNavigationBar()
Shows the navigation bar of the GameGrid and runs the simulation immediately.