为Asha 303创建风景游戏画布 [英] Create Landscape Game Canvas for Asha 303

查看:100
本文介绍了为Asha 303创建风景游戏画布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经搜索了所有论坛的赌注,但从未找到满足我问题的答案.

i've searched all the forum bet never found any answer satisfy my question.

我想为Nokia Asha 303创建一个横向的游戏,有什么方法可以将游戏画布旋转90度,从而使横向变为横向?因为我看了这部影片愤怒的小鸟阿莎303 .该游戏具有横向效果,因此我很好奇如何在j2me中做到这一点.

I want to create a game with landscape orientation for Nokia Asha 303, are there any way to rotate the game canvas 90 degrees so the orientation become landscape orientation? Because i look at this video Angry Bird Asha 303. The game has landscape orientation so i curious how to do that in j2me.

谢谢

推荐答案

从MIDP 2.0开始,我们可以使用Sprite将图像旋转90度.我们需要的第一件事是正确大小的图像.以下代码可能在扩展Canvas的类的构造函数中-考虑Sprite和Image属性:

Since MIDP 2.0 we can use an Sprite to rotate an image in 90 degrees. First thing we need is an Image of the correct size. Following code could be inside the constructor of a class that extends Canvas - considering an Sprite and an Image attributes:



    int width = Math.max(super.getWidth(), super.getHeight());
    int height = Math.min(super.getWidth(), super.getHeight());
    screen = Image.createImage(width, height);
    sprite = new Sprite(screen);
    if (super.getWidth() < super.getHeight()) { // portrait screen
        sprite.setTransform(Sprite.TRANS_ROT90);
        sprite.setPosition(0, 0);
    }

在绘画内容时,请使用可变的图像图形",然后使用波纹管之类的图像更新精灵.

When painting your content use the mutable Image Graphics, then update the sprite with the image like bellow.



    protected void paint(Graphics g1) {
        Graphics g = screen.getGraphics();
        // ... do your drawing
        this.sprite.setImage(screen, screen.getWidth(), screen.getHeight());
        sprite.paint(g1);
    }

如何使用手机显示屏上的最大面积?
.不要在画布上设置标题
.不要将Command添加到Canvas
.在调用super.getWidth()和super.getHeight()之前,请调用setFullScreenMode(true).

来自 http://smallandadaptive.blogspot.com.br/2009/08/fullscreen-landscape.html

How can you use the biggest possible area on the handset display?
. Do not setTitle on your Canvas
. Do not addCommand to your Canvas
. Call setFullScreenMode(true) before calling super.getWidth() and super.getHeight()

From http://smallandadaptive.blogspot.com.br/2009/08/fullscreen-landscape.html

这篇关于为Asha 303创建风景游戏画布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆