public class LegoContext
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static Obstacle |
box
Box obstacle.
|
static Obstacle |
channel
Channel obstacle.
|
Modifier and Type | Method and Description |
---|---|
static void |
init()
Initializes the static context.
|
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 EV3 starting direction (zero to EAST).
|
static void |
setStartPosition(int x,
int y)
Sets the EV3 starting position (x-y-coordinates 0..500, origin at upper left).
|
static void |
setStatusText(java.lang.String text)
Displays the given text in the status bar (if available).
|
static void |
showStatusBar(int height)
Shows a status bar with given height.
|
static void |
useBackground(java.lang.String filename)
Use the give image as background (playground size 501 x 501).
|
static void |
useObstacle(java.awt.image.BufferedImage bi,
int x,
int y)
Defines the given buffered image to be used as touch obstacle.
|
static void |
useObstacle(GGBitmap bm,
int x,
int y)
Defines the given GGBitmap to be used as touch obstacle.
|
static void |
useObstacle(Obstacle obstacle)
Defines the given obstacle to be used as touch obstacle.
|
static void |
useObstacle(Obstacle obstacle,
int x,
int y)
Defines the given obstacle to be used as touch obstacle.
|
static void |
useObstacle(java.lang.String filename,
int x,
int y)
Defines the given sprite image to be used as touch obstacle.
|
static Target |
useTarget(java.awt.image.BufferedImage bi,
java.awt.Point[] mesh,
int x,
int y)
Creates a target for the ultrasonic sensor using the given buffered image.
|
static Target |
useTarget(GGBitmap bm,
java.awt.Point[] mesh,
int x,
int y)
Creates a target for the ultrasonic sensor using the given GGBitmap.
|
static Target |
useTarget(java.lang.String filename,
int[][] mesh,
int x,
int y)
Creates a target for the ultrasonic sensor using the given sprite image.
|
static Target |
useTarget(java.lang.String filename,
java.awt.Point[] mesh,
int x,
int y)
Creates a target for the ultrasonic sensor using the given sprite image.
|
static Target |
useTarget(Target target,
int x,
int y)
Defines a clone of the given target to be used as target.
|
public static Obstacle box
public static Obstacle channel
public static void init()
public static void useBackground(java.lang.String filename)
filename
- the image file to use as background.public static void setStartPosition(int x, int y)
x
- the x-coordinate of the starting positiony
- the y-coordinate of the starting positionpublic static void setStartDirection(double direction)
direction
- the starting direction in degrees)public static void setLocation(int x, int y)
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)public static void useObstacle(java.lang.String filename, int x, int y)
filename
- the image file of the obstaclex
- the x-coordinate of the image centery
- the y-coordinate of the image centerpublic static void useObstacle(java.awt.image.BufferedImage bi, int x, int y)
bi
- the buffered image of the obstaclex
- the x-coordinate of the image centery
- the y-coordinate of the image centerpublic static void useObstacle(Obstacle obstacle, int x, int y)
obstacle
- the obstacle to usex
- the x-coordinate of the image centery
- the y-coordinate of the image centerpublic static void useObstacle(Obstacle obstacle)
obstacle
- the obstacle to usepublic static void useObstacle(GGBitmap bm, int x, int y)
bm
- the GGBitmap to be used as obstaclex
- the x-coordinate of the image centery
- the y-coordinate of the image centerpublic static Target useTarget(java.lang.String filename, int[][] mesh, int x, int y)
filename
- the image file of the targetmesh
- the integer array of mesh points (as x-y-coordinates array) (at least 2)x
- the x-coordinate of the image centery
- the y-coordinate of the image centerpublic static Target useTarget(java.lang.String filename, java.awt.Point[] mesh, int x, int y)
filename
- the image file of the targetmesh
- the mesh points (at least 2)x
- the x-coordinate of the image centery
- the y-coordinate of the image centerpublic static Target useTarget(java.awt.image.BufferedImage bi, java.awt.Point[] mesh, int x, int y)
bi
- the buffered image of the targetmesh
- the mesh points (at least 2)x
- the x-coordinate of the image centery
- the y-coordinate of the image centerpublic static Target useTarget(GGBitmap bm, java.awt.Point[] mesh, int x, int y)
bm
- the GGBitmap to be used as targetmesh
- the mesh points (at least 2)x
- the x-coordinate of the image centery
- the y-coordinate of the image centerpublic static Target useTarget(Target target, int x, int y)
target
- the target to define the clonex
- the x-coordinate of the image centery
- the y-coordinate of the image centerpublic static void showStatusBar(int height)
height
- the height of the status window in pixels.public static void setStatusText(java.lang.String text)
text
- the text to display.