• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Sprite类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: drawImage

import javax.microedition.lcdui.game.Sprite; //导入依赖的package包/类
public void drawImage(Image img, int x, int y, int anchor, int manipulation) {
	Sprite sprite = new Sprite(img);
	switch (manipulation) {
	case FLIP_HORIZONTAL:
		sprite.setTransform(Sprite.TRANS_MIRROR);
		break;
	case FLIP_VERTICAL:
		//sprite.setTransform(Sprite.TRANS_MIRROR);
		break;
	case ROTATE_90:
		sprite.setTransform(Sprite.TRANS_ROT90);
		break;
	case ROTATE_180:
		sprite.setTransform(Sprite.TRANS_MIRROR_ROT180);
		break;
	case ROTATE_270:
		sprite.setTransform(Sprite.TRANS_MIRROR_ROT270);
		break;
	}
	sprite.setPosition(
			x - xanchor(anchor, img.getWidth()),
			y - yanchor(anchor, img.getHeight())
	);
	sprite.paint(g);
}
 
开发者ID:RobDangerous,项目名称:Jademula,代码行数:26,代码来源:_DirectGraphics.java


示例2: initGui

import javax.microedition.lcdui.game.Sprite; //导入依赖的package包/类
protected void initGui() {
    inventoryImage = cc.textureProvider.getImage("gui/inventory_" + (Touch.isTouchSupported() ? "landscape.png" : "normal.png"));

    if (Touch.isTouchSupported()) {
        xInv = (cc.screenWidth - 3 - GuiButtonMoveControl.getButtonWidth() - 3) / 2 - inventoryImage.getWidth() / 2;
        yInv = (cc.screenHeight) / 2 - inventoryImage.getHeight() / 2;

        elementsList.addElement(new GuiButtonPictured(cc, this, 0, cc.screenWidth - GuiButtonPictured.getButtonWidth() - 3, cc.screenHeight - GuiButtonPictured.getButtonHeight() - 3, "gui/button_exit.png", Sprite.TRANS_ROT90));
        elementsList.addElement(new GuiButtonPictured(cc, this, 1, cc.screenWidth - GuiButtonPictured.getButtonWidth() - 3, 3, "gui/button_quick_menu.png", Sprite.TRANS_ROT90));
    } else {
        xInv = (cc.screenWidth) / 2 - inventoryImage.getWidth() / 2;
        yInv = (cc.screenHeight - 3 - GuiButtonMoveControl.getButtonHeight() - 3) / 2 - inventoryImage.getHeight() / 2 + 3 + GuiButtonMoveControl.getButtonHeight() + 3;
    }

    guiContainer = new GuiContainerInventory(cc, this, xInv + 5, yInv + 5);
}
 
开发者ID:queader,项目名称:Comcraft,代码行数:17,代码来源:GuiInventory.java


示例3: drawImageRotated

import javax.microedition.lcdui.game.Sprite; //导入依赖的package包/类
/**
 * @inheritDoc
 */
public void drawImageRotated(Object graphics, Object img, int x, int y, int degrees) {
    javax.microedition.lcdui.Image i = (javax.microedition.lcdui.Image) img;
    int t;
    switch (degrees % 360) {
        case 0:
            drawImage(graphics, img, x, y);
            return;

        case 90:
            t = Sprite.TRANS_ROT90;
            break;

        case 180:
            t = Sprite.TRANS_ROT180;
            break;

        case 270:
            t = Sprite.TRANS_ROT270;
            break;

        default:
            throw new IllegalArgumentException("Unsupported value for drawImageRotated: " + degrees);
    }

    javax.microedition.lcdui.Graphics nativeGraphics = (javax.microedition.lcdui.Graphics) graphics;
    nativeGraphics.drawRegion(i, 0, 0, i.getWidth(),
            i.getHeight(), t, x, y,
            javax.microedition.lcdui.Graphics.TOP | javax.microedition.lcdui.Graphics.LEFT);
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:33,代码来源:GameCanvasImplementation.java


示例4: paint

import javax.microedition.lcdui.game.Sprite; //导入依赖的package包/类
protected void paint(Graphics g) {
    listener.onPaint(graphics);
    if (isLandscape) {
        g.drawRegion(image, 0, 0, width, height, Sprite.TRANS_ROT90,
                0, 0, Graphics.TOP | Graphics.LEFT);
    } else {
        g.drawImage(image, 0, 0, Graphics.TOP | Graphics.LEFT);
    }
}
 
开发者ID:aNNiMON,项目名称:JECP,代码行数:10,代码来源:PaintCanvas.java


示例5: executeFrame

import javax.microedition.lcdui.game.Sprite; //导入依赖的package包/类
public void executeFrame(Graphics g, long numOps) {
  for (long j = 0; j < numOps; j++) {
    g.drawRegion(srcImages[curImageIndex], 0, 0, width, height, Sprite.TRANS_NONE, width / 2, height / 2, Graphics.VCENTER|Graphics.HCENTER);
    curImageIndex = (curImageIndex + 1) % srcImages.length;
  }
  curImageIndex = (curImageIndex + 1) % srcImages.length;
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:8,代码来源:GraphicsBench.java


示例6: paint

import javax.microedition.lcdui.game.Sprite; //导入依赖的package包/类
protected void paint(Graphics screenG) {
    Image image;
    try {
      image = Image.createImage("/gfx/images/colorRects.png");
    } catch (java.io.IOException e) {
      System.out.println("FAIL - " + e);
      return;
    }

    screenG.setColor(255, 255, 255);
    screenG.fillRect(0, 0, getWidth(), getHeight());

    screenG.drawRegion(image, 10, 15, 70, 95, Sprite.TRANS_MIRROR_ROT90, getWidth() / 2, getHeight() / 2, Graphics.VCENTER | Graphics.HCENTER);
    System.out.println("PAINTED");
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:16,代码来源:DrawRegionTransMirrorRot90AnchorVCenterHCenter.java


示例7: paint

import javax.microedition.lcdui.game.Sprite; //导入依赖的package包/类
protected void paint(Graphics screenG) {
    Image image;
    try {
      image = Image.createImage("/gfx/images/colorRects.png");
    } catch (java.io.IOException e) {
      System.out.println("FAIL - " + e);
      return;
    }

    screenG.setColor(255, 255, 255);
    screenG.fillRect(0, 0, getWidth(), getHeight());

    screenG.drawRegion(image, 10, 15, 70, 95, Sprite.TRANS_ROT90, getWidth() / 2, getHeight() / 2, Graphics.BOTTOM | Graphics.RIGHT);
    System.out.println("PAINTED");
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:16,代码来源:DrawRegionTransRot90AnchorBottomRight.java


示例8: paint

import javax.microedition.lcdui.game.Sprite; //导入依赖的package包/类
protected void paint(Graphics screenG) {
    Image image;
    try {
      image = Image.createImage("/gfx/images/colorRects.png");
    } catch (java.io.IOException e) {
      System.out.println("FAIL - " + e);
      return;
    }

    screenG.setColor(255, 255, 255);
    screenG.fillRect(0, 0, getWidth(), getHeight());

    screenG.drawRegion(image, 10, 15, 70, 95, Sprite.TRANS_MIRROR_ROT270, getWidth() / 2, getHeight() / 2, Graphics.BOTTOM | Graphics.RIGHT);
    System.out.println("PAINTED");
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:16,代码来源:DrawRegionTransMirrorRot270AnchorBottomRight.java


示例9: paint

import javax.microedition.lcdui.game.Sprite; //导入依赖的package包/类
protected void paint(Graphics screenG) {
    Image image;
    try {
      image = Image.createImage("/gfx/images/colorRects.png");
    } catch (java.io.IOException e) {
      System.out.println("FAIL - " + e);
      return;
    }

    screenG.setColor(255, 255, 255);
    screenG.fillRect(0, 0, getWidth(), getHeight());

    screenG.drawRegion(image, 10, 15, 70, 95, Sprite.TRANS_ROT90, getWidth() / 2, getHeight() / 2, Graphics.VCENTER | Graphics.LEFT);
    System.out.println("PAINTED");
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:16,代码来源:DrawRegionTransRot90AnchorVCenterLeft.java


示例10: paint

import javax.microedition.lcdui.game.Sprite; //导入依赖的package包/类
protected void paint(Graphics screenG) {
    Image image;
    try {
      image = Image.createImage("/gfx/images/colorRects.png");
    } catch (java.io.IOException e) {
      System.out.println("FAIL - " + e);
      return;
    }

    screenG.setColor(255, 255, 255);
    screenG.fillRect(0, 0, getWidth(), getHeight());

    screenG.drawRegion(image, 10, 15, 70, 95, Sprite.TRANS_MIRROR_ROT90, getWidth() / 2, getHeight() / 2, Graphics.VCENTER | Graphics.RIGHT);
    System.out.println("PAINTED");
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:16,代码来源:DrawRegionTransMirrorRot90AnchorVCenterRight.java


示例11: paint

import javax.microedition.lcdui.game.Sprite; //导入依赖的package包/类
protected void paint(Graphics screenG) {
    Image image;
    try {
      image = Image.createImage("/gfx/images/colorRects.png");
    } catch (java.io.IOException e) {
      System.out.println("FAIL - " + e);
      return;
    }

    screenG.setColor(255, 255, 255);
    screenG.fillRect(0, 0, getWidth(), getHeight());

    screenG.drawRegion(image, 10, 15, 70, 95, Sprite.TRANS_NONE, getWidth() / 2, getHeight() / 2, Graphics.BOTTOM | Graphics.LEFT);
    System.out.println("PAINTED");
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:16,代码来源:DrawRegionTransNoneAnchorBottomLeft.java


示例12: paint

import javax.microedition.lcdui.game.Sprite; //导入依赖的package包/类
protected void paint(Graphics screenG) {
    Image image;
    try {
      image = Image.createImage("/gfx/images/colorRects.png");
    } catch (java.io.IOException e) {
      System.out.println("FAIL - " + e);
      return;
    }

    screenG.setColor(255, 255, 255);
    screenG.fillRect(0, 0, getWidth(), getHeight());

    screenG.drawRegion(image, 10, 15, 70, 95, Sprite.TRANS_MIRROR, getWidth() / 2, getHeight() / 2, Graphics.TOP | Graphics.RIGHT);
    System.out.println("PAINTED");
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:16,代码来源:DrawRegionTransMirrorAnchorTopRight.java


示例13: paint

import javax.microedition.lcdui.game.Sprite; //导入依赖的package包/类
protected void paint(Graphics screenG) {
    Image image;
    try {
      image = Image.createImage("/gfx/images/colorRects.png");
    } catch (java.io.IOException e) {
      System.out.println("FAIL - " + e);
      return;
    }

    screenG.setColor(255, 255, 255);
    screenG.fillRect(0, 0, getWidth(), getHeight());

    screenG.drawRegion(image, 10, 15, 70, 95, Sprite.TRANS_MIRROR, getWidth() / 2, getHeight() / 2, Graphics.BOTTOM | Graphics.HCENTER);
    System.out.println("PAINTED");
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:16,代码来源:DrawRegionTransMirrorAnchorBottomHCenter.java


示例14: paint

import javax.microedition.lcdui.game.Sprite; //导入依赖的package包/类
protected void paint(Graphics screenG) {
    Image image;
    try {
      image = Image.createImage("/gfx/images/colorRects.png");
    } catch (java.io.IOException e) {
      System.out.println("FAIL - " + e);
      return;
    }

    screenG.setColor(255, 255, 255);
    screenG.fillRect(0, 0, getWidth(), getHeight());

    screenG.drawRegion(image, 10, 15, 70, 95, Sprite.TRANS_MIRROR_ROT180, getWidth() / 2, getHeight() / 2, Graphics.VCENTER | Graphics.LEFT);
    System.out.println("PAINTED");
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:16,代码来源:DrawRegionTransMirrorRot180AnchorVCenterLeft.java


示例15: paint

import javax.microedition.lcdui.game.Sprite; //导入依赖的package包/类
protected void paint(Graphics screenG) {
    Image image;
    try {
      image = Image.createImage("/gfx/images/colorRects.png");
    } catch (java.io.IOException e) {
      System.out.println("FAIL - " + e);
      return;
    }

    screenG.setColor(255, 255, 255);
    screenG.fillRect(0, 0, getWidth(), getHeight());

    screenG.drawRegion(image, 10, 15, 70, 95, Sprite.TRANS_ROT180, getWidth() / 2, getHeight() / 2, Graphics.VCENTER | Graphics.HCENTER);
    System.out.println("PAINTED");
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:16,代码来源:DrawRegionTransRot180AnchorVCenterHCenter.java


示例16: paint

import javax.microedition.lcdui.game.Sprite; //导入依赖的package包/类
protected void paint(Graphics screenG) {
    Image image;
    try {
      image = Image.createImage("/gfx/images/colorRects.png");
    } catch (java.io.IOException e) {
      System.out.println("FAIL - " + e);
      return;
    }

    screenG.setColor(255, 255, 255);
    screenG.fillRect(0, 0, getWidth(), getHeight());

    screenG.drawRegion(image, 10, 15, 70, 95, Sprite.TRANS_ROT270, getWidth() / 2, getHeight() / 2, Graphics.BOTTOM | Graphics.HCENTER);
    System.out.println("PAINTED");
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:16,代码来源:DrawRegionTransRot270AnchorBottomHCenter.java


示例17: paint

import javax.microedition.lcdui.game.Sprite; //导入依赖的package包/类
protected void paint(Graphics screenG) {
    Image image;
    try {
      image = Image.createImage("/gfx/images/colorRects.png");
    } catch (java.io.IOException e) {
      System.out.println("FAIL - " + e);
      return;
    }

    screenG.setColor(255, 255, 255);
    screenG.fillRect(0, 0, getWidth(), getHeight());

    screenG.drawRegion(image, 10, 15, 70, 95, Sprite.TRANS_NONE, getWidth() / 2, getHeight() / 2, Graphics.TOP | Graphics.RIGHT);
    System.out.println("PAINTED");
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:16,代码来源:DrawRegionTransNoneAnchorTopRight.java


示例18: paint

import javax.microedition.lcdui.game.Sprite; //导入依赖的package包/类
protected void paint(Graphics screenG) {
    Image image;
    try {
      image = Image.createImage("/gfx/images/colorRects.png");
    } catch (java.io.IOException e) {
      System.out.println("FAIL - " + e);
      return;
    }

    screenG.setColor(255, 255, 255);
    screenG.fillRect(0, 0, getWidth(), getHeight());

    screenG.drawRegion(image, 10, 15, 70, 95, Sprite.TRANS_NONE, getWidth() / 2, getHeight() / 2, Graphics.BOTTOM | Graphics.HCENTER);
    System.out.println("PAINTED");
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:16,代码来源:DrawRegionTransNoneAnchorBottomHCenter.java


示例19: paint

import javax.microedition.lcdui.game.Sprite; //导入依赖的package包/类
protected void paint(Graphics screenG) {
    Image image;
    try {
      image = Image.createImage("/gfx/images/colorRects.png");
    } catch (java.io.IOException e) {
      System.out.println("FAIL - " + e);
      return;
    }

    screenG.setColor(255, 255, 255);
    screenG.fillRect(0, 0, getWidth(), getHeight());

    screenG.drawRegion(image, 10, 15, 70, 95, Sprite.TRANS_NONE, getWidth() / 2, getHeight() / 2, Graphics.VCENTER | Graphics.HCENTER);
    System.out.println("PAINTED");
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:16,代码来源:DrawRegionTransNoneAnchorVCenterHCenter.java


示例20: paint

import javax.microedition.lcdui.game.Sprite; //导入依赖的package包/类
protected void paint(Graphics screenG) {
    Image image;
    try {
      image = Image.createImage("/gfx/images/colorRects.png");
    } catch (java.io.IOException e) {
      System.out.println("FAIL - " + e);
      return;
    }

    screenG.setColor(255, 255, 255);
    screenG.fillRect(0, 0, getWidth(), getHeight());

    screenG.drawRegion(image, 10, 15, 70, 95, Sprite.TRANS_MIRROR_ROT180, getWidth() / 2, getHeight() / 2, Graphics.VCENTER | Graphics.RIGHT);
    System.out.println("PAINTED");
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:16,代码来源:DrawRegionTransMirrorRot180AnchorVCenterRight.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AnalysisService类代码示例发布时间:2022-05-22
下一篇:
Java AbstractHessianInput类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap