-
Notifications
You must be signed in to change notification settings - Fork 0
Continuous & non continuous rendering
By default in libgdx, the rendering thread calls the render() method of your ApplicationListener class continuously, with a frequency that depends on your hardware (30-50-80 times per second).
If you have many still frames in your game (think about a card game) you can save precious battery power by disabling the continuous rendering, and calling it only when you really need it.
All you need is put the following lines in your ApplicationListener's create() method
Gdx.graphics.setContinuousRendering(false);
Gdx.graphics.requestRendering();The first line tells the game to stop calling the render() method automatically. The second line triggers the render() method once. You have to use the second line wherever you want the render() method to be called.
If continuous rendering is set to false, the render() method will be called only when the following things happen.
- An input event is triggered
- Gdx.graphics.requestRendering() is called
- Gdx.app.postRunnable() is called
UI Actions: Many Actions, such as the default fade-in and fade-out of dialogs, have a duration in which they need rendering to occur. You can enable this automatically with a single call:
Stage.setActionsRequestRendering(true);Good article about this topic: http://bitiotic.com/blog/2012/10/01/enabling-non-continuous-rendering-in-libgdx
Official libgdx blog post: http://www.badlogicgames.com/wordpress/?p=2289
-
开发者指南
- Introduction
- 设置开发环境 (Eclipse, Intellij IDEA, NetBeans)
- 创建、运行、调试、打包你的项目
- 源码
- The Application Framework
- A Simple Game
- File Handling
- Networking
- Preferences
- Input Handling
- Memory Management
- Audio
-
Graphics
- Configuration & Querying Graphics ??
- Fullscreen & VSync
- Continuous & Non-Continuous Rendering
- Clearing the Screen
- Take a Screenshot
- Profiling
- Viewports
- OpenGL ES Support * Configuration & Querying OpenGL ?? * Direct Access ?? * Utility Classes * Rendering Shapes * Textures & TextureRegions * Meshes * Shaders * Frame Buffer Objects
- 2D Graphics * SpriteBatch, TextureRegions, and Sprites * 2D Animation * Clipping, with the use of ScissorStack * Orthographic camera * Mapping Touch Coordinates ?? * NinePatches * Bitmap Fonts * Distance field fonts * Color Markup Language * Using TextureAtlases * Pixmaps * Packing Atlases Offline * Packing Atlases at Runtime * Texture Compression * 2D Particle Effects * Tile Maps * scene2d * scene2d.ui * Table * Skin
- 3D Graphics * Quick Start * Models * Material and environment * ModelBatch * ModelBuilder, MeshBuilder and MeshPartBuilder * 3D animations and skinning * Importing Blender models in LibGDX * 3D Particle Effects * Perspective Camera ?? * Picking ?? * Decals
- Managing Your Assets
- Internationalization and Localization
- 实用程序
-
Math Utilities
- Interpolation
- Vectors, Matrices, Quaternions
- Circles, Planes, Rays, etc.
- Path interface & Splines
- Bounding Volumes ??
- Intersection & Overlap Testing ??
- 工具
- 扩展
- Artificial Intelligence
- gdx-freetype
-
Physics
* Box2D
* Bullet Physics * [Setup](../Bullet Wrapper - Setup) * [Using the wrapper](../Bullet Wrapper - Using the wrapper) * [Using models](../Bullet Wrapper - Using models) * [Contact callbacks](../Bullet Wrapper - Contact callbacks) * [Custom classes](../Bullet Wrapper - Custom classes) * [Debugging](../Bullet Wrapper - Debugging)
- Using libgdx with other JVM languages
- Third Party Services
- 文章