Bottle 2D - Lua API 1.0.0
All you need to create games using bottle2D.
|
All global functions and classes. More...
Go to the source code of this file.
Classes | |
class | Vector3D |
A simple vector in three dimentions. More... | |
class | Vector2D |
A simple vector in two dimentions. More... | |
class | Color |
A color, with red, green, blue and alpha value. More... | |
class | Texture |
A texture (an image) that can be loaded from a file. More... | |
class | Sound |
A short sound that can be loaded from a file. More... | |
class | Music |
A music. More... | |
class | Font |
A text font, that can be loaded from a file. More... | |
class | Arguments |
A class that handle arguments passed to the mode and arguments to be passed to the next mode. More... | |
class | ModeInfo |
A structure containing information about a mode. More... | |
class | ConfigNode |
A config node represent a node in the configuration file (like an XML node). More... | |
class | ConfigManager |
The config manager is designed to contain the list of the mode and their information. More... | |
class | EventHandlerBase |
Base event handler that can be destroyed. More... | |
class | Timer |
Timer event, to send event at regular interval, see Screen::RegisterTimer to register a timer event. More... | |
class | Chronometer |
Chronometer event, to send event on each frame while the time is not elapsed, see Screen::RegisterChronometer to register a chronometer event. More... | |
class | MouseZoneEvent |
Mouse enter / leave physic object event, see Screen::RegisterMouseZoneEvent to register a MouseZone event. More... | |
class | Object |
The base of all physic and drawable object. More... | |
class | Drawable |
A Drawable is a base class which contains fonctions common to every Drawable object (Group, Sprite, Text...). More... | |
class | PhysicObject |
A base class containing common functions to all physic objects. More... | |
class | CollisionInfo |
A structure containing informations about a collision. More... | |
class | Group |
A Group is a container wich can contain drawable and physic object. More... | |
class | ScreenConfig |
A ScreenConfig is associated to a screen. More... | |
class | Screen |
A screen represent a part of your game where differenent physic and drawable object will evolve. More... | |
class | ParticleModel |
A particle model defines the variable of the particle. More... | |
class | ParticleEmitter |
A particle emitter defines how the particle will be emitted (their direction and emission zone). More... | |
class | ParticleSource |
A particle source is used to send particle and create beautiful effects. More... | |
class | PhCircle |
A physic object representing a circle / disk created using Group::CreatePhCircle. More... | |
class | PhLine |
A physic object representing a line created using Group::CreatePhLine. More... | |
class | PhRect |
A physic object representing a rectangle created using Group::CreatePhRect. More... | |
class | PhShape |
A physic object representing an user shape created using Group::CreatePhShape. More... | |
class | PhTriangle |
A physic object representing a triangle created using Group::CreatePhTriangle. More... | |
class | PostFX |
A post effect is like a texture shader. More... | |
class | Shape |
A Shape is a basic shape with a color and an outline color. More... | |
class | Sprite |
A Sprite is used to render a texture. More... | |
class | Text |
A Text is used to render text. More... | |
class | ScreenRenderer |
A screen renderer is used to draw the content of an other screen in the current screen. More... | |
class | TexturedArea |
A TexturedArea is used to render a texture. More... | |
class | SoundManager |
A SoundManager is used to render a texture. More... | |
class | SoundPlayer |
Functions | |
nil | ChangeScreen (string name) |
Select a new screen from its name. | |
nil | ChangeScreen (ProtectedPtr< Screen > screen) |
Select a new screen from the associated screen object. | |
ProtectedPtr< Screen > | CreateScreen (string name) |
Create a new screen named [name] and return a handler to it. | |
ProtectedPtr< Screen > | CreateScreen (string name, ScreenConfig screenConfig) |
Create a new screen named [name] and return a handler to it. | |
string | GetCommonDataPath () |
Get the path of the common data dir (data/common) | |
string | GetModePath () |
Get the path of the mode dir (data/modes/[modeName]) | |
string | GetEngineVersion () |
Get the arguments. | |
nil | RequestRecreateRenderWindow () |
Recreate a render window, after changing settings. | |
number | GetFrameTime () |
Get the current frime time Note: 1/GetFrameTime() gives you the frame per second (FPS) | |
nil | Quit () |
Exit the engine. | |
number | ConvertRatioCosAccelerationDeceleration (number ratio) |
Convert a ratio (between 0 and 1) to make it grow faster and faster (from 0 to 0.5) and then slower and slower (from 0.5 to 1). | |
number | ConvertRatioAcceleration (number ratio, number coefficient) |
Convert a ratio (between 0 and 1) to make it grow faster and faster (exponential type). | |
number | ConvertRatioDeceleration (number ratio, number coefficient) |
Convert a ratio (between 0 and 1) to make it grow slower and slower (exponential type). | |
Vector2D | GetMousePosition () |
Return the current mouse position. | |
ConfigNode | GetModeConf () |
Set the current mouse position. | |
ModeInfo | GetModeInfo () |
Return the informations (ModeInfo) attached to the currently runing mode (your mode) | |
nil | LoadMode (string idName) |
Laod the mode idName (idName is the name of the mode directory, in data/modes/ or the user config directory. | |
ConfigManager | GetConfigManager () |
Get the ConfigManager of the engine. | |
nil | ForceFrame () |
Force the engine to draw a frame. | |
nil | ShowConsole (bool isVisible) |
Show or hide the information console. | |
bool | IsConsoleVisible () |
Return true if the information console is visible, false if not. | |
bool | IsKeyPressed (string keyName) |
Return true if the key keyName is pressed, false otherwise. | |
Vector2D | GetRealWindowSize () |
Return the real size of the window (resolution). | |
nil | SetShowPhysicObjects (bool isVisible) |
Set if the group centers and the physic objects should be drawn (helps for debuging). | |
bool | IsShowPhysicObjects () |
Return true if the group centers and the physic objects should be drawn, else otherwise. | |
string | _ (string str) |
Translation function. | |
string | GetTypeName (number typeId) |
Return the type name (string) of the given type id. | |
string | GetChildTree () |
Get the child tree (for debuging purpose) of the currently running screen. | |
luaObject | GetAvaibleVideoModes () |
Get the avaible video modes (return a table of Vector2D). | |
luaObject | GetCmdArguments () |
Get the arguments given to bottle2d when executed (return a table of string). | |
SoundManager | GetGlobalSoundManager () |
Get the global sound manager. | |
ProtectedPtr< Screen > | GetCurrentScreen () |
Get the current running screen. | |
luaObject | GetScreenList () |
Get an asssociative array of the Screen with their name as key. | |
number | GetUniqueFrameId () |
Get the unique identifier (integer) of this frame. |
All global functions and classes.
string _ | ( | string | str | ) |
Translation function.
Use Gettext to translate your string. See ConfigManager::InitLocales().
nil ChangeScreen | ( | ProtectedPtr< Screen > | screen | ) |
Select a new screen from the associated screen object.
nil ChangeScreen | ( | string | name | ) |
Select a new screen from its name.
number ConvertRatioAcceleration | ( | number | ratio, |
number | coefficient | ||
) |
Convert a ratio (between 0 and 1) to make it grow faster and faster (exponential type).
You have to give an acceletation coefficient (> 0).
Note: This function ensure that ConvertRatioAcceleration(0) = 0 and ConvertRatioAcceleration(1) = 1.
number ConvertRatioCosAccelerationDeceleration | ( | number | ratio | ) |
Convert a ratio (between 0 and 1) to make it grow faster and faster (from 0 to 0.5) and then slower and slower (from 0.5 to 1).
Note: This function ensure that ConvertRatioCosAccelerationDeceleration(0) = 0 and ConvertRatioCosAccelerationDeceleration(1) = 1.
number ConvertRatioDeceleration | ( | number | ratio, |
number | coefficient | ||
) |
Convert a ratio (between 0 and 1) to make it grow slower and slower (exponential type).
You have to give an acceletation coefficient (> 0).
Note: This function ensure that ConvertRatioDeceleration(0) = 0 and ConvertRatioDeceleration(1) = 1.
ProtectedPtr<Screen> CreateScreen | ( | string | name, |
ScreenConfig | screenConfig | ||
) |
Create a new screen named [name] and return a handler to it.
This function allow you to set a ScreenConfig to this screen.
ProtectedPtr<Screen> CreateScreen | ( | string | name | ) |
Create a new screen named [name] and return a handler to it.
nil ForceFrame | ( | ) |
Force the engine to draw a frame.
Usefull for progress bar, by example
luaObject GetAvaibleVideoModes | ( | ) |
string GetChildTree | ( | ) |
Get the child tree (for debuging purpose) of the currently running screen.
luaObject GetCmdArguments | ( | ) |
Get the arguments given to bottle2d when executed (return a table of string).
string GetCommonDataPath | ( | ) |
Get the path of the common data dir (data/common)
ConfigManager GetConfigManager | ( | ) |
Get the ConfigManager of the engine.
ProtectedPtr<Screen> GetCurrentScreen | ( | ) |
Get the current running screen.
string GetEngineVersion | ( | ) |
Get the arguments.
Note: if you want to pass argument to a mode, you just have to add arguments into this object. Get the version of the engine
number GetFrameTime | ( | ) |
Get the current frime time
Note: 1/GetFrameTime() gives you the frame per second (FPS)
SoundManager GetGlobalSoundManager | ( | ) |
Get the global sound manager.
A sound launched into the global SoundManager will not be paused when the screen is changed.
ConfigNode GetModeConf | ( | ) |
Set the current mouse position.
Return the configuration node attached to the currently runing mode (your mode)
ModeInfo GetModeInfo | ( | ) |
Return the informations (ModeInfo) attached to the currently runing mode (your mode)
string GetModePath | ( | ) |
Get the path of the mode dir (data/modes/[modeName])
Vector2D GetMousePosition | ( | ) |
Return the current mouse position.
Vector2D GetRealWindowSize | ( | ) |
Return the real size of the window (resolution).
This function should not be used unless you want to know the real window ratio.
See ScreenConfig.
luaObject GetScreenList | ( | ) |
Get an asssociative array of the Screen with their name as key.
string GetTypeName | ( | number | typeId | ) |
Return the type name (string) of the given type id.
number GetUniqueFrameId | ( | ) |
Get the unique identifier (integer) of this frame.
This is usefull to compare two unique frame identifier to know if events come from the same frame.
bool IsConsoleVisible | ( | ) |
Return true if the information console is visible, false if not.
bool IsKeyPressed | ( | string | keyName | ) |
Return true if the key keyName is pressed, false otherwise.
See List of key names for the list of keys.
bool IsShowPhysicObjects | ( | ) |
Return true if the group centers and the physic objects should be drawn, else otherwise.
nil LoadMode | ( | string | idName | ) |
Laod the mode idName (idName is the name of the mode directory, in data/modes/ or the user config directory.
nil Quit | ( | ) |
Exit the engine.
nil RequestRecreateRenderWindow | ( | ) |
Recreate a render window, after changing settings.
nil SetShowPhysicObjects | ( | bool | isVisible | ) |
Set if the group centers and the physic objects should be drawn (helps for debuging).
nil ShowConsole | ( | bool | isVisible | ) |
Show or hide the information console.