Android Engine basic notes Engine

Source: Internet
Author: User

Below are some Engine types and descriptions in Andengie:

Engine: First, we have the most common Engine object, which has no limits on fps (frames per scend). In different machines, you notice that different games run at different speeds, or two different machines watch the same movie and start at the same time. The device that runs fast finishes playing the video first, instead of playing the video. Therefore, games with high hardware requirements are required, this may not be very suitable.

FixedStepEngine: this ideal Engine, Because regardless of the device, it forces the game to run in a non-variable, the principle is to update the game in time units rather than making the device faster code execution. We need to pass EngineOptions and an int variable. The int variable defines the number of steps that the game runs per second. For example, run at a frequency of 60 steps without seconds:

Public Engine onCreateEngine (EngineOptions pEngineOptions ){

Return new FixedStepEngine (pEngineOptions, 60 );

}

LimitedFPSEngine: it allows us to set the limited FPS for the Engine to run. If the frame rate exceeds the limit, the Engine suspends the update. Similarly, the construction requires two parameters: One EngineOptions and the other int variable, specifying the maximum FPS, for example, specifying the Engine running the maximum 60FPS.


Public Engine onCreateEngine (EngineOptions pEngineOptions ){

Return new LimitedFPSEngine (pEngineOptions, 60 );

}

 

SingleSceneSplitScreenEngine and DoubleSceneSplitScreenEngine:

It is generally used to create two different Cameras games, either set a single Scene for single player or two Scene for double game.

 


Let's talk about the Resolutions policy.

Because our game running platform ranges from 3 to 10.1, most developers and users want the game to occupy the whole screen width and height, however, we should be cautious when using these policies to meet the requirements of our developers.

EngineOptons engineOptions = new EngineOptions (true, ScreenOrientation. LANDSCAPE_FIXED, new FillResolutionPolicy (), mCamera );

Next let's take a look at the resolution policies in Andengine.


FillResolutionPolicy: it is a relatively basic type. The application will occupy the entire length and width, allowing us to run in full screen mode. However, in order to fully fill the full screen, there may be obvious stretching.

FixedResolutionPolicy: it allows us to set the resolution of the selected screen, regardless of the size of the device screen or the size of the Camera, such as defining a 800*480 resolution to 1280*752 device, we may see 800*480 game images, while the rest are filled with black blocks.

RatioResolutionPolicy: this is the best solution if we want to achieve the maximum display effect without being distorted or stretched. To maximize the use of the screen, we define a ratio value in advance, which is divided by the width by the height value.

RelativeResolutionPolicy: allows you to set the ratio of the horizontal and vertical, for example, the horizontal and vertical are displayed at 1.5 times, new RelativeResolutionPlicy (1.5f), of course, you can also set different vertical ratios, new RelativeResolutionPolicy ), but it should not exceed 1.8f; otherwise, it will be forced back.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.