|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.minueto.window.MinuetoFrame
public class MinuetoFrame
The MinuetoPanel class allows you to create a window (not fullscreen).
This window is your main drawing surface (your canvas). This class is a subclass of
MinuetoWindow. As such, all the drawing functionnality is found in the
super class.
When a MinuetoWindow is created, it is invisible. The setVisible
method must be used toshow the window (make it visible).
The size of the MinuetoWindow must be given to the construtor.
Once a MinuetoWindow is created, it cannot be resized. To display
a MinuetoWindow of different size, the current window must be closed using the
close method and a new MinuetoWindow must be created.
Minueto draws to the screen using a double-buffering strategy. In other words,
there are two drawing surfaces : your window itself and an off screen surface.
All your drawing occurs on the off screen surface. The content of the off
screen buffer is drawn to the screen when the render method is invoked.
MinuetoWindow,
MinuetoBaseWindow,
MinuetoImage| Constructor Summary | |
|---|---|
MinuetoFrame(int width,
int height,
boolean border)
Creates a MinuetoWindow of the specified size. |
|
| Method Summary | |
|---|---|
void |
clear()
Clears the contents of the Drawing Surface. |
void |
clear(MinuetoColor color)
Erases the contents from the Drawing Surface. |
void |
close()
Close the window and free any ressource still in use by the window. |
void |
draw(MinuetoImage image,
int x,
int y)
Draw another MinuetoImage on this MinuetoDrawingSurface (thus compositing them). |
void |
drawLine(MinuetoColor color,
int xStart,
int yStart,
int xStop,
int yStop)
Draw a line of the specified color from the start point to the end point. |
void |
exitOnClose(boolean value)
By default, when a MinuetoWindow is closed by the operating system (click on the X in the top right corner for example), the whole application is closed. |
double |
getFrameRate()
Returns the number of frame renders per second. |
int |
getHeight()
Return the height of the image. |
int |
getPositionX()
Returns the top-left X screen location of the MinuetoWindow drawing surface |
int |
getPositionY()
Returns the top-left Y screen location of the MinuetoWindow drawing surface |
int |
getWidth()
Return the width of the image. |
int |
getWindowHeight()
Returns the height of the current window. |
int |
getWindowPositionX()
Returns the current X position of this window on the desktop. |
int |
getWindowPositionY()
Returns the current Y position of this window. |
int |
getWindowWidth()
Returns the width of the current window. |
boolean |
isClosed()
Returns if the MinuetoWindow is was closed. |
boolean |
isVisible()
Returns if the MinuetoWindow is visible or not. |
void |
registerFocusHandler(MinuetoFocusHandler handler,
MinuetoEventQueue queue)
Assign a focus handler to the MinuetoWindow to process
focus events. |
void |
registerKeyboardHandler(MinuetoKeyboardHandler handler,
MinuetoEventQueue queue)
Assign a keyboard handler to the MinuetoWindow to process
keyboard input. |
void |
registerMouseHandler(MinuetoMouseHandler handler,
MinuetoEventQueue queue)
Assign a mouse handler to the MinuetoWindow to process
mouse input. |
void |
registerMouseWheelHandler(MinuetoMouseWheelHandler handler,
MinuetoEventQueue queue)
Assign a mousewheel handler to the MinuetoWindow to process
mouse wheel input. |
void |
registerWindowHandler(MinuetoWindowHandler handler,
MinuetoEventQueue queue)
Assign a window handler to the MinuetoWindow to process
window input. |
void |
render()
Draws the content of the backbuffer onto the window. |
void |
save(java.lang.String filename)
Saves the content of the MinuetoWindow to a PNG file. |
void |
setCursorVisible(boolean visible)
Shows or hides the mouse cursor. |
void |
setMaxFrameRate(double value)
Caps the number of frames which can be rendered (display) per second. |
void |
setPixel(int x,
int y,
MinuetoColor color)
Change the color of pxel at location X,y. |
void |
setTitle(java.lang.String title)
Change the title of the window. |
void |
setVisible(boolean value)
Shows or hides the MinuetoWindow. |
void |
setWindowPosition(int x,
int y)
Moves the window to the desired location. |
void |
unregisterFocusHandler(MinuetoFocusHandler handler,
MinuetoEventQueue queue)
Removes a focus handler from the MinuetoWindow. |
void |
unregisterKeyboardHandler(MinuetoKeyboardHandler handler,
MinuetoEventQueue queue)
Removes a keyboard handler from the MinuetoWindow. |
void |
unregisterMouseHandler(MinuetoMouseHandler handler,
MinuetoEventQueue queue)
Removes a mouse handler from the MinuetoWindow. |
void |
unregisterMouseWheelHandler(MinuetoMouseWheelHandler handler,
MinuetoEventQueue queue)
Removes a mouse wheel handler from the MinuetoWindow. |
void |
unregisterWindowHandler(MinuetoWindowHandler handler,
MinuetoEventQueue queue)
Removes a window handler from the MinuetoWindow. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.minueto.window.MinuetoWindow |
|---|
getFrameRate, isVisible, registerFocusHandler, registerKeyboardHandler, registerMouseHandler, registerMouseWheelHandler, registerWindowHandler, render, setMaxFrameRate, unregisterFocusHandler, unregisterKeyboardHandler, unregisterMouseHandler, unregisterMouseWheelHandler, unregisterWindowHandler |
| Methods inherited from interface org.minueto.image.MinuetoDrawingSurface |
|---|
clear, clear, draw, drawLine, getHeight, getWidth, save, setPixel |
| Constructor Detail |
|---|
public MinuetoFrame(int width,
int height,
boolean border)
MinuetoWindow of the specified size. The second parameter
determines if the window should be bordeless or not.
width - int denoting the desired width of the window.height - int denoting the desired height of the window.border - boolean indicating if the window should be have borders or not.
MinuetoZeroNegativeException - if the window size is invalid.| Method Detail |
|---|
public void setVisible(boolean value)
MinuetoWindow
setVisible in interface MinuetoWindowvalue - boolean denoting if the window should be visible or not.public void close()
MinuetoWindowMinuetoWindowInvalidStateException.
close in interface MinuetoWindowpublic void setTitle(java.lang.String title)
MinuetoWindow
setTitle in interface MinuetoWindowtitle - String identifying the desired title of the screen.public int getWindowWidth()
int denoting the real width of the window.
MinuetoWindowInvalidStateException - if this window is hidden (invisible) or has been closed.public int getWindowHeight()
int denoting the real height of the window.
MinuetoWindowInvalidStateException - if this window is hidden (invisible) or has been closed.public int getWindowPositionX()
public int getWindowPositionY()
public void setWindowPosition(int x,
int y)
x - int denoting the X position where the window should be moved.y - int denoting the Y position where the window should be moved.
MinuetoWindowInvalidStateException - if this window is hidden (invisible) or has been closed.public void exitOnClose(boolean value)
value - boolean denoting if the whole application should be closed.public void setCursorVisible(boolean visible)
MinuetoWindow
setCursorVisible in interface MinuetoWindowvisible - boolean denoting if the window should be visible or not.public int getPositionX()
MinuetoWindow
getPositionX in interface MinuetoWindowint denoting the x position of the drawing surfacepublic int getPositionY()
MinuetoWindow
getPositionY in interface MinuetoWindowint denoting the y position of the drawing surfacepublic boolean isClosed()
MinuetoWindow
isClosed in interface MinuetoWindowboolean if Window was closed or not
public void draw(MinuetoImage image,
int x,
int y)
MinuetoDrawingSurfaceMinuetoImage on this MinuetoDrawingSurface (thus compositing them).
draw in interface MinuetoDrawingSurfaceimage - MinuetoImage that we will draw on our image.x - int denoting where we should start drawing on the x axis.y - int denothing where we should start drawing on the y axis.
public void drawLine(MinuetoColor color,
int xStart,
int yStart,
int xStop,
int yStop)
MinuetoDrawingSurface
drawLine in interface MinuetoDrawingSurfacecolor - MinuetoColor denoting the color of the line.xStart - int denoting the X value of the start point.yStart - int denoting the Y value of the start point.xStop - int denoting the X value of the end point.yStop - int denoting the Y value of the end point.public void render()
MinuetoWindow
render in interface MinuetoWindowpublic int getWidth()
MinuetoDrawingSurface
getWidth in interface MinuetoDrawingSurfaceint denoting the width of the image.public int getHeight()
MinuetoDrawingSurface
getHeight in interface MinuetoDrawingSurfaceint denoting the height of the image.public void clear()
MinuetoDrawingSurface
clear in interface MinuetoDrawingSurfacepublic void clear(MinuetoColor color)
MinuetoDrawingSurface
clear in interface MinuetoDrawingSurfacecolor - MinuetoColor of the cleared buffer.public double getFrameRate()
MinuetoWindow
getFrameRate in interface MinuetoWindowint denoting the number of frames drawn per second.public void setMaxFrameRate(double value)
MinuetoWindow
setMaxFrameRate in interface MinuetoWindowvalue - double denoting the desired number of frames to
be displayed per second.
public void registerKeyboardHandler(MinuetoKeyboardHandler handler,
MinuetoEventQueue queue)
MinuetoWindowMinuetoWindow to process
keyboard input. An unlimited number of keyboard handlers can be registered
with a window, but too many handlers may slow the application (because
of the large number of events produced).
registerKeyboardHandler in interface MinuetoWindowhandler - MinuetoKeyboardHandler to register with the
MinuetoEventQueue.queue - MinuetoEventQueue that will store events..
public void registerMouseHandler(MinuetoMouseHandler handler,
MinuetoEventQueue queue)
MinuetoWindowMinuetoWindow to process
mouse input. An unlimited number of mouse handlers can be registered
with a window, but too many handlers may slow the application (because
of the large number of events produced).
registerMouseHandler in interface MinuetoWindowhandler - MinuetoMouseHandler to register with the
MinuetoWindow.queue - MinuetoEventQueue that will store events.
public void registerWindowHandler(MinuetoWindowHandler handler,
MinuetoEventQueue queue)
MinuetoWindowMinuetoWindow to process
window input. An unlimited number of window handlers can be registered
with a window, but too many handlers may slow the application (because
of the large number of events produced).
registerWindowHandler in interface MinuetoWindowhandler - MinuetoWindowHandler to register with the
MinuetoWindow.queue - MinuetoEventQueue that will store events.
public void registerFocusHandler(MinuetoFocusHandler handler,
MinuetoEventQueue queue)
MinuetoWindowMinuetoWindow to process
focus events. An unlimited number of window handlers can be registered
with a window, but too many handlers may slow the application (because
of the large number of events produced).
registerFocusHandler in interface MinuetoWindowhandler - MinuetoFocusHandler to register with the
MinuetoWindow.queue - MinuetoEventQueue that will store events.
public void registerMouseWheelHandler(MinuetoMouseWheelHandler handler,
MinuetoEventQueue queue)
MinuetoWindowMinuetoWindow to process
mouse wheel input. An unlimited number of mouse wheel handlers can be registered
with a window, but too many handlers may slow the application (because
of the large number of events produced).
registerMouseWheelHandler in interface MinuetoWindowhandler - MinuetoMouseWheelHandler to register with the
MinuetoWindow.queue - MinuetoEventQueue that will store events.
public void unregisterKeyboardHandler(MinuetoKeyboardHandler handler,
MinuetoEventQueue queue)
MinuetoWindowMinuetoWindow. Note that
both the correct handler and queue must be given to unregister the handler.
unregisterKeyboardHandler in interface MinuetoWindowhandler - MinuetoKeyboardHandler to unregister with the
MinuetoWindow.queue - MinuetoEventQueue that stored the events.
public void unregisterMouseHandler(MinuetoMouseHandler handler,
MinuetoEventQueue queue)
MinuetoWindowMinuetoWindow. Note that
both the correct handler and queue must be given to unregister the handler.
unregisterMouseHandler in interface MinuetoWindowhandler - MinuetoMouseHandler to unregister with the
MinuetoWindow.queue - MinuetoEventQueue that stored the events.
public void unregisterWindowHandler(MinuetoWindowHandler handler,
MinuetoEventQueue queue)
MinuetoWindowMinuetoWindow. Note that
both the correct handler and queue must be given to unregister the handler.
unregisterWindowHandler in interface MinuetoWindowhandler - MinuetoWindowHandler to unregister with the
MinuetoWindow.queue - MinuetoEventQueue that stored the events.
public void unregisterFocusHandler(MinuetoFocusHandler handler,
MinuetoEventQueue queue)
MinuetoWindowMinuetoWindow. Note that
both the correct handler and queue must be given to unregister the handler.
unregisterFocusHandler in interface MinuetoWindowhandler - MinuetoFocusHandler to unregister with the
MinuetoWindow.queue - MinuetoEventQueue that stored the events.
public void unregisterMouseWheelHandler(MinuetoMouseWheelHandler handler,
MinuetoEventQueue queue)
MinuetoWindowMinuetoWindow. Note that
both the correct handler and queue must be given to unregister the handler.
unregisterMouseWheelHandler in interface MinuetoWindowhandler - MinuetoMouseWheelHandler to unregister with the
MinuetoWindow.queue - MinuetoEventQueue that stored the events.public boolean isVisible()
MinuetoWindow
isVisible in interface MinuetoWindowboolean if Window is visible or not
public void save(java.lang.String filename)
throws MinuetoFileException
MinuetoWindow to a PNG file. This
operation is very slow since the content of the screen must be retrieved
from the video(card) memory.
save in interface MinuetoDrawingSurfacefilename - String indicating the name of the target PNG
file.
MinuetoFileException - if it cannot write the file.
MinuetoWindowInvalidStateException - if this window is
hidden (invisible) or has been closed.
MinuetoFileExceptionMinuetoDrawingSurface.save(java.lang.String)
public void setPixel(int x,
int y,
MinuetoColor color)
MinuetoDrawingSurfaceThis uses the drawLine function to be faster than a direct raw data setPxel, though it should be used with caution as it is still slower than drawing a completed image to the drawing surface.
setPixel in interface MinuetoDrawingSurfacex - int denoting which pxel on the X axis should be colored.y - int denoting which pxel on the y axis should be colored.color - MinuetoColor denoting the new color for pxel x,y.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||