本文整理汇总了Java中javax.microedition.lcdui.game.GameCanvas类的典型用法代码示例。如果您正苦于以下问题:Java GameCanvas类的具体用法?Java GameCanvas怎么用?Java GameCanvas使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GameCanvas类属于javax.microedition.lcdui.game包,在下文中一共展示了GameCanvas类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: GameCanvasLFImpl
import javax.microedition.lcdui.game.GameCanvas; //导入依赖的package包/类
/**
* Create new implementation instance for the given GameCanvas
* @param c GameCanvas instance to create the implementation for
*/
public GameCanvasLFImpl(GameCanvas c) {
owner = c;
graphicsAccess = GameMap.getGraphicsAccess();
/* IMPL_NOTE: The initial off-screen buffer has the same width
* and height as the entire screen. Further resizing will not
* cause memory reallocation until new geometry is bigger than
* the current one. Screen rotation is one of the cases the
* reallocation is needed.
*
* User can override the methods getWidth() and getHeight() of
* GameCanvas, so they should not be used for off-screen buffer
* initial allocation.
*/
offscreenBuffer = Image.createImage(
graphicsAccess.getScreenWidth(),
graphicsAccess.getScreenHeight());
}
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:24,代码来源:GameCanvasLFImpl.java
示例2: flushGraphics
import javax.microedition.lcdui.game.GameCanvas; //导入依赖的package包/类
public void flushGraphics(GameCanvas gameCanvas, int x, int y, int width, int height) {
AndroidCanvasUI ui = ((AndroidCanvasUI) DisplayUtils.getDisplayableUI(gameCanvas));
CanvasView canvasView = (CanvasView) ui.getView();
if (canvasView != null) {
canvasView.flushGraphics(x, y, width, height);
}
}
开发者ID:Helltar,项目名称:AMPASIDE,代码行数:8,代码来源:AndroidDeviceDisplay.java
示例3: getGameCanvasImpl
import javax.microedition.lcdui.game.GameCanvas; //导入依赖的package包/类
/**
* Gets the GameCanvasLFImpl object for this GameCanvas.
* @param c The GameCanvas to get the GameCanvasLFImpl for
* @return GameCanvasLFImpl, or null if there is no accessor to game package
*/
public static GameCanvasLFImpl getGameCanvasImpl(GameCanvas c) {
if (gameAccess != null) {
return gameAccess.getGameCanvasLFImpl(c);
}
return null;
}
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:12,代码来源:GameMap.java
示例4: lCallShow
import javax.microedition.lcdui.game.GameCanvas; //导入依赖的package包/类
/**
* Prepare to show this LF on physical screen. This is the
* internal version of showNotify() function as defined in MIDP spec.
* It is called immediately prior to this LF being made visible
* on the display. The LF should load any resource that is
* needed, layout. App's paint() should NOT be called in this function.
* Instead, it should be in the uCallPaint() that will be called on this
* LF shortly after.
*
* This function sets this DisplayableLF to SHOWN state.
*/
void lCallShow() {
// This will suppress drags, repeats and ups until a
// corresponding down is seen.
sawPointerPress = sawKeyPress = false;
if (state != SHOWN) {
// Create native resource first
// since the title and ticker may depend on it
createNativeResource();
}
// Start to paint the ticker
updateNativeTicker(null, owner.ticker);
// set mapping between GameCanvas and DisplayAccess
// set Game key event flag based on value passed in
// GameCanvas constructor.
if (owner instanceof GameCanvas) {
GameMap.registerDisplayAccess(owner, currentDisplay.accessor);
stickyKeyMask = currentKeyMask = 0;
} else {
// set the keymask to -1 when
// the displayable is not a GameCanvas.
stickyKeyMask = currentKeyMask = -1;
}
state = SHOWN;
}
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:41,代码来源:DisplayableLFImpl.java
示例5: releaseKeyMask
import javax.microedition.lcdui.game.GameCanvas; //导入依赖的package包/类
/**
* Called to release key mask of all the keys that were release.
*
* @param keyCode The key code to release the key mask.
*/
private void releaseKeyMask(int keyCode) {
/*
// Leave this case to dsHide and dsFreeze()
if (paintSuspended || !hasForeground) {
currentKeyMask = 0;
return;
}
*/
// set the mask of keys pressed
switch (KeyConverter.getGameAction(keyCode)) {
case Canvas.UP:
currentKeyMask = currentKeyMask & ~ GameCanvas.UP_PRESSED;
break;
case Canvas.DOWN:
currentKeyMask = currentKeyMask & ~ GameCanvas.DOWN_PRESSED;
break;
case Canvas.LEFT:
currentKeyMask = currentKeyMask & ~ GameCanvas.LEFT_PRESSED;
break;
case Canvas.RIGHT:
currentKeyMask = currentKeyMask & ~ GameCanvas.RIGHT_PRESSED;
break;
case Canvas.FIRE:
currentKeyMask = currentKeyMask & ~ GameCanvas.FIRE_PRESSED;
break;
case Canvas.GAME_A:
currentKeyMask = currentKeyMask & ~ GameCanvas.GAME_A_PRESSED;
break;
case Canvas.GAME_B:
currentKeyMask = currentKeyMask & ~ GameCanvas.GAME_B_PRESSED;
break;
case Canvas.GAME_C:
currentKeyMask = currentKeyMask & ~ GameCanvas.GAME_C_PRESSED;
break;
case Canvas.GAME_D:
currentKeyMask = currentKeyMask & ~ GameCanvas.GAME_D_PRESSED;
}
}
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:45,代码来源:DisplayableLFImpl.java
示例6: getGraphics
import javax.microedition.lcdui.game.GameCanvas; //导入依赖的package包/类
public Graphics getGraphics(GameCanvas gameCanvas)
{
return ((AndroidCanvasUI) DisplayUtils.getDisplayableUI(gameCanvas)).getGraphics();
}
开发者ID:Helltar,项目名称:AMPASIDE,代码行数:5,代码来源:AndroidDeviceDisplay.java
示例7: uCallSizeChanged
import javax.microedition.lcdui.game.GameCanvas; //导入依赖的package包/类
/**
* Package private equivalent of sizeChanged().
*
* @param w the new width
* @param h the new height
*
*/
public void uCallSizeChanged(int w, int h) {
boolean copyDefferedSizeChange;
synchronized (Display.LCDUILock) {
if (owner instanceof GameCanvas) {
GameCanvasLFImpl gameCanvasLF =
GameMap.getGameCanvasImpl((GameCanvas)owner);
if (gameCanvasLF != null) {
gameCanvasLF.lCallSizeChanged(w, h);
}
}
// If there is no Display, or if this Displayable is not
// currently visible, we simply record the fact that the
// size has changed
defferedSizeChange = (state != SHOWN);
copyDefferedSizeChange = defferedSizeChange;
/*
* sizeChangeOccurred is a boolean which (when true) indicates
* that sizeChanged() will be called at a later time. So, if it
* is false after calling super(), we go ahead and notify the
* Canvas now, rather than later
*/
width = w;
height = h;
if (!defferedSizeChange) {
lRequestInvalidate();
}
}
if (!copyDefferedSizeChange) {
synchronized (Display.calloutLock) {
try {
owner.sizeChanged(w, h);
} catch (Throwable t) {
Display.handleThrowable(t);
}
}
}
}
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:50,代码来源:DisplayableLFImpl.java
示例8: setKeyMask
import javax.microedition.lcdui.game.GameCanvas; //导入依赖的package包/类
/**
* Called to set key mask of all the keys that were pressed.
*
* @param keyCode The key code to set the key mask.
*/
private void setKeyMask(int keyCode) {
/*
// Shouldn't run into this case.
if (paintSuspended || !hasForeground) {
return;
}
*/
// set the mask of keys pressed
switch (KeyConverter.getGameAction(keyCode)) {
case Canvas.UP:
stickyKeyMask = stickyKeyMask | GameCanvas.UP_PRESSED;
currentKeyMask = currentKeyMask | GameCanvas.UP_PRESSED;
break;
case Canvas.DOWN:
stickyKeyMask = stickyKeyMask | GameCanvas.DOWN_PRESSED;
currentKeyMask = currentKeyMask | GameCanvas.DOWN_PRESSED;
break;
case Canvas.LEFT:
stickyKeyMask = stickyKeyMask | GameCanvas.LEFT_PRESSED;
currentKeyMask = currentKeyMask | GameCanvas.LEFT_PRESSED;
break;
case Canvas.RIGHT:
stickyKeyMask = stickyKeyMask | GameCanvas.RIGHT_PRESSED;
currentKeyMask = currentKeyMask | GameCanvas.RIGHT_PRESSED;
break;
case Canvas.FIRE:
stickyKeyMask = stickyKeyMask | GameCanvas.FIRE_PRESSED;
currentKeyMask = currentKeyMask | GameCanvas.FIRE_PRESSED;
break;
case Canvas.GAME_A:
stickyKeyMask = stickyKeyMask | GameCanvas.GAME_A_PRESSED;
currentKeyMask = currentKeyMask | GameCanvas.GAME_A_PRESSED;
break;
case Canvas.GAME_B:
stickyKeyMask = stickyKeyMask | GameCanvas.GAME_B_PRESSED;
currentKeyMask = currentKeyMask | GameCanvas.GAME_B_PRESSED;
break;
case Canvas.GAME_C:
stickyKeyMask = stickyKeyMask | GameCanvas.GAME_C_PRESSED;
currentKeyMask = currentKeyMask | GameCanvas.GAME_C_PRESSED;
break;
case Canvas.GAME_D:
stickyKeyMask = stickyKeyMask | GameCanvas.GAME_D_PRESSED;
currentKeyMask = currentKeyMask | GameCanvas.GAME_D_PRESSED;
}
}
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:53,代码来源:DisplayableLFImpl.java
示例9: getGameCanvasLFImpl
import javax.microedition.lcdui.game.GameCanvas; //导入依赖的package包/类
/**
* Get implementation of the given GameCanvas
*
* @param gameCanvas GameCanvas to get the internal implementation
* @return GameCanvasLFImpl instance of the given GameCanvas
*/
public GameCanvasLFImpl getGameCanvasLFImpl(GameCanvas gameCanvas);
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:8,代码来源:GameAccess.java
注:本文中的javax.microedition.lcdui.game.GameCanvas类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论