Config.lua Parameters

Config.lua Parameters

Game Setup

FirstSceneClassName

Possible Values
« ClassName »
Example:
FirstSceneClassName = « GameScene »;
« ClassName » is a string that defines the name of an Objective-C class which is the first scene that should be loaded. This class must be derived from a CCScene class.
If an Objective-C class with this name can not be found, Kobold2D looks for a lua file in the format ClassName.lua (beware: filenames are case-sensitive on iOS!). If found, it will load this script and create a KKScriptScene derived class which will become the first scene.
If neither is found or the FirstSceneClassName is an empty string, it is up to you to write code that calls the CCDirector runWithScene method.
You normally do this in the AppDelegate class, by providing the following function and code:
-(void) initializationComplete
{
[[CCDirector sharedDirector] runWithScene:[MyScene node]];
}
DirectorType & DirectorTypeFallback
Possible Values
DirectorType.NSTimer
DirectorType.MainLoop
DirectorType.ThreadMainLoop
DirectorType.DisplayLink
DirectorType determines how Cocos2D’s Director implements the game loop.
DirectorTypeFallback allows you to specify to which Director type Cocos2D should fall back to in case the primary Director type is unavailable.
This is only needed if you specify the DisplayLink director because it requires iOS 3.1 or higher and may not be available on all devices.
The default setting is the DisplayLink director, which couples the updates with the screen refresh rate using a CADisplayLink object.
If you want to use UIKit views in your game, it is highly recommended to use the ThreadMainLoop director, which runs Cocos2D on a seperate thread except for the rendering part. This will make UIKit views more responsive while Cocos2D is running.
The MainLoop director uses a classic « while (isRunning) » endless loop which is non-cooperative and should be avoided since it may not interact well with iOS multitasking. The NSTimer is a safe fallback but has since become largely irrelevant, since almost all devices have iOS 3.1 installed and can run the DisplayLink director. But it is still used as the safe fallback option.

MaxFrameRate

Possible Values
1 to 60
How many times per second the screen content should be updated (framerate). This only determines the maximum possible frames per second (fps) which are drawn. If your game can not keep up computing and drawing its contents in the time between two frames, your framerate will drop. To achieve 60 frames per second, your update loop and drawing must be completed within 16,6 milliseconds (0,0166 seconds).
All iOS devices are locked at a maximum of 60 frames per second. Setting MaxFrameRate above 60 is not recommended.
If your game’s framerate fluctuates, it will feel smoother for the user if you reduce the MaxFrameRate. For example if the fluctuation is in the range of 40 to 60 fps, you might want to experiment setting the MaxFrameRate in the range of 40 to 45 in order to achieve a slower but more constant framerate.

DisplayFPS

Possible Values
YES
NO
Set to YES to display a framerate counter in the lower left corner of the screen. By the default, the framerate counter is only visible in Debug and Release builds, but will be disabled automatically in Ad Hoc and App Store distribution builds.

DisplayFPSInAdHocBuilds

Possible Values
YES
NO
In some cases, you want the users of your Ad Hoc builds to also see the framerate. Set DisplayFPSInAdHocBuilds to YES if you want to show the framerate in Ad Hoc builds as well. DisplayFPS must also be set to YES. And the framerate counter will still be disabled in App Store distribution builds.

EnableUserInteraction

Possible Values
YES
NO
This must be enabled to receive any events from the user. This includes touch events as well as keyboard input events. Typically you’ll want this to be enabled.

EnableMultiTouch

Possible Values
YES
NO
Set to YES if you want to receive and handle multi touch events. If you only need to receive single touches, set this to NO.
Render Settings
DefaultTexturePixelFormat
Possible Values
TexturePixelFormat.RGBA8888
TexturePixelFormat.RGBA4444
TexturePixelFormat.RGB565
TexturePixelFormat.RGB5A1
Sets the default pixel format for new textures.

Format Meaning

RGBA8888 32-Bits Color Depth, 1 Alpha Channel (Bits: 8 red, 8 green, 8 blue, 8 alpha)
RGBA4444 16-Bits Color Depth, 1 Alpha Channel (Bits: 4 red, 4 green, 4 blue, 4 alpha)
RGB565 16-Bits Color Depth, no Alpha Channel (Bits: 5 red, 6 green, 5 blue)
RGB5A1 16-Bits Color Depth, on/off Alpha Channel (Bits: 5 red, 5 green, 5 blue, 1 alpha)
Using RGBA4444 for textures is a quick way to effectively half the memory usage of your textures while improving rendering performance. If you don’t use gradients in your images you may not even see a big loss in image quality.
GLViewColorFormat
Possible Values
GLViewColorFormat.RGBA8888
GLViewColorFormat.RGB565
Determines the color depth of the render surface.
RGBA8888 is a 32 bit color surface, RGB565 has 16 bit color depth. More colors, better image quality but slower rendering. The Color Format also affects how much memory is reserved for the render buffer. The calculation is as follows:
ScreenWidth * ScreenHeight * ColorDepth (in Bytes) * 2 (Double Buffering) / 1024 = Memory Used (in KB)

Cours gratuitTélécharger le cours complet

Télécharger aussi :

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *