Libgdx 桌面项目——图像的绘制1
2013-09-22 21:21
204 查看
原图
绘制
绘制
package com.xuefei.mygame; import com.badlogic.gdx.ApplicationListener; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.GL10; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.scenes.scene2d.ui.Label; import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle; public class MyGame implements ApplicationListener { Stage stage; SpriteBatch batch; Texture test; @Override public void create() { float w = Gdx.graphics.getWidth(); float h = Gdx.graphics.getHeight(); stage = new Stage(w, h, true); LabelStyle labelStyle = new LabelStyle(new BitmapFont(), Color.WHITE); Label label = new Label("FPS:", labelStyle); label.setName("fpsLabel"); label.setY(0); label.setX(w - label.getTextBounds().width); stage.addActor(label); batch = new SpriteBatch(); test = new Texture(Gdx.files.internal("assets/test.png")); } @Override public void dispose() { stage.dispose(); } @Override public void render() { Gdx.gl.glClearColor(0, 0, 0, 0); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); Label label = (Label) stage.getRoot().findActor("fpsLabel"); label.setText("FPS:" + Gdx.graphics.getFramesPerSecond()); label.setX(800 - label.getTextBounds().width); stage.act(); stage.draw(); batch.begin(); batch.draw(test, 0,0); batch.end(); } @Override public void resize(int width, int height) { } @Override public void pause() { } @Override public void resume() { } }
相关文章推荐
- Libgdx Android项目——图像的绘制1
- libgdx 绘制图像
- Libgdx桌面项目1
- 【Android LibGDX游戏引擎开发教程】第06期:图形图像的绘制(下)图片整合工具的使用
- libgdx 学习笔记二 绘制图像
- Android Studio下调试Libgdx桌面项目的正确设置
- 【Android LibGDX游戏引擎开发教程】第05期:图形图像的绘制(上)基础类的使用和详解
- 【Android LibGDX游戏引擎开发教程】第06期:图形图像的绘制(下)图片整合工具的使用
- libgdx 学习笔记二 绘制图像
- android中图像绘制
- C++ AMP实战:绘制曼德勃罗特集图像
- 创建一个大小为400*400的三通道的RGB图像。将它的全部元素置0.使用指针算法将以(100,100)与(300,300)为项点绘制一个绿色的矩形。
- android eclipse更改项目程序桌面图标以及出现的问题?
- 多线程绘制函数图像
- 无法在环境变量中找到make命令: make 构建项目HelloWorld 时发生错误 (目标: 桌面) 当执行构建步骤 'Make'时
- [愚翁专栏]如何在窗体以外的地方绘制图像
- unity项目优化--绘制调用批处理unity3d Draw Call Batching
- Libgdx专题系列:地图篇 地图的绘制
- FPGA图像处理项目(三)--二维FFT
- 彩色图像的直方图绘制