|
GF4J 0.9.4 Beta | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--java.awt.Window | +--gameframe.engines.msjava4x.CFullscreenGraphicsEngine
Microsoft DirectDraw (from DirectX 3) implementation of the graphics engine. Uses Microsoft Java 3.x specific DirectX classes and Direct/J API.
Inner classes inherited from class java.awt.Window |
java.awt.Window.AccessibleAWTWindow |
Inner classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock |
Field Summary | |
private java.awt.Color |
m_backgroundColor
The color that is used when painting the backbuffer in the clear operation. |
private int |
m_backgroundFillValue
The actual pixel value that is used to fill the backbuffer with background color. |
private gameframe.engines.msjava4x.DirectDrawClipper |
m_ddclipper
The DirectDrawClipper for front and back surfaces. |
private gameframe.engines.msjava4x.DirectDrawPalette |
m_ddPalette
DirectDraw palette. |
private gameframe.engines.msjava4x.DirectDrawSurface |
m_ddsBack
DirectDraw backbuffer surface. |
private gameframe.engines.msjava4x.DirectDrawSurface |
m_ddsFontBitmap
DirectDraw surface that contains the letter for the current font. |
private gameframe.engines.msjava4x.DirectDrawSurface |
m_ddsPrimary
DirectDraw primary surface. |
private gameframe.engines.msjava4x.DirectDraw |
m_directDraw
DirectDraw object. |
private boolean |
m_fFocused
Flag that indicates if we have at the moment focus or not. |
private boolean |
m_fInfullscreenMode
Flag that indicates if we are at the moment in fullscreen mode or not. |
private int |
m_height
Height of this frame. |
private int |
m_letterHeight
Height of all the letters in the font bitmap. |
private int |
m_letterWidth
Width of all the letters in the font bitmap. |
private java.util.Vector |
m_loadedBitmaps
Every bitmap that has been loaded since last finalize method call. |
private int |
m_modeBpp
The bits per pixel value of the display. |
private int |
m_modeRefresh
The refresh rate of the display. |
private gameframe.engines.msjava4x.Rect |
m_screenRectangle
The rectangle object that holds the size of this screen. |
private java.lang.String |
m_strDataDirectory
Name of the directory that contains loaded bitmaps. |
private int |
m_width
Width of this frame. |
(package private) static gameframe.engines.msjava4x.Rect |
mStatic_dstRectangle
The rectangle that covers the destination are of the blit. |
private static java.awt.Frame |
mStatic_parentFrame
Frame that acts as a parent to the window. |
(package private) static gameframe.engines.msjava4x.Rect |
mStatic_srcRectangle
The rectangle that covers the DirectDraw surface this bitmap class represents. |
Fields inherited from class java.awt.Window |
active, base, dbg, focusMgr, inputContext, inputContextLock, nameCounter, OPENED, ownedWindowList, serialVersionUID, state, warningString, weakThis, windowListener, windowSerializedDataVersion |
Fields inherited from class java.awt.Container |
component, containerListener, containerSerializedDataVersion, dispatcher, layoutMgr, listeningBoundsChildren, listeningChildren, maxSize, ncomponents, printing, printingThreads |
Fields inherited from class java.awt.Component |
accessibleContext, actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, privateKey, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, width, windowClosingException, windowListenerK, visible, x, y |
Fields inherited from interface gameframe.graphics.GraphicsEngine |
ALL_COLOURDEPTHS, COLOURDEPTH_16BITS, COLOURDEPTH_24BITS, COLOURDEPTH_32BITS, DEFAULT_COLOURDEPTH, DEFAULT_TITLE, NO_PREFERRED_REFRESHRATE |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
private |
CFullscreenGraphicsEngine(java.awt.Frame parentFrame,
GameFrameSettings settings)
Private constructor for this singleton instance. |
private |
CFullscreenGraphicsEngine(java.awt.Frame parentFrame,
int width,
int height,
int bpp,
int refresh)
Private constructor for this singleton instance. |
Method Summary | |
void |
addBitmap(CBitmapBase bitmap)
Adds a bitmap to the group of created bitmaps (that is used when finalizing all objects). |
void |
clearBackbuffer()
Clears the backbuffer with the current backround color. |
void |
copyArea(int x,
int y,
int width,
int height,
int dx,
int dy)
Moves by copying a rectangular area of the backbuffer by a distance specified by dx and dy. |
private CDDAlphaBitmap |
createAlphaBitmap(int width,
int height)
Creates an alpha bitmap of the given size. |
(package private) gameframe.engines.msjava4x.DirectDrawSurface |
createSurface(int width,
int height)
First tries to create a plain DD surface that has the given size to the video memory. |
void |
drawTextAt(byte[] aByteText,
int x,
int y)
Prints the given string to the screen so that the uppermost and leftmost coordinate of the text is at the given location. |
void |
drawTextAt(java.lang.String strText,
int x,
int y)
Prints the given one line of text to the screen so that the uppermost and leftmost coordinate of the text is at the given location. |
(package private) boolean |
enumerate(CModeEnumerator enumerator)
Enumerates all available resolutions and all different refresh rates. |
void |
finalize()
Invoked when the program is exiting or user wants to get rid of this engine. |
void |
flip()
Switches the backbuffer and the currently displayed buffer. |
DrawableBitmap |
getAsBitmap(byte[] aByteText)
Returns the given one line of text as an bitmap that is painted using the current font. |
DrawableBitmap |
getAsBitmap(java.lang.String strText)
Returns the given one line of text as an bitmap that is painted using the current font. |
java.lang.String |
getDataDirectory()
Returns the data directory wherefrom the bitmaps are loaded. |
java.lang.String |
getDescription()
Returns the (possibly multiline) description of the implementation. |
DrawableBitmap |
getDrawableBitmap(int width,
int height)
Creates a non-transparent bitmap (the color is set to the current background color) that can be drawn into with other bitmaps. |
int |
getFontHeight()
Returns the current font height. |
int |
getFontWidth()
Returns the current font width. |
(package private) static CFullscreenGraphicsEngine |
getInstance(GameFrameSettings settings)
Returns an instance of this class. |
java.lang.String |
getName()
Returns the short name (max 8 characters) of the implementation "DDraw". |
java.awt.Dimension |
getSize()
Returns the size of the display area that this engine uses. |
(package private) java.util.Vector |
getSupportedModes()
Returns a vector filled with the supported modes. |
int |
getTextWidth(byte[] aByteText)
Returns the given one line of text's width when we are using the current font bitmap. |
int |
getTextWidth(java.lang.String strText)
Returns the given one line of text's width when we are using the current font bitmap. |
(package private) void |
init()
Initializes this graphics engine to fullscreen mode with doublebuffering. |
boolean |
isInFullscreenMode()
Returns true as this engine is allways in fullscreen mode. |
Bitmap |
loadAlphaBitmap(java.lang.String strFileName)
Load a bitmap (used bitmap format is Windows BMP, alpha keycolor is set to the pixel color at bitmap location 0,0 which is the pixel at upper left corner of the bitmap)from the given file and return an abstract reference for the loaded bitmap. |
Bitmap |
loadAlphaBitmap(java.lang.String strFileName,
byte red,
byte green,
byte blue)
Loads and returns a transparent bitmap (used bitmap format is Windows BMP 8-bit, 16-bit or 24-bit) from the given filename. |
(package private) Bitmap |
loadAlphaBitmapInternal(java.lang.String strFileName,
byte red,
byte green,
byte blue)
Load a bitmap (used bitmap format is Windows BMP, alpha keycolor is set to the pixel color at bitmap location 0,0 which is the pixel at upper left corner of the bitmap)from the given file and return an abstract reference for the loaded bitmap. |
Bitmap |
loadBitmap(java.lang.String strFileName)
Load a bitmap (used bitmap format is Windows BMP, no alpha values are loaded) from the given file and return an abstract reference for the loaded bitmap. |
(package private) Bitmap |
loadBitmapInternal(java.lang.String strFileName)
Load a bitmap (used bitmap format is Windows BMP, no alpha values are loaded) from the given file and return an abstract reference for the loaded bitmap. |
(package private) gameframe.engines.msjava4x.DirectDrawBitmap |
loadDDBitmap(java.lang.String strFileName)
Loads the given bitmap file as a surface. |
void |
loadDefaultFontBitmap()
Loads the default font bitmap that is used when printing text on the screen. |
void |
loadFontBitmap(java.lang.String strFileName)
Loads and sets the used font set to be loaded from the given strFileName using the specified fixed size for every letter. |
(package private) int |
mapToPixelFormat(java.awt.Color color,
gameframe.engines.msjava4x.DirectDrawSurface surface)
Maps the given color object to a pixel value that has the same pixel format as the given DirectDraw surface. |
void |
paint(java.awt.Graphics g)
Overrides the java.awt.Component's method to do nothing. |
private void |
paintSurfaceWithBackgroundColor(gameframe.engines.msjava4x.DirectDrawSurface surface)
Paints the given surface with the current background color. |
void |
removeBitmap(CBitmapBase bitmap)
Removes a bitmap from the group of created bitmaps (that is used when finalizing all objects). |
void |
setBackgroundColor(java.awt.Color color)
Sets the currently used background color (defaults to Color.black). |
void |
setBmpKeyColor(gameframe.engines.msjava4x.DirectDrawSurface ddSurface,
byte red,
byte green,
byte blue)
Sets the bitmap key color to the surface. |
void |
setDataDirectory(java.lang.String strDirectoryName)
Sets the data directory wherefrom the bitmaps are loaded. |
void |
setVisible(boolean fVisibility)
Overrides the java.awt.Window's setVisible() method to also set the visibility of the frame that is the parent of this window. |
void |
show()
Overrides the java.awt.Window's show() method to also show the frame that is the parent of this window. |
void |
update(java.awt.Graphics g)
Overrides the java.awt.Component's method to do nothing. |
Methods inherited from class java.awt.Window |
|
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, applyOrientation, checkGD, countComponents, createChildHierarchyEvents, createHierarchyEvents, deliverEvent, dispatchEventToSelf, doLayout, findComponentAt, findComponentAt, findComponentAt, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getMouseEventTarget, getPreferredSize, getWindow, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, numListening, paintComponents, paintHeavyweightComponents, paramString, postsOldMouseEvents, preferredSize, print, printComponents, printHeavyweightComponents, processContainerEvent, proxyEnableEvents, proxyRequestFocus, remove, remove, removeAll, removeContainerListener, removeNotify, setFont, setLayout, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkImage, checkImage, checkWindowClosingException, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isRecursivelyVisible, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, show, size, toString, transferFocus |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait |
Field Detail |
private static java.awt.Frame mStatic_parentFrame
static gameframe.engines.msjava4x.Rect mStatic_srcRectangle
static gameframe.engines.msjava4x.Rect mStatic_dstRectangle
private int m_modeBpp
private int m_modeRefresh
private gameframe.engines.msjava4x.DirectDraw m_directDraw
private gameframe.engines.msjava4x.DirectDrawSurface m_ddsPrimary
private gameframe.engines.msjava4x.DirectDrawSurface m_ddsBack
private gameframe.engines.msjava4x.DirectDrawPalette m_ddPalette
private gameframe.engines.msjava4x.DirectDrawClipper m_ddclipper
private boolean m_fInfullscreenMode
private boolean m_fFocused
private java.awt.Color m_backgroundColor
private int m_backgroundFillValue
private int m_width
private int m_height
private java.util.Vector m_loadedBitmaps
private gameframe.engines.msjava4x.Rect m_screenRectangle
private java.lang.String m_strDataDirectory
private gameframe.engines.msjava4x.DirectDrawSurface m_ddsFontBitmap
private int m_letterWidth
private int m_letterHeight
Constructor Detail |
private CFullscreenGraphicsEngine(java.awt.Frame parentFrame, GameFrameSettings settings)
parentFrame
- The parent frame of this windowsettings
- The settings used to create this graphics engine.private CFullscreenGraphicsEngine(java.awt.Frame parentFrame, int width, int height, int bpp, int refresh)
parentFrame
- The parent frame of this windowsettings
- The settings used to create this graphics engine.Method Detail |
static CFullscreenGraphicsEngine getInstance(GameFrameSettings settings) throws GameFrameException
settings
- The settings used to create this graphics engine.void init() throws GameFrameException
public Bitmap loadBitmap(java.lang.String strFileName) throws java.io.FileNotFoundException, GameFrameException
loadBitmap
in interface GraphicsEngine
strFileName
- The name of the file to be loaded (without the file extension).Bitmap loadBitmapInternal(java.lang.String strFileName) throws java.io.FileNotFoundException, GameFrameException
strFileName
- The exact name of the file to be loaded.public Bitmap loadAlphaBitmap(java.lang.String strFileName) throws java.io.FileNotFoundException, GameFrameException
loadAlphaBitmap
in interface GraphicsEngine
strFileName
- The name of the file to be loaded (without the file extension).public Bitmap loadAlphaBitmap(java.lang.String strFileName, byte red, byte green, byte blue) throws java.io.FileNotFoundException, GameFrameException
loadAlphaBitmap
in interface GraphicsEngine
strFileName
- The name of the file to be loaded (without the file extension).red
- The red intensity value of the key color (in range 0x00-0xFF).green
- The green intensity value of the key color (in range 0x00-0xFF).blue
- The blue intensity value of the key color (in range 0x00-0xFF).java.io.FileNotFoundException
- Thrown if the given file doesn't exist.GameFrameException
- Thrown if other error occur while loading the file.Bitmap loadAlphaBitmapInternal(java.lang.String strFileName, byte red, byte green, byte blue) throws java.io.FileNotFoundException, GameFrameException
strFileName
- The name of the file to be loaded (without the file extension).red
- The red intensity value of the key color (in range 0x00-0xFF).green
- The green intensity value of the key color (in range 0x00-0xFF).blue
- The blue intensity value of the key color (in range 0x00-0xFF).gameframe.engines.msjava4x.DirectDrawBitmap loadDDBitmap(java.lang.String strFileName) throws java.io.FileNotFoundException, GameFrameException
strFileName
- The filename of the bitmap.public DrawableBitmap getDrawableBitmap(int width, int height) throws GameFrameException
getDrawableBitmap
in interface GraphicsEngine
width
- The width of the bitmap.height
- The height of the bitmapprivate CDDAlphaBitmap createAlphaBitmap(int width, int height) throws GameFrameException
width
- The width of the alpha bitmap.height
- The height of the alpha bitmap.gameframe.engines.msjava4x.DirectDrawSurface createSurface(int width, int height) throws GameFrameException
width
- Width of the surface to be created.height
- Height of the surface to be created.public void addBitmap(CBitmapBase bitmap)
addBitmap
in interface IBitmapStorage
gameframe.engines.msjava4x.IBitmapStorage
bitmap
- The bitmap to be added to the storage.public void removeBitmap(CBitmapBase bitmap)
removeBitmap
in interface IBitmapStorage
gameframe.engines.msjava4x.IBitmapStorage
bitmap
- The bitmap to be removed from the storage.public void copyArea(int x, int y, int width, int height, int dx, int dy)
x
- The x-coordinate of the source rectangle.y
- The y-coordinate of the source rectangle.width
- The width of the source rectangle.height
- The height of the source rectangle.dx
- The horizontal distance to copy the pixels.dy
- The vertical distance to copy the pixels.public void flip()
flip
in interface GraphicsEngine
public void setDataDirectory(java.lang.String strDirectoryName) throws java.io.FileNotFoundException
setDataDirectory
in interface GraphicsEngine
strDirectoryName
- The name of the directory that contains the bitmaps.public java.lang.String getDataDirectory()
getDataDirectory
in interface GraphicsEngine
loadBitmap(java.lang.String)
,
loadAlphaBitmap(java.lang.String)
private void paintSurfaceWithBackgroundColor(gameframe.engines.msjava4x.DirectDrawSurface surface)
surface
- The surface to be painted with background color.public void clearBackbuffer()
clearBackbuffer
in interface GraphicsEngine
gameframe.graphics.GraphicsEngine
GraphicsEngine.setBackgroundColor(java.awt.Color)
public boolean isInFullscreenMode()
isInFullscreenMode
in interface GraphicsEngine
public void loadDefaultFontBitmap() throws java.io.FileNotFoundException, GameFrameException
loadDefaultFontBitmap
in interface GraphicsEngine
gameframe.graphics.GraphicsEngine
java.io.FileNotFoundException
- Thrown if the default font bitmap can't be found.GameFrameException
- Thrown if other errors occur while loading the default font bitmap.GraphicsEngine.loadFontBitmap(java.lang.String)
,
GraphicsEngine.getAsBitmap(java.lang.String)
,
GraphicsEngine.getAsBitmap(byte[])
,
GraphicsEngine.drawTextAt(java.lang.String, int, int)
,
GraphicsEngine.drawTextAt(byte[], int, int)
public void loadFontBitmap(java.lang.String strFileName) throws java.io.FileNotFoundException, GameFrameException
loadFontBitmap
in interface GraphicsEngine
strFileName
- Name of the bitmap file that contains the letters.public int getTextWidth(java.lang.String strText)
getTextWidth
in interface GraphicsEngine
strText
- The text that is written using the current font.loadDefaultFontBitmap()
,
loadFontBitmap(java.lang.String)
public int getTextWidth(byte[] aByteText)
getTextWidth
in interface GraphicsEngine
aByteText
- The byte array containing the text to be measured.loadDefaultFontBitmap()
,
loadFontBitmap(java.lang.String)
public int getFontWidth()
getFontWidth
in interface GraphicsEngine
loadDefaultFontBitmap()
,
loadFontBitmap(java.lang.String)
public int getFontHeight()
getFontHeight
in interface GraphicsEngine
loadDefaultFontBitmap()
,
loadFontBitmap(java.lang.String)
public DrawableBitmap getAsBitmap(java.lang.String strText) throws GameFrameException
getAsBitmap
in interface GraphicsEngine
strText
- The text that is written using the current font.public DrawableBitmap getAsBitmap(byte[] aByteText) throws GameFrameException
getAsBitmap
in interface GraphicsEngine
aByteText
- The byte array containing the text to be printed.public void drawTextAt(java.lang.String strText, int x, int y) throws GameFrameException
drawTextAt
in interface GraphicsEngine
strText
- The text that is written using the current font.x
- The leftmost x-coordinate for the text.y
- The topmost y-coordinate for the text.public void drawTextAt(byte[] aByteText, int x, int y) throws GameFrameException
drawTextAt
in interface GraphicsEngine
aByteText
- The byte array containing the text to be printed.x
- The leftmost x-coordinate for the text.y
- The topmost y-coordinate for the text.public void setBackgroundColor(java.awt.Color color)
setBackgroundColor
in interface GraphicsEngine
gameframe.graphics.GraphicsEngine
GraphicsEngine.clearBackbuffer()
public java.lang.String getName()
getName
in interface GraphicsEngine
getName
in class java.awt.Component
public java.lang.String getDescription()
getDescription
in interface GraphicsEngine
java.util.Vector getSupportedModes()
boolean enumerate(CModeEnumerator enumerator)
public void finalize()
finalize
in interface Finalizable
finalize
in class java.awt.Window
public void paint(java.awt.Graphics g)
paint
in class java.awt.Container
public void update(java.awt.Graphics g)
update
in class java.awt.Container
public java.awt.Dimension getSize()
getSize
in interface GraphicsEngine
getSize
in class java.awt.Component
public void setVisible(boolean fVisibility)
setVisible
in class java.awt.Component
fVisibility
- True if the window is to be visible, false if not.public void show()
show
in class java.awt.Window
public void setBmpKeyColor(gameframe.engines.msjava4x.DirectDrawSurface ddSurface, byte red, byte green, byte blue) throws GameFrameException
ddSurface
- The DirectDraw surface whose key color is to be set.red
- The red key color component.green
- The green key color component.blue
- The blue key color component.int mapToPixelFormat(java.awt.Color color, gameframe.engines.msjava4x.DirectDrawSurface surface) throws GameFrameException
color
- The color that is mapped.surface
- The DirectDraw surface whose pixel format is used.
|
GF4J 0.9.4 Beta | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |