本文整理汇总了Java中org.microemu.device.DeviceFactory类的典型用法代码示例。如果您正苦于以下问题:Java DeviceFactory类的具体用法?Java DeviceFactory怎么用?Java DeviceFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DeviceFactory类属于org.microemu.device包,在下文中一共展示了DeviceFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onConfigurationChanged
import org.microemu.device.DeviceFactory; //导入依赖的package包/类
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
Drawable phoneCallIcon = getResources().getDrawable(android.R.drawable.stat_sys_phone_call);
int statusBarHeight = 0;
if (!windowFullscreen) {
statusBarHeight = phoneCallIcon.getIntrinsicHeight();
}
Display display = getWindowManager().getDefaultDisplay();
AndroidDeviceDisplay deviceDisplay = (AndroidDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay();
deviceDisplay.setSize(display.getWidth(), display.getHeight() - statusBarHeight);
MIDletAccess ma = MIDletBridge.getMIDletAccess();
if (ma == null) {
return;
}
DisplayAccess da = ma.getDisplayAccess();
if (da != null) {
da.sizeChanged();
deviceDisplay.repaint(0, 0, deviceDisplay.getFullWidth(), deviceDisplay.getFullHeight());
}
}
示例2: buttonPressed
import org.microemu.device.DeviceFactory; //导入依赖的package包/类
public void buttonPressed(int keyCode) {
if (DeviceFactory.getDevice().hasRepeatEvents() && inputMethodListener == null) {
if (repeatModeKeyCode == keyCode) {
MIDletAccess ma = MIDletBridge.getMIDletAccess();
if (ma == null) {
return;
}
DisplayAccess da = ma.getDisplayAccess();
if (da == null) {
return;
}
da.keyRepeated(keyCode);
return;
} else {
repeatModeKeyCode = keyCode;
}
}
fireInputMethodListener(keyCode);
}
示例3: buttonReleased
import org.microemu.device.DeviceFactory; //导入依赖的package包/类
public void buttonReleased(int keyCode) {
if (DeviceFactory.getDevice().hasRepeatEvents() && inputMethodListener == null) {
repeatModeKeyCode = Integer.MAX_VALUE;
}
MIDletAccess ma = MIDletBridge.getMIDletAccess();
if (ma == null) {
return;
}
DisplayAccess da = ma.getDisplayAccess();
if (da == null) {
return;
}
da.keyReleased(keyCode);
}
示例4: onSizeChanged
import org.microemu.device.DeviceFactory; //导入依赖的package包/类
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
AndroidDeviceDisplay deviceDisplay = (AndroidDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay();
deviceDisplay.setSize(w, h);
if (gameCanvasBitmap == null || gameCanvasBitmap.getWidth() != w || gameCanvasBitmap.getHeight() != h) {
if (gameCanvasBitmap != null) {
gameCanvasBitmap.recycle();
}
gameCanvasBitmap = Bitmap.createBitmap(deviceDisplay.getFullWidth(), deviceDisplay.getFullHeight(), Bitmap.Config.ARGB_8888);
}
if (gameCanvasGraphics != null) {
gameCanvasGraphics.reset(new android.graphics.Canvas(gameCanvasBitmap));
}
MIDletAccess ma = MIDletBridge.getMIDletAccess();
if (ma == null) {
return;
}
DisplayAccess da = ma.getDisplayAccess();
if (da != null) {
da.sizeChanged();
}
}
示例5: GrayImageFilter
import org.microemu.device.DeviceFactory; //导入依赖的package包/类
public GrayImageFilter (double Yr, double Yg, double Yb)
{
this.Yr = Yr;
this.Yg = Yg;
this.Yb = Yb;
Color backgroundColor = SwtDeviceComponent.getColor(new RGB(
((SwtDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getBackgroundColor().getRed(),
((SwtDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getBackgroundColor().getGreen(),
((SwtDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getBackgroundColor().getBlue()));
foregroundColor = SwtDeviceComponent.getColor(new RGB(
((SwtDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getForegroundColor().getRed(),
((SwtDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getForegroundColor().getGreen(),
((SwtDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getForegroundColor().getBlue()));
Rr = (backgroundColor.getRed() - foregroundColor.getRed()) / 256d;
Rg = (backgroundColor.getGreen() - foregroundColor.getGreen()) / 256d;
Rb = (backgroundColor.getBlue() - foregroundColor.getBlue()) / 256d;
}
示例6: SwtDisplayGraphics
import org.microemu.device.DeviceFactory; //导入依赖的package包/类
public SwtDisplayGraphics(SwtGraphics a_g, MutableImage a_image)
{
this.g = a_g;
this.image = a_image;
Device device = DeviceFactory.getDevice();
this.g.setBackground(g.getColor(new RGB(
((SwtDeviceDisplay) device.getDeviceDisplay()).getBackgroundColor().getRed(),
((SwtDeviceDisplay) device.getDeviceDisplay()).getBackgroundColor().getGreen(),
((SwtDeviceDisplay) device.getDeviceDisplay()).getBackgroundColor().getBlue())));
SwtFont tmpFont = (SwtFont) ((SwtFontManager) device.getFontManager()).getFont(currentFont);
this.g.setFont(tmpFont.getFont());
if (device.getDeviceDisplay().isColor()) {
this.filter = new RGBImageFilter();
} else {
if (device.getDeviceDisplay().numColors() == 2) {
this.filter = new BWImageFilter();
} else {
this.filter = new GrayImageFilter();
}
}
}
示例7: keyReleased
import org.microemu.device.DeviceFactory; //导入依赖的package包/类
public void keyReleased(KeyEvent ev) {
if (DeviceFactory.getDevice().hasRepeatEvents() && inputMethodListener == null) {
clearRepeatFlag = true;
keyRepeatTimer.schedule(new KeyRepeatTask(), 50);
} else {
MIDletAccess ma = MIDletBridge.getMIDletAccess();
if (ma == null) {
return;
}
DisplayAccess da = ma.getDisplayAccess();
if (da == null) {
return;
}
da.keyReleased(ev.keyCode);
}
}
示例8: getButton
import org.microemu.device.DeviceFactory; //导入依赖的package包/类
private SwtButton getButton(int x, int y) {
for (Enumeration e = DeviceFactory.getDevice().getButtons().elements(); e.hasMoreElements();) {
SwtButton button = (SwtButton) e.nextElement();
if (button.getShape() != null) {
try {
org.microemu.device.impl.Shape tmp = (org.microemu.device.impl.Shape) button.getShape().clone();
if (tmp.contains(x, y)) {
return button;
}
} catch (CloneNotSupportedException ex) {
ex.printStackTrace();
}
}
}
return null;
}
示例9: filterRGB
import org.microemu.device.DeviceFactory; //导入依赖的package包/类
public int filterRGB (int x, int y, int rgb)
{
int a = (rgb & 0xFF000000);
int r = (rgb & 0x00FF0000) >>> 16;
int g = (rgb & 0x0000FF00) >>> 8;
int b = (rgb & 0x000000FF);
int Y = (int)(Yr * r + Yg * g + Yb * b) % 256;
if (Y > 255) {
Y = 255;
}
Color foregroundColor =
((J2SEDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay()).getForegroundColor();
r = (int) (Rr * Y) + foregroundColor.getRed();
g = (int) (Rg * Y) + foregroundColor.getGreen();
b = (int) (Rb * Y) + foregroundColor.getBlue();
return a | (r << 16) | (g << 8) | b;
}
示例10: buttonReleased
import org.microemu.device.DeviceFactory; //导入依赖的package包/类
public void buttonReleased(J2SEButton button, char keyChar) {
int keyCode = keyChar;
if (button != null && keyChar == '\0') {
keyCode = button.getKeyCode();
}
if (DeviceFactory.getDevice().hasRepeatEvents()) {
repeatModeKeyCodes.remove(new Integer(keyCode));
keyReleasedDelayTimer.schedule(new KeyReleasedDelayTask(keyCode), 50);
} else {
MIDletAccess ma = MIDletBridge.getMIDletAccess();
if (ma == null) {
return;
}
DisplayAccess da = ma.getDisplayAccess();
if (da == null) {
return;
}
da.keyReleased(keyCode);
eventAlreadyConsumed = false;
}
}
示例11: mouseReleased
import org.microemu.device.DeviceFactory; //导入依赖的package包/类
public void mouseReleased(MouseEvent e) {
mouseButtonDown = false;
MouseRepeatedTimerTask.stop();
if (pressedButton == null) {
return;
}
if (MIDletBridge.getCurrentMIDlet() == null) {
return;
}
Device device = DeviceFactory.getDevice();
J2SEInputMethod inputMethod = (J2SEInputMethod) device.getInputMethod();
J2SEButton prevOverButton = J2SEDeviceButtonsHelper.getSkinButton(e);
if (prevOverButton != null) {
inputMethod.buttonReleased(prevOverButton, '\0');
}
pressedButton = null;
// optimize for some video cards.
if (prevOverButton != null) {
repaint(prevOverButton.getShape().getBounds());
} else {
repaint();
}
}
示例12: buttonReleased
import org.microemu.device.DeviceFactory; //导入依赖的package包/类
public void buttonReleased(KeyEvent keyEvent) {
if (DeviceFactory.getDevice().hasRepeatEvents() && inputMethodListener == null) {
repeatModeKeyCodes.remove(new Integer(getKeyCode(keyEvent)));
keyReleasedDelayTimer.schedule(new KeyReleasedDelayTask(getKeyCode(keyEvent)), 50);
} else {
MIDletAccess ma = MIDletBridge.getMIDletAccess();
if (ma == null) {
return;
}
DisplayAccess da = ma.getDisplayAccess();
if (da == null) {
return;
}
da.keyReleased(getKeyCode(keyEvent));
eventAlreadyConsumed = false;
}
}
示例13: onKeyDown
import org.microemu.device.DeviceFactory; //导入依赖的package包/类
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (MIDletBridge.getCurrentMIDlet() == null) {
return false;
}
// KEYCODE_SOFT_LEFT == menu key
if (keyCode == KeyEvent.KEYCODE_SOFT_LEFT) {
return false;
}
Device device = DeviceFactory.getDevice();
((AndroidInputMethod) device.getInputMethod()).buttonPressed(event);
return true;
}
示例14: onTouchEvent
import org.microemu.device.DeviceFactory; //导入依赖的package包/类
@Override
public boolean onTouchEvent(MotionEvent event) {
Device device = DeviceFactory.getDevice();
AndroidInputMethod inputMethod = (AndroidInputMethod) device.getInputMethod();
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN :
inputMethod.pointerPressed((int) event.getX(), (int) event.getY());
break;
case MotionEvent.ACTION_UP :
inputMethod.pointerReleased((int) event.getX(), (int) event.getY());
break;
case MotionEvent.ACTION_MOVE :
inputMethod.pointerDragged((int) event.getX(), (int) event.getY());
break;
default:
return false;
}
return true;
}
示例15: onConfigurationChanged
import org.microemu.device.DeviceFactory; //导入依赖的package包/类
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
Drawable phoneCallIcon = getResources().getDrawable(android.R.drawable.stat_sys_phone_call);
int statusBarHeight = 0;
if (!windowFullscreen) {
statusBarHeight = phoneCallIcon.getIntrinsicHeight();
}
Display display = getWindowManager().getDefaultDisplay();
AndroidDeviceDisplay deviceDisplay = (AndroidDeviceDisplay) DeviceFactory.getDevice().getDeviceDisplay();
deviceDisplay.displayRectangleWidth = display.getWidth();
deviceDisplay.displayRectangleHeight = display.getHeight() - statusBarHeight;
MIDletAccess ma = MIDletBridge.getMIDletAccess();
if (ma == null) {
return;
}
DisplayAccess da = ma.getDisplayAccess();
if (da != null) {
da.sizeChanged();
deviceDisplay.repaint(0, 0, deviceDisplay.getFullWidth(), deviceDisplay.getFullHeight());
}
}