Package ruscz.game.gameOfProd.Windows
Class WindowOfFreeMove
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JLayeredPane
-
- ruscz.game.gameOfProd.Windows.WindowOfFreeMove
-
- All Implemented Interfaces:
java.awt.image.ImageObserver,java.awt.MenuContainer,java.io.Serializable,javax.accessibility.Accessible
public class WindowOfFreeMove extends javax.swing.JLayeredPaneThis class holds JLayeredPane with the main part of our game - the maps It also holds references to all major classes- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classWindowOfFreeMove.CanvasThis class handles repainting of all game elements and entitiesclassWindowOfFreeMove.ForegroundThis class handles displaying images or color on top of the whole game It is used in cut-scenes or for atmosphere-
Nested classes/interfaces inherited from class javax.swing.JLayeredPane
javax.swing.JLayeredPane.AccessibleJLayeredPane
-
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
-
-
Field Summary
Fields Modifier and Type Field Description private Cameracameraprivate static booleancanPersonMoveprivate WindowOfFreeMove.Canvascanvasstatic intCANVAS_HEIGHTstatic intCANVAS_WIDTHstatic intCELL_SIZEprivate DialogBardialogBarprivate WindowOfFreeMove.Foregroundforegroundprivate Gamegameprivate static java.lang.StringCHAPTERprivate javax.swing.TimerinputTimerprivate static booleanisReadyToPaintstatic intKEY_DOWNprivate static intKEY_ESCAPEstatic intKEY_EVENTstatic intKEY_LEFTstatic intKEY_RIGHTstatic intKEY_UPprivate java.util.LinkedList<Map>mapLinkedListprivate MapManagermapManagerprivate MusicManagermusicManagerprivate static intnextMovestatic intREPAINT_DELAYstatic intWINDOW_HEIGHTstatic intWINDOW_WIDTH-
Fields inherited from class javax.swing.JLayeredPane
DEFAULT_LAYER, DRAG_LAYER, FRAME_CONTENT_LAYER, LAYER_PROPERTY, MODAL_LAYER, PALETTE_LAYER, POPUP_LAYER
-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Constructor Summary
Constructors Constructor Description WindowOfFreeMove(Game game)
-
Method Summary
Modifier and Type Method Description static booleancanPersonMove()voidcenterContent()Centers game window on screenCameragetCamera()DialogBargetDialogBar()WindowOfFreeMove.ForegroundgetForegroundPanel()GamegetGame()static java.lang.StringgetCHAPTER()java.util.LinkedList<Map>getMapLinkedList()MapManagergetMapManager()MusicManagergetMusicManager()voidloadNextChapter()Loads next chapter of gamevoidpaintMapOnWindow()voidrepaintCanvas()Forces all panels to repaintstatic voidsetCanPersonMove(boolean canPersonMove)static voidsetCanvasSize(int[] size)static voidsetCHAPTER(java.lang.String CHAPTER)voidsetMapManager(Map mapManager)static voidsetNextMove(int nextMove)static voidsleep(long tm)Pauses thread for a designated length of timevoidstart(boolean newGame)Starts the game itself - loads all needed maps, starts a new game or loads saved game and starts timer for repaintingvoidstartBattle(java.lang.String name)Starts new battle sequence-
Methods inherited from class javax.swing.JLayeredPane
addImpl, getAccessibleContext, getComponentCountInLayer, getComponentsInLayer, getComponentToLayer, getIndexOf, getLayer, getLayer, getLayeredPaneAbove, getObjectForLayer, getPosition, highestLayer, insertIndexForLayer, isOptimizedDrawingEnabled, lowestLayer, moveToBack, moveToFront, paint, paramString, putLayer, remove, removeAll, setLayer, setLayer, setPosition
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintComponent, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printComponent, printChildren, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, checkImage, checkImage, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
CELL_SIZE
public static final int CELL_SIZE
- See Also:
- Constant Field Values
-
CANVAS_WIDTH
public static int CANVAS_WIDTH
-
CANVAS_HEIGHT
public static int CANVAS_HEIGHT
-
WINDOW_WIDTH
public static final int WINDOW_WIDTH
- See Also:
- Constant Field Values
-
WINDOW_HEIGHT
public static final int WINDOW_HEIGHT
- See Also:
- Constant Field Values
-
REPAINT_DELAY
public static final int REPAINT_DELAY
- See Also:
- Constant Field Values
-
canPersonMove
private static boolean canPersonMove
-
nextMove
private static int nextMove
-
isReadyToPaint
private static boolean isReadyToPaint
-
KEY_LEFT
public static final int KEY_LEFT
- See Also:
- Constant Field Values
-
KEY_UP
public static final int KEY_UP
- See Also:
- Constant Field Values
-
KEY_RIGHT
public static final int KEY_RIGHT
- See Also:
- Constant Field Values
-
KEY_DOWN
public static final int KEY_DOWN
- See Also:
- Constant Field Values
-
KEY_EVENT
public static final int KEY_EVENT
- See Also:
- Constant Field Values
-
KEY_ESCAPE
private static final int KEY_ESCAPE
- See Also:
- Constant Field Values
-
CHAPTER
private static java.lang.String CHAPTER
-
game
private final Game game
-
canvas
private final WindowOfFreeMove.Canvas canvas
-
dialogBar
private final DialogBar dialogBar
-
mapManager
private MapManager mapManager
-
camera
private final Camera camera
-
inputTimer
private final javax.swing.Timer inputTimer
-
musicManager
private MusicManager musicManager
-
foreground
private final WindowOfFreeMove.Foreground foreground
-
mapLinkedList
private java.util.LinkedList<Map> mapLinkedList
-
-
Constructor Detail
-
WindowOfFreeMove
public WindowOfFreeMove(Game game)
-
-
Method Detail
-
getCHAPTER
public static java.lang.String getCHAPTER()
-
setCHAPTER
public static void setCHAPTER(java.lang.String CHAPTER)
-
getMapManager
public MapManager getMapManager()
-
repaintCanvas
public void repaintCanvas()
Forces all panels to repaint
-
setCanPersonMove
public static void setCanPersonMove(boolean canPersonMove)
-
canPersonMove
public static boolean canPersonMove()
-
setMapManager
public void setMapManager(Map mapManager)
-
paintMapOnWindow
public void paintMapOnWindow()
-
setNextMove
public static void setNextMove(int nextMove)
-
getDialogBar
public DialogBar getDialogBar()
-
getMapLinkedList
public java.util.LinkedList<Map> getMapLinkedList()
-
getCamera
public Camera getCamera()
-
getForegroundPanel
public WindowOfFreeMove.Foreground getForegroundPanel()
-
getMusicManager
public MusicManager getMusicManager()
-
getGame
public Game getGame()
-
start
public void start(boolean newGame)
Starts the game itself - loads all needed maps, starts a new game or loads saved game and starts timer for repainting- Parameters:
newGame- is a reference to main class Game
-
loadNextChapter
public void loadNextChapter()
Loads next chapter of game
-
startBattle
public void startBattle(java.lang.String name)
Starts new battle sequence- Parameters:
name- is name of battle file
-
sleep
public static void sleep(long tm)
Pauses thread for a designated length of time- Parameters:
tm- is time in milliseconds
-
setCanvasSize
public static void setCanvasSize(int[] size)
-
centerContent
public void centerContent()
Centers game window on screen
-
-