当前位置: 首页>>代码示例>>Java>>正文


Java AndroidCanvasUI类代码示例

本文整理汇总了Java中org.microemu.android.device.ui.AndroidCanvasUI的典型用法代码示例。如果您正苦于以下问题:Java AndroidCanvasUI类的具体用法?Java AndroidCanvasUI怎么用?Java AndroidCanvasUI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AndroidCanvasUI类属于org.microemu.android.device.ui包,在下文中一共展示了AndroidCanvasUI类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: flushGraphics

import org.microemu.android.device.ui.AndroidCanvasUI; //导入依赖的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

示例2: onKeyUp

import org.microemu.android.device.ui.AndroidCanvasUI; //导入依赖的package包/类
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
	if (keyCode == KeyEvent.KEYCODE_BACK && ignoreBackKeyUp) {
		ignoreBackKeyUp = false;
		return true;
	}
	
	MIDletAccess ma = MIDletBridge.getMIDletAccess();
	if (ma == null) {
		return false;
	}
	final DisplayAccess da = ma.getDisplayAccess();
	if (da == null) {
		return false;
	}
	AndroidDisplayableUI ui = (AndroidDisplayableUI) da.getDisplayableUI(da.getCurrent());
	if (ui == null) {
		return false;
	}		

	if (ui instanceof AndroidCanvasUI) {
		if (ignoreKey(keyCode)) {
            return false;    
        }

		Device device = DeviceFactory.getDevice();
		((AndroidInputMethod) device.getInputMethod()).buttonReleased(event);

		return true;
	}

	return super.onKeyUp(keyCode, event);
}
 
开发者ID:Helltar,项目名称:AMPASIDE,代码行数:34,代码来源:MicroEmulator.java

示例3: onKeyDown

import org.microemu.android.device.ui.AndroidCanvasUI; //导入依赖的package包/类
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    MIDletAccess ma = MIDletBridge.getMIDletAccess();
    if (ma == null) {
        return false;
    }
    final DisplayAccess da = ma.getDisplayAccess();
    if (da == null) {
        return false;
    }
    AndroidDisplayableUI ui = (AndroidDisplayableUI) da.getDisplayableUI(da.getCurrent());
    if (ui == null) {
        return false;
    }
    if (ui instanceof AndroidCanvasUI) {
        if (ignoreKey(keyCode)) {
            return false;
        }

        Device device = DeviceFactory.getDevice();
        ((AndroidInputMethod) device.getInputMethod()).buttonPressed(event);

        return true;
    }
    if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.ECLAIR
            && keyCode == KeyEvent.KEYCODE_BACK
            && event.getRepeatCount() == 0) {
        // Take care of calling this method on earlier versions of 
        // the platform where it doesn't exist. 
        onBackPressed();
        return true;
    }
    return super.onKeyDown(keyCode, event);
}
 
开发者ID:BombusMod,项目名称:BombusMod,代码行数:35,代码来源:BombusModActivity.java

示例4: onKeyUp

import org.microemu.android.device.ui.AndroidCanvasUI; //导入依赖的package包/类
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK && ignoreBackKeyUp) {
        ignoreBackKeyUp = false;
        return true;
    }
    MIDletAccess ma = MIDletBridge.getMIDletAccess();
    if (ma == null) {
        return false;
    }
    final DisplayAccess da = ma.getDisplayAccess();
    if (da == null) {
        return false;
    }
    AndroidDisplayableUI ui = (AndroidDisplayableUI) da.getDisplayableUI(da.getCurrent());
    if (ui == null) {
        return false;
    }

    if (ui instanceof AndroidCanvasUI) {
        if (ignoreKey(keyCode)) {
            return false;
        }

        Device device = DeviceFactory.getDevice();
        ((AndroidInputMethod) device.getInputMethod()).buttonReleased(event);

        return true;
    }

    return super.onKeyUp(keyCode, event);
}
 
开发者ID:BombusMod,项目名称:BombusMod,代码行数:33,代码来源:BombusModActivity.java

示例5: createCanvasUI

import org.microemu.android.device.ui.AndroidCanvasUI; //导入依赖的package包/类
public CanvasUI createCanvasUI(Canvas canvas) {
	return new AndroidCanvasUI(activity, canvas);
}
 
开发者ID:Helltar,项目名称:AMPASIDE,代码行数:4,代码来源:AndroidDevice.java

示例6: getGraphics

import org.microemu.android.device.ui.AndroidCanvasUI; //导入依赖的package包/类
public Graphics getGraphics(GameCanvas gameCanvas)
{
    return ((AndroidCanvasUI) DisplayUtils.getDisplayableUI(gameCanvas)).getGraphics();
}
 
开发者ID:Helltar,项目名称:AMPASIDE,代码行数:5,代码来源:AndroidDeviceDisplay.java

示例7: onKeyDown

import org.microemu.android.device.ui.AndroidCanvasUI; //导入依赖的package包/类
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
	MIDletAccess ma = MIDletBridge.getMIDletAccess();
	if (ma == null) {
		return false;
	}
	final DisplayAccess da = ma.getDisplayAccess();
	if (da == null) {
		return false;
	}
	AndroidDisplayableUI ui = (AndroidDisplayableUI) da.getDisplayableUI(da.getCurrent());
	if (ui == null) {
		return false;
	}		

	if (keyCode == KeyEvent.KEYCODE_BACK) {
		List<AndroidCommandUI> commands = ui.getCommandsUI();
		
		CommandUI cmd = getFirstCommandOfType(commands, Command.BACK);
		if (cmd != null) {
			if (ui.getCommandListener() != null) {
				ignoreBackKeyUp = true;
				MIDletBridge.getMIDletAccess().getDisplayAccess().commandAction(cmd.getCommand(), da.getCurrent());
			}
			return true;
		}

		cmd = getFirstCommandOfType(commands, Command.EXIT);
		if (cmd != null) {
			if (ui.getCommandListener() != null) {
				ignoreBackKeyUp = true;
				MIDletBridge.getMIDletAccess().getDisplayAccess().commandAction(cmd.getCommand(), da.getCurrent());
			}
			return true;
		}
		
		cmd = getFirstCommandOfType(commands, Command.CANCEL);
		if (cmd != null) {
			if (ui.getCommandListener() != null) {
				ignoreBackKeyUp = true;
				MIDletBridge.getMIDletAccess().getDisplayAccess().commandAction(cmd.getCommand(), da.getCurrent());
			}
			return true;
		}
	}
				
	if (ui instanceof AndroidCanvasUI) {
           if (ignoreKey(keyCode)) {
               return false;    
           }

		Device device = DeviceFactory.getDevice();
		((AndroidInputMethod) device.getInputMethod()).buttonPressed(event);

		return true;
	}

	return super.onKeyDown(keyCode, event);
}
 
开发者ID:Helltar,项目名称:AMPASIDE,代码行数:60,代码来源:MicroEmulator.java

示例8: onTrackballEvent

import org.microemu.android.device.ui.AndroidCanvasUI; //导入依赖的package包/类
@Override
public boolean onTrackballEvent(MotionEvent event) {
	if (event.getAction() == MotionEvent.ACTION_MOVE) {
		MIDletAccess ma = MIDletBridge.getMIDletAccess();
		if (ma == null) {
			return false;
		}
		final DisplayAccess da = ma.getDisplayAccess();
		if (da == null) {
			return false;
		}
		AndroidDisplayableUI ui = (AndroidDisplayableUI) da.getDisplayableUI(da.getCurrent());
		if (ui instanceof AndroidCanvasUI) {
			float x = event.getX();
			float y = event.getY();
			if ((x > 0 && accumulatedTrackballX < 0) || (x < 0 && accumulatedTrackballX > 0)) {
				accumulatedTrackballX = 0;
			}
			if ((y > 0 && accumulatedTrackballY < 0) || (y < 0 && accumulatedTrackballY > 0)) {
				accumulatedTrackballY = 0;
			}
			if (accumulatedTrackballX + x > TRACKBALL_THRESHOLD) {
				accumulatedTrackballX -= TRACKBALL_THRESHOLD;
				KEY_RIGHT_DOWN_EVENT.dispatch(this);
				KEY_RIGHT_UP_EVENT.dispatch(this);
			} else if (accumulatedTrackballX + x < -TRACKBALL_THRESHOLD) {
				accumulatedTrackballX += TRACKBALL_THRESHOLD;
				KEY_LEFT_DOWN_EVENT.dispatch(this);
				KEY_LEFT_UP_EVENT.dispatch(this);
			}
			if (accumulatedTrackballY + y > TRACKBALL_THRESHOLD) {
				accumulatedTrackballY -= TRACKBALL_THRESHOLD;
				KEY_DOWN_DOWN_EVENT.dispatch(this);
				KEY_DOWN_UP_EVENT.dispatch(this);
			} else if (accumulatedTrackballY + y < -TRACKBALL_THRESHOLD) {
				accumulatedTrackballY += TRACKBALL_THRESHOLD;
				KEY_UP_DOWN_EVENT.dispatch(this);
				KEY_UP_UP_EVENT.dispatch(this);
			}
			accumulatedTrackballX += x;
			accumulatedTrackballY += y;
			
			return true;
		}
	}
	
	return super.onTrackballEvent(event);
}
 
开发者ID:Helltar,项目名称:AMPASIDE,代码行数:49,代码来源:MicroEmulator.java

示例9: createAlertUI

import org.microemu.android.device.ui.AndroidCanvasUI; //导入依赖的package包/类
public DisplayableUI createAlertUI(Alert alert) {
	// TODO Not yet implemented
	return new AndroidCanvasUI(activity, null);
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:5,代码来源:AndroidDevice.java

示例10: createFormUI

import org.microemu.android.device.ui.AndroidCanvasUI; //导入依赖的package包/类
public DisplayableUI createFormUI(Form form) {
	// TODO Not yet implemented
	return new AndroidCanvasUI(activity, null);
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:5,代码来源:AndroidDevice.java

示例11: paintDisplayable

import org.microemu.android.device.ui.AndroidCanvasUI; //导入依赖的package包/类
public void paintDisplayable(int x, int y, int width, int height) {
	MIDletAccess ma = MIDletBridge.getMIDletAccess();
	if (ma == null) {
		return;
	}
	DisplayAccess da = ma.getDisplayAccess();
	if (da == null) {
		return;
	}
	DisplayableUI current = da.getCurrentUI();
	if (current == null) {
		return;
	}

	// TODO
	// g.save(android.graphics.Canvas.CLIP_SAVE_FLAG);
	// TODO
	// if (!(current instanceof Canvas) || ((Canvas) current).getWidth() != displayRectangle.width
	// 		|| ((Canvas) current).getHeight() != displayRectangle.height) {
	// 	g.translate(displayPaintable.x, displayPaintable.y);
	// }
	// TODO
	// Font oldf = g.getFont();
	if (current instanceof CanvasUI) {
		Device device = DeviceFactory.getDevice();
		
		// TODO take region size into account
		if (device != null) {
			synchronized (current) {
				Image displayImage = ((AndroidCanvasUI) current).getImage();
				synchronized (displayImage) {
					Graphics canvas = displayImage.getGraphics();

					canvas.clipRect(x, y, x + width, y + height);
					ma.getDisplayAccess().paint(canvas);
					// TODO
					// if (!deviceDisplay.isFullScreenMode()) {
					// 	deviceDisplay.paintControls(canvas);
					// }
				}
			}
		}
		View view = ((AndroidCanvasUI) current).getView(); 
		view.postInvalidate();
	} else {
		// TODO extend DisplayableUI interface
		//current.paint();
	}
	// TODO
	// g.setFont(oldf);
	// TODO
	// if (!(current instanceof Canvas) || ((Canvas) current).getWidth() != displayRectangle.width
	//		|| ((Canvas) current).getHeight() != displayRectangle.height) {
	// 	g.translate(-displayPaintable.x, -displayPaintable.y);
	//}
	// TODO
	// g.restore();
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:59,代码来源:AndroidDeviceDisplay.java

示例12: onTrackballEvent

import org.microemu.android.device.ui.AndroidCanvasUI; //导入依赖的package包/类
@Override
public boolean onTrackballEvent(MotionEvent event) {
    if (event.getAction() == MotionEvent.ACTION_MOVE) {
        MIDletAccess ma = MIDletBridge.getMIDletAccess();
        if (ma == null) {
            return false;
        }
        final DisplayAccess da = ma.getDisplayAccess();
        if (da == null) {
            return false;
        }
        AndroidDisplayableUI ui = (AndroidDisplayableUI) da.getDisplayableUI(da.getCurrent());
        if (ui instanceof AndroidCanvasUI) {
            float x = event.getX();
            float y = event.getY();
            if ((x > 0 && accumulatedTrackballX < 0) || (x < 0 && accumulatedTrackballX > 0)) {
                accumulatedTrackballX = 0;
            }
            if ((y > 0 && accumulatedTrackballY < 0) || (y < 0 && accumulatedTrackballY > 0)) {
                accumulatedTrackballY = 0;
            }
            if (accumulatedTrackballX + x > TRACKBALL_THRESHOLD) {
                accumulatedTrackballX -= TRACKBALL_THRESHOLD;
                KEY_RIGHT_DOWN_EVENT.dispatch(this);
                KEY_RIGHT_UP_EVENT.dispatch(this);
            } else if (accumulatedTrackballX + x < -TRACKBALL_THRESHOLD) {
                accumulatedTrackballX += TRACKBALL_THRESHOLD;
                KEY_LEFT_DOWN_EVENT.dispatch(this);
                KEY_LEFT_UP_EVENT.dispatch(this);
            }
            if (accumulatedTrackballY + y > TRACKBALL_THRESHOLD) {
                accumulatedTrackballY -= TRACKBALL_THRESHOLD;
                KEY_DOWN_DOWN_EVENT.dispatch(this);
                KEY_DOWN_UP_EVENT.dispatch(this);
            } else if (accumulatedTrackballY + y < -TRACKBALL_THRESHOLD) {
                accumulatedTrackballY += TRACKBALL_THRESHOLD;
                KEY_UP_DOWN_EVENT.dispatch(this);
                KEY_UP_UP_EVENT.dispatch(this);
            }
            accumulatedTrackballX += x;
            accumulatedTrackballY += y;

            return true;
        }
    }

    return super.onTrackballEvent(event);
}
 
开发者ID:BombusMod,项目名称:BombusMod,代码行数:49,代码来源:BombusModActivity.java


注:本文中的org.microemu.android.device.ui.AndroidCanvasUI类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。