de.lessvoid.nifty.render
Class NiftyRenderEngineImpl

java.lang.Object
  extended by de.lessvoid.nifty.render.NiftyRenderEngineImpl
All Implemented Interfaces:
NiftyRenderEngine

public class NiftyRenderEngineImpl
extends Object
implements NiftyRenderEngine

The Nifty RenderEngine.

Author:
void

Nested Class Summary
 class NiftyRenderEngineImpl.Clip
           
 
Constructor Summary
NiftyRenderEngineImpl(RenderDevice renderDeviceParam)
          create the device.
 
Method Summary
 void beginFrame()
          Called when a frame begins.
 void clear()
          Clear the screen.
 RenderFont createFont(String filename)
          Create a new RenderFont.
 NiftyImage createImage(String filename, boolean filterLinear)
          Create a new Image.
 void disableClip()
          Disable the clipping.
 void displayResolutionChanged()
          This is called from Nifty when it receives the resolutionChange notify from application code.
 void disposeImage(RenderImage image)
          Dispose image.
 void enableClip(int x0, int y0, int x1, int y1)
          Enable clipping to the given region.
 void endFrame()
          Called when a frame ends.
 RenderFont getFont()
          get font.
 String getFontname(RenderFont font)
          Returns the original filename of the given RenderFont.
 int getHeight()
          Get Height of Display mode.
 RenderDevice getRenderDevice()
          Get RenderDevice.
 int getWidth()
          Get Width of Display mode.
 boolean isColorAlphaChanged()
          return true when color alpha has been changed.
 boolean isColorChanged()
          return true when color has been changed.
 void moveTo(float xParam, float yParam)
          Move to the given x/y position.
 RenderImage reload(RenderImage image)
          Dispose the given image and reload it.
 void renderImage(NiftyImage image, int x, int y, int width, int height)
          renderImage.
 void renderQuad(int x, int y, int width, int height)
          render a quad.
 void renderQuad(int x, int y, int width, int height, Color topLeft, Color topRight, Color bottomRight, Color bottomLeft)
          Renders a quad with different colors at the quad vertices.
protected  void renderSelectionText(String text, int x, int y, Color textColor, Color textSelectionColor, float textSize, int selectionStartParam, int selectionEndParam)
          Render a Text with some text selected.
 void renderText(String text, int x, int y, int selectionStart, int selectionEnd, Color textSelectionColor)
          renderText.
 void restoreState()
          restore states.
 void saveState(RenderStates statesToSave)
          save given states.
 void setBlendMode(BlendMode blendModeParam)
          Set BlendMode.
 void setColor(Color colorParam)
          Set a new color.
 void setColorAlpha(float newColorAlpha)
          set only the color alpha.
 void setColorIgnoreAlpha(Color newColor)
          Set only the color component of the given color.
 void setFont(RenderFont newFont)
          set font.
 void setGlobalPosition(float xPos, float yPos)
          set global position.
 void setImageScale(float scale)
          set image size.
 void setRenderTextSize(float size)
          Set RenderTextSize.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NiftyRenderEngineImpl

public NiftyRenderEngineImpl(RenderDevice renderDeviceParam)
create the device.

Parameters:
renderDeviceParam - RenderDevice
Method Detail

getWidth

public int getWidth()
Description copied from interface: NiftyRenderEngine
Get Width of Display mode.

Specified by:
getWidth in interface NiftyRenderEngine
Returns:
width
See Also:
NiftyRenderEngine.getWidth()

getHeight

public int getHeight()
Description copied from interface: NiftyRenderEngine
Get Height of Display mode.

Specified by:
getHeight in interface NiftyRenderEngine
Returns:
height
See Also:
NiftyRenderEngine.getHeight()

beginFrame

public void beginFrame()
Description copied from interface: NiftyRenderEngine
Called when a frame begins.

Specified by:
beginFrame in interface NiftyRenderEngine

endFrame

public void endFrame()
Description copied from interface: NiftyRenderEngine
Called when a frame ends.

Specified by:
endFrame in interface NiftyRenderEngine

clear

public void clear()
Description copied from interface: NiftyRenderEngine
Clear the screen.

Specified by:
clear in interface NiftyRenderEngine

createImage

public NiftyImage createImage(String filename,
                              boolean filterLinear)
Description copied from interface: NiftyRenderEngine
Create a new Image.

Specified by:
createImage in interface NiftyRenderEngine
Parameters:
filename - name
filterLinear - filter
Returns:
NiftyImage
See Also:
NiftyRenderEngine.createImage(java.lang.String, boolean)

createFont

public RenderFont createFont(String filename)
Description copied from interface: NiftyRenderEngine
Create a new RenderFont.

Specified by:
createFont in interface NiftyRenderEngine
Parameters:
filename - name
Returns:
RenderFont
See Also:
NiftyRenderEngine.createFont(java.lang.String)

getFontname

public String getFontname(RenderFont font)
Description copied from interface: NiftyRenderEngine
Returns the original filename of the given RenderFont.

Specified by:
getFontname in interface NiftyRenderEngine
Parameters:
font - RenderFont to get the name from
Returns:
the filename of the font

renderQuad

public void renderQuad(int x,
                       int y,
                       int width,
                       int height)
Description copied from interface: NiftyRenderEngine
render a quad.

Specified by:
renderQuad in interface NiftyRenderEngine
Parameters:
x - x
y - y
width - width
height - height
See Also:
NiftyRenderEngine.renderQuad(int, int, int, int)

renderQuad

public void renderQuad(int x,
                       int y,
                       int width,
                       int height,
                       Color topLeft,
                       Color topRight,
                       Color bottomRight,
                       Color bottomLeft)
Description copied from interface: NiftyRenderEngine
Renders a quad with different colors at the quad vertices.

Specified by:
renderQuad in interface NiftyRenderEngine

renderImage

public void renderImage(NiftyImage image,
                        int x,
                        int y,
                        int width,
                        int height)
renderImage.

Specified by:
renderImage in interface NiftyRenderEngine
Parameters:
image - image
x - x
y - y
width - width
height - height

renderText

public void renderText(String text,
                       int x,
                       int y,
                       int selectionStart,
                       int selectionEnd,
                       Color textSelectionColor)
renderText.

Specified by:
renderText in interface NiftyRenderEngine
Parameters:
text - text
x - x
y - y
selectionStart - selection start
selectionEnd - selection end
textSelectionColor - textSelectionColor

renderSelectionText

protected void renderSelectionText(String text,
                                   int x,
                                   int y,
                                   Color textColor,
                                   Color textSelectionColor,
                                   float textSize,
                                   int selectionStartParam,
                                   int selectionEndParam)
Render a Text with some text selected.

Parameters:
text - text
x - x
y - y
textColor - color
textSelectionColor - textSelectionColor
textSize - text size
selectionStartParam - selection start
selectionEndParam - selection end

setFont

public void setFont(RenderFont newFont)
set font.

Specified by:
setFont in interface NiftyRenderEngine
Parameters:
newFont - font

getFont

public RenderFont getFont()
get font.

Specified by:
getFont in interface NiftyRenderEngine
Returns:
font

setColor

public void setColor(Color colorParam)
Description copied from interface: NiftyRenderEngine
Set a new color.

Specified by:
setColor in interface NiftyRenderEngine
Parameters:
colorParam - color
See Also:
NiftyRenderEngine.setColor(de.lessvoid.nifty.tools.Color)

setColorAlpha

public void setColorAlpha(float newColorAlpha)
set only the color alpha.

Specified by:
setColorAlpha in interface NiftyRenderEngine
Parameters:
newColorAlpha - new alpha value

setColorIgnoreAlpha

public void setColorIgnoreAlpha(Color newColor)
Set only the color component of the given color. This assumes that alpha has already been changed.

Specified by:
setColorIgnoreAlpha in interface NiftyRenderEngine
Parameters:
newColor - color

isColorChanged

public boolean isColorChanged()
return true when color has been changed.

Specified by:
isColorChanged in interface NiftyRenderEngine
Returns:
color changed

isColorAlphaChanged

public boolean isColorAlphaChanged()
Description copied from interface: NiftyRenderEngine
return true when color alpha has been changed.

Specified by:
isColorAlphaChanged in interface NiftyRenderEngine
Returns:
color changed
See Also:
NiftyRenderEngine.isColorAlphaChanged()

moveTo

public void moveTo(float xParam,
                   float yParam)
Description copied from interface: NiftyRenderEngine
Move to the given x/y position.

Specified by:
moveTo in interface NiftyRenderEngine
Parameters:
xParam - x
yParam - y
See Also:
NiftyRenderEngine.moveTo(float, float)

enableClip

public void enableClip(int x0,
                       int y0,
                       int x1,
                       int y1)
Description copied from interface: NiftyRenderEngine
Enable clipping to the given region.

Specified by:
enableClip in interface NiftyRenderEngine
Parameters:
x0 - x0
y0 - y0
x1 - x1
y1 - y1
See Also:
NiftyRenderEngine.enableClip(int, int, int, int)

disableClip

public void disableClip()
Description copied from interface: NiftyRenderEngine
Disable the clipping.

Specified by:
disableClip in interface NiftyRenderEngine
See Also:
NiftyRenderEngine.disableClip()

setRenderTextSize

public void setRenderTextSize(float size)
Description copied from interface: NiftyRenderEngine
Set RenderTextSize.

Specified by:
setRenderTextSize in interface NiftyRenderEngine
Parameters:
size - size
See Also:
NiftyRenderEngine.setRenderTextSize(float)

setImageScale

public void setImageScale(float scale)
Description copied from interface: NiftyRenderEngine
set image size.

Specified by:
setImageScale in interface NiftyRenderEngine
Parameters:
scale - scale
See Also:
NiftyRenderEngine.setImageScale(float)

setGlobalPosition

public void setGlobalPosition(float xPos,
                              float yPos)
Description copied from interface: NiftyRenderEngine
set global position.

Specified by:
setGlobalPosition in interface NiftyRenderEngine
Parameters:
xPos - x
yPos - y
See Also:
NiftyRenderEngine.setGlobalPosition(float, float)

displayResolutionChanged

public void displayResolutionChanged()
Description copied from interface: NiftyRenderEngine
This is called from Nifty when it receives the resolutionChange notify from application code. The RenderEngine will update the cached values of width/height from the RenderDevice it has stored inside.

Specified by:
displayResolutionChanged in interface NiftyRenderEngine

saveState

public void saveState(RenderStates statesToSave)
Description copied from interface: NiftyRenderEngine
save given states.

Specified by:
saveState in interface NiftyRenderEngine
Parameters:
statesToSave - set of renderstates to save

restoreState

public void restoreState()
Description copied from interface: NiftyRenderEngine
restore states.

Specified by:
restoreState in interface NiftyRenderEngine

setBlendMode

public void setBlendMode(BlendMode blendModeParam)
Description copied from interface: NiftyRenderEngine
Set BlendMode.

Specified by:
setBlendMode in interface NiftyRenderEngine

getRenderDevice

public RenderDevice getRenderDevice()
Description copied from interface: NiftyRenderEngine
Get RenderDevice.

Specified by:
getRenderDevice in interface NiftyRenderEngine
Returns:

disposeImage

public void disposeImage(RenderImage image)
Description copied from interface: NiftyRenderEngine
Dispose image.

Specified by:
disposeImage in interface NiftyRenderEngine
Parameters:
image - image to dispose

reload

public RenderImage reload(RenderImage image)
Description copied from interface: NiftyRenderEngine
Dispose the given image and reload it.

Specified by:
reload in interface NiftyRenderEngine
Parameters:
image - image
Returns:
the reloaded image


Copyright © 2011. All Rights Reserved.