public abstract class Ucigame
extends javax.swing.JApplet
implements java.awt.event.MouseMotionListener, java.awt.event.MouseListener, java.awt.event.MouseWheelListener, java.awt.event.KeyListener, java.awt.event.FocusListener
javax.swing.JApplet.AccessibleJApplet
java.applet.Applet.AccessibleApplet
Modifier and Type | Field and Description |
---|---|
static int |
ADD |
static int |
ADDONCE |
static int |
BOLD |
static int |
BOLDITALIC |
static int |
BOTTOM |
static Sprite |
BOTTOMEDGE |
GameCanvas |
canvas |
static int |
FILL |
static int |
ITALIC |
Keyboard |
keyboard |
static int |
LEFT |
static Sprite |
LEFTEDGE |
Mouse |
mouse |
static int |
MULTIPLY |
static int |
ONCE |
static Sprite |
PIXELPERFECT |
static int |
PLAIN |
static int |
RIGHT |
static Sprite |
RIGHTEDGE |
static long |
serialVersionID |
static int |
SET |
static int |
TOP |
static Sprite |
TOPEDGE |
GameWindow |
window |
accessibleContext, rootPane, rootPaneCheckingEnabled
Constructor and Description |
---|
Ucigame() |
Modifier and Type | Method and Description |
---|---|
int |
actualFPS()
Returns the number of times the game window has been refreshed in the last second.
|
java.lang.String[] |
arrayOfAvailableFonts()
Returns an array of Strings; each element of the array is the
name of a font installed on the computer.
|
void |
destroy()
non-API
|
void |
draw()
Called by Ucigame every time the game window needs to be repainted.
|
void |
focusGained(java.awt.event.FocusEvent e)
non-API
|
void |
focusLost(java.awt.event.FocusEvent e)
non-API
|
void |
framerate(double framerate)
Sets the desired framerate to the specified value.
|
Image |
getImage(java.lang.String filename)
Returns an Image object created from the specified image file from disk.
|
Image |
getImage(java.lang.String filename,
int shade)
Returns an Image object created from the specified image file from disk;
pixels with the specified shade of gray will be transparent.
|
Image |
getImage(java.lang.String filename,
int r,
int g,
int b)
Returns an Image object created from the specified image file from disk;
pixels of the specified color will be transparent.
|
Sound |
getSound(java.lang.String _filename)
This method reads in the specified sound file from disk.
|
void |
init()
non-API
|
boolean |
isAvailableFont(java.lang.String fontName)
Returns true or false depending on whether the specified fontName is
installed on the computer.
|
void |
keyPressed(java.awt.event.KeyEvent e)
non-API
|
void |
keyReleased(java.awt.event.KeyEvent e)
non-API
|
void |
keyTyped(java.awt.event.KeyEvent e)
non-API
|
static void |
main(java.lang.String[] commandLineArgs)
non-API
|
Sprite |
makeButton(java.lang.String name,
Image image,
int width,
int height)
Returns a button Sprite with the specified name, based on the specified Image.
|
Sprite |
makeSprite(Image image)
Returns a Sprite object based on the specified Image object.
|
Sprite |
makeSprite(Image image,
int width,
int height)
Returns a Sprite object based on the specified Image object,
with the specified width and height.
|
Sprite |
makeSprite(int width,
int height)
Returns a Sprite with the specified width and height, but with no image(s).
|
Sprite |
makeTiledSprite(int cols,
int rows,
int tileWidth,
int tileHeight)
Returns a Sprite which is a matrix of tiles.
|
void |
mouseClicked(java.awt.event.MouseEvent e)
non-API
|
void |
mouseDragged(java.awt.event.MouseEvent e)
non-API
|
void |
mouseEntered(java.awt.event.MouseEvent e)
non-API
|
void |
mouseExited(java.awt.event.MouseEvent e)
non-API
|
void |
mouseMoved(java.awt.event.MouseEvent e)
non-API
|
void |
mousePressed(java.awt.event.MouseEvent e)
non-API
|
void |
mouseReleased(java.awt.event.MouseEvent e)
non-API
|
void |
mouseWheelMoved(java.awt.event.MouseWheelEvent e)
non-API
|
void |
onKeyPress()
Called by Ucigame when the player presses a key on the keyboard.
|
void |
onKeyRelease()
Called by Ucigame when the player releases a key on the keyboard.
|
void |
onMouseDragged()
Called by Ucigame when the player moves the mouse while holding down a mouse button.
|
void |
onMouseMoved()
Called by Ucigame when the player moves the mouse.
|
void |
onMousePressed()
Called by Ucigame when the player presses down a mouse button.
|
void |
onMouseReleased()
Called by Ucigame when the player releases a mouse button.
|
void |
onMouseWheelMoved()
Called by Ucigame when the mouse wheel is rotated.
|
void |
print(boolean x) |
void |
print(char x) |
void |
print(double x) |
void |
print(float x) |
void |
print(int x) |
void |
print(long x) |
void |
print(java.lang.Object x) |
void |
print(short x) |
void |
print(java.lang.String x)
Prints information on the console.
|
void |
println(boolean x) |
void |
println(char x) |
void |
println(double x) |
void |
println(float x) |
void |
println(int x) |
void |
println(long x) |
void |
println(java.lang.Object x) |
void |
println(short x) |
void |
println(java.lang.String x)
Prints information on the console, followed by a new line.
|
double |
random(double limit)
Returns a random double greater than or equal to 0
and less than limit.
|
double |
random(double lowerlimit,
double upperlimit)
Returns a random double greater than or equal to lowerlimit
and less than or equal to upperlimit.
|
int |
randomInt(int limit)
Returns a random int greater than or equal to 0 and less than limit.
|
int |
randomInt(int lowerlimit,
int upperlimit)
Returns a random int greater than or equal to lowerlimit
and less than upperlimit.
|
void |
randomSeed(int seed)
Specifies a seed for the random number generator.
|
void |
setIconImage(Image iconImage)
Sets the specified Image as the icon for the game window.
|
void |
setup()
Called by Ucigame once, at the start of the game.
|
void |
start()
non-API
|
void |
startScene(java.lang.String sceneName)
Defines a new scene for the game.
|
void |
startTimer(java.lang.String timerName,
double millisBetween)
Causes the method timerNameTimer() to be run milliBetween milliseconds later,
and every millisBetween milliseconds afterwards.
|
void |
stop()
non-API
|
void |
stopTimer(java.lang.String timerName)
Cancels subsequent executions of the timerNameTimer() method.
|
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isRootPaneCheckingEnabled, paramString, remove, repaint, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, isValidateRoot, newAudioClip, play, play, resize, resize, setStub, showStatus
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final long serialVersionID
public static final int FILL
public static final int SET
public static final int ADD
public static final int ADDONCE
public static final int MULTIPLY
public static final int TOP
public static final int BOTTOM
public static final int LEFT
public static final int RIGHT
public static final int ONCE
public static Sprite TOPEDGE
public static Sprite BOTTOMEDGE
public static Sprite LEFTEDGE
public static Sprite RIGHTEDGE
public static final Sprite PIXELPERFECT
public static final int BOLD
public static final int PLAIN
public static final int ITALIC
public static final int BOLDITALIC
public Mouse mouse
public GameWindow window
public GameCanvas canvas
public Keyboard keyboard
public static final void main(java.lang.String[] commandLineArgs)
public final void init()
init
in class java.applet.Applet
public final void start()
start
in class java.applet.Applet
public final void stop()
stop
in class java.applet.Applet
public final void destroy()
destroy
in class java.applet.Applet
public final void framerate(double framerate)
public final int actualFPS()
public final void randomSeed(int seed)
public final double random(double limit)
public final double random(double lowerlimit, double upperlimit)
public final int randomInt(int limit)
public final int randomInt(int lowerlimit, int upperlimit)
public final java.lang.String[] arrayOfAvailableFonts()
public final boolean isAvailableFont(java.lang.String fontName)
public final Image getImage(java.lang.String filename)
public final Image getImage(java.lang.String filename, int shade)
public final Image getImage(java.lang.String filename, int r, int g, int b)
public final Sound getSound(java.lang.String _filename)
public final Sprite makeSprite(Image image)
public final Sprite makeSprite(int width, int height)
public final Sprite makeSprite(Image image, int width, int height)
public final Sprite makeButton(java.lang.String name, Image image, int width, int height)
public final Sprite makeTiledSprite(int cols, int rows, int tileWidth, int tileHeight)
public final void startScene(java.lang.String sceneName)
public final void startTimer(java.lang.String timerName, double millisBetween)
public final void stopTimer(java.lang.String timerName)
public final void setIconImage(Image iconImage)
public final void print(java.lang.String x)
public final void print(int x)
public final void print(short x)
public final void print(char x)
public final void print(double x)
public final void print(float x)
public final void print(long x)
public final void print(boolean x)
public final void print(java.lang.Object x)
public final void println(java.lang.String x)
public final void println(int x)
public final void println(short x)
public final void println(char x)
public final void println(double x)
public final void println(float x)
public final void println(long x)
public final void println(boolean x)
public final void println(java.lang.Object x)
public void setup()
public void draw()
public void onKeyPress()
public void onKeyRelease()
public void onMousePressed()
public void onMouseMoved()
public void onMouseDragged()
public void onMouseReleased()
public void onMouseWheelMoved()
public final void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
public final void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
public final void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
public final void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
public final void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
mouseWheelMoved
in interface java.awt.event.MouseWheelListener
public final void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
public final void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
public final void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
public final void keyPressed(java.awt.event.KeyEvent e)
keyPressed
in interface java.awt.event.KeyListener
public final void keyReleased(java.awt.event.KeyEvent e)
keyReleased
in interface java.awt.event.KeyListener
public final void keyTyped(java.awt.event.KeyEvent e)
keyTyped
in interface java.awt.event.KeyListener
public final void focusGained(java.awt.event.FocusEvent e)
focusGained
in interface java.awt.event.FocusListener
public final void focusLost(java.awt.event.FocusEvent e)
focusLost
in interface java.awt.event.FocusListener