Tidied up the sample descriptions.

Exposed UIElement::SetVar() and GetVar() to Lua script.
Modified the Lua Sprites sample to use custom vars inside UIElement.
This commit is contained in:
Lasse Öörni 2013-09-20 07:30:07 +00:00
Родитель 389cce6732
Коммит 7a55a43725
55 изменённых файлов: 190 добавлений и 173 удалений

Просмотреть файл

@ -1,8 +1,8 @@
-- This first example, maintaining tradition, prints a "Hello World" message. -- This first example, maintaining tradition, prints a "Hello World" message.
-- Furthermore it shows: -- Furthermore it shows:
-- - Using the Sample utility functions as a base for the application; -- - Using the Sample utility functions as a base for the application
-- - Adding a Text element to the graphical user interface; -- - Adding a Text element to the graphical user interface
-- - Subscribing to and handling of update events; -- - Subscribing to and handling of update events
require "LuaScripts/Utilities/Sample" require "LuaScripts/Utilities/Sample"

Просмотреть файл

@ -1,8 +1,8 @@
-- A simple 'HelloWorld' GUI created purely from code. -- A simple 'HelloWorld' GUI created purely from code.
-- This sample demonstrates: -- This sample demonstrates:
-- - Creation of controls and building a UI hierarchy; -- - Creation of controls and building a UI hierarchy
-- - Loading UI style from XML and applying it to controls; -- - Loading UI style from XML and applying it to controls
-- - Handling of global and per-control events; -- - Handling of global and per-control events
require "LuaScripts/Utilities/Sample" require "LuaScripts/Utilities/Sample"

Просмотреть файл

@ -1,14 +1,16 @@
-- Moving sprites example. -- Moving sprites example.
-- This sample demonstrates: -- This sample demonstrates:
-- - Adding Sprite elements to the UI; -- - Adding Sprite elements to the UI
-- - Storing custom data (sprite velocity) inside UI elements; -- - Storing custom data (sprite velocity) inside UI elements
-- - Handling frame update events in which the sprites are moved; -- - Handling frame update events in which the sprites are moved
require "LuaScripts/Utilities/Sample" require "LuaScripts/Utilities/Sample"
local numSprites = 100 local numSprites = 100
local sprites = {} local sprites = {}
local speeds = {}
-- Custom variable identifier for storing sprite velocity within the UI element
local VAR_VELOCITY = ShortStringHash("Velocity")
local context = GetContext() local context = GetContext()
@ -35,22 +37,33 @@ function CreateSprites()
local height = graphics.height local height = graphics.height
for i = 1, numSprites do for i = 1, numSprites do
-- Create a new sprite, set it to use the texture
local sprite = Sprite:new(context) local sprite = Sprite:new(context)
sprite.texture = decalTex sprite.texture = decalTex
sprite:SetFullImageRect() sprite:SetFullImageRect()
-- The UI root element is as big as the rendering window, set random position within it
sprite.position = Vector2(Random(width), Random(height)) sprite.position = Vector2(Random(width), Random(height))
-- Set sprite size & hotspot in its center
sprite:SetSize(128, 128) sprite:SetSize(128, 128)
sprite.hotSpot = IntVector2(64, 64) sprite.hotSpot = IntVector2(64, 64)
sprite.rotation = Random(360)
sprite.scale = Vector2(1, 1) * (Random(1) + 0.5)
-- Set random rotation in degrees and random scale
sprite.rotation = Random(360.0)
sprite.scale = Vector2(1.0, 1.0) * (Random(1.0) + 0.5)
-- Set random color and additive blending mode
sprite:SetColor(Color(Random(0.5) + 0.5, Random(0.5) + 0.5, Random(0.5) + 0.5, 1.0)) sprite:SetColor(Color(Random(0.5) + 0.5, Random(0.5) + 0.5, Random(0.5) + 0.5, 1.0))
sprite.blendMode = BLEND_ADD sprite.blendMode = BLEND_ADD
-- Add as a child of the root UI element
ui.root:AddChild(sprite) ui.root:AddChild(sprite)
-- Store sprite's velocity as a custom variable
sprite:SetVar(VAR_VELOCITY, Variant(Vector2(Random(200.0) - 100.0, Random(200.0) - 100.0)))
table.insert(sprites, sprite) table.insert(sprites, sprite)
table.insert(speeds, Vector2(Random(200) - 100, Random(200) - 100))
end end
end end
@ -68,7 +81,7 @@ function MoveSprites(timeStep)
sprite.rotation = sprite.rotation + timeStep * 30 sprite.rotation = sprite.rotation + timeStep * 30
local newPos = sprite.position local newPos = sprite.position
newPos = newPos + speeds[i] * timeStep newPos = newPos + sprite:GetVar(VAR_VELOCITY):GetVector2() * timeStep
if newPos.x >= width then if newPos.x >= width then
newPos.x = newPos.x - width newPos.x = newPos.x - width

Просмотреть файл

@ -1,8 +1,8 @@
-- Static 3D scene example. -- Static 3D scene example.
-- This sample demonstrates: -- This sample demonstrates:
-- - Creating a 3D scene with static content; -- - Creating a 3D scene with static content
-- - Displaying the scene using the Renderer subsystem; -- - Displaying the scene using the Renderer subsystem
-- - Handling keyboard and mouse input to move a freelook camera; -- - Handling keyboard and mouse input to move a freelook camera
require "LuaScripts/Utilities/Sample" require "LuaScripts/Utilities/Sample"

Просмотреть файл

@ -1,8 +1,8 @@
-- Animating 3D scene example. -- Animating 3D scene example.
-- This sample demonstrates: -- This sample demonstrates:
-- - Creating a 3D scene and using a script component to animate the objects; -- - Creating a 3D scene and using a script component to animate the objects
-- - Controlling scene ambience with the Zone component; -- - Controlling scene ambience with the Zone component
-- - Attaching a light to an object (the camera); -- - Attaching a light to an object (the camera)
require "LuaScripts/Utilities/Sample" require "LuaScripts/Utilities/Sample"

Просмотреть файл

@ -1,10 +1,10 @@
-- Skeletal animation example. -- Skeletal animation example.
-- This sample demonstrates: -- This sample demonstrates:
-- - Populating a 3D scene with skeletally animated AnimatedModel components; -- - Populating a 3D scene with skeletally animated AnimatedModel components
-- - Moving the animated models and advancing their animation using a script object; -- - Moving the animated models and advancing their animation using a script object
-- - Enabling a cascaded shadow map on a directional light, which allows high-quality shadows; -- - Enabling a cascaded shadow map on a directional light, which allows high-quality shadows
-- over a large area (typically used in outdoor scenes for shadows cast by sunlight); -- over a large area (typically used in outdoor scenes for shadows cast by sunlight)
-- - Displaying renderer debug geometry; -- - Displaying renderer debug geometry
require "LuaScripts/Utilities/Sample" require "LuaScripts/Utilities/Sample"

Просмотреть файл

@ -1,8 +1,8 @@
-- Billboard example. -- Billboard example.
-- This sample demonstrates: -- This sample demonstrates:
-- - Populating a 3D scene with billboard sets and several shadow casting spotlights; -- - Populating a 3D scene with billboard sets and several shadow casting spotlights
-- - Parenting scene nodes to allow more intuitive creation of groups of objects; -- - Parenting scene nodes to allow more intuitive creation of groups of objects
-- - Examining rendering performance with a somewhat large object and light count; -- - Examining rendering performance with a somewhat large object and light count
require "LuaScripts/Utilities/Sample" require "LuaScripts/Utilities/Sample"

Просмотреть файл

@ -1,9 +1,9 @@
-- Decals example. -- Decals example.
-- This sample demonstrates: -- This sample demonstrates:
-- - Performing a raycast to the octree and adding a decal to the hit location; -- - Performing a raycast to the octree and adding a decal to the hit location
-- - Defining a Cursor UI element which stays inside the window and can be shown/hidden; -- - Defining a Cursor UI element which stays inside the window and can be shown/hidden
-- - Marking suitable (large) objects as occluders for occlusion culling; -- - Marking suitable (large) objects as occluders for occlusion culling
-- - Displaying renderer debug geometry to see the effect of occlusion; -- - Displaying renderer debug geometry to see the effect of occlusion
require "LuaScripts/Utilities/Sample" require "LuaScripts/Utilities/Sample"

Просмотреть файл

@ -1,7 +1,7 @@
-- Multiple viewports example. -- Multiple viewports example.
-- This sample demonstrates: -- This sample demonstrates:
-- - Setting up two viewports with two separate cameras; -- - Setting up two viewports with two separate cameras
-- - Adding post processing effects to a viewport's render path and toggling them; -- - Adding post processing effects to a viewport's render path and toggling them
require "LuaScripts/Utilities/Sample" require "LuaScripts/Utilities/Sample"

Просмотреть файл

@ -1,8 +1,8 @@
-- Physics stress test example. -- Physics stress test example.
-- This sample demonstrates: -- This sample demonstrates:
-- - Physics and rendering performance with a high (1000) moving object count; -- - Physics and rendering performance with a high (1000) moving object count
-- - Using triangle meshes for collision; -- - Using triangle meshes for collision
-- - Optimizing physics simulation by leaving out collision event signaling; -- - Optimizing physics simulation by leaving out collision event signaling
require "LuaScripts/Utilities/Sample" require "LuaScripts/Utilities/Sample"

Просмотреть файл

@ -1,7 +1,7 @@
-- Sound effects example -- Sound effects example
-- This sample demonstrates: -- This sample demonstrates:
-- - Playing sound effects and music; -- - Playing sound effects and music
-- - Controlling sound and music master volume; -- - Controlling sound and music master volume
require "LuaScripts/Utilities/Sample" require "LuaScripts/Utilities/Sample"

Просмотреть файл

@ -1,7 +1,7 @@
-- Vehicle example. -- Vehicle example.
-- This sample demonstrates: -- This sample demonstrates:
-- - Creating a heightmap terrain with collision; -- - Creating a heightmap terrain with collision
-- - Constructing a physical vehicle with rigid bodies for the hull and the wheels, joined with constraints; -- - Constructing a physical vehicle with rigid bodies for the hull and the wheels, joined with constraints
require "LuaScripts/Utilities/Sample" require "LuaScripts/Utilities/Sample"

Просмотреть файл

@ -1,9 +1,9 @@
-- Huge object count example. -- Huge object count example.
-- This sample demonstrates: -- This sample demonstrates:
-- - Creating a scene with 250 x 250 simple objects; -- - Creating a scene with 250 x 250 simple objects
-- - Competing with http://yosoygames.com.ar/wp/2013/07/ogre-2-0-is-up-to-3x-faster/ :); -- - Competing with http://yosoygames.com.ar/wp/2013/07/ogre-2-0-is-up-to-3x-faster/ :)
-- - Allowing examination of performance hotspots in the rendering code; -- - Allowing examination of performance hotspots in the rendering code
-- - Optionally speeding up rendering by grouping the objects using StaticModelGroup component; -- - Optionally speeding up rendering by grouping objects with the StaticModelGroup component
require "LuaScripts/Utilities/Sample" require "LuaScripts/Utilities/Sample"

Просмотреть файл

@ -1,8 +1,8 @@
// This first example, maintaining tradition, prints a "Hello World" message. // This first example, maintaining tradition, prints a "Hello World" message.
// Furthermore it shows: // Furthermore it shows:
// - Using the Sample utility functions as a base for the application; // - Using the Sample utility functions as a base for the application
// - Adding a Text element to the graphical user interface; // - Adding a Text element to the graphical user interface
// - Subscribing to and handling of update events; // - Subscribing to and handling of update events
#include "Scripts/Utilities/Sample.as" #include "Scripts/Utilities/Sample.as"

Просмотреть файл

@ -1,8 +1,8 @@
// A simple 'HelloWorld' GUI created purely from code. // A simple 'HelloWorld' GUI created purely from code.
// This sample demonstrates: // This sample demonstrates:
// - Creation of controls and building a UI hierarchy; // - Creation of controls and building a UI hierarchy
// - Loading UI style from XML and applying it to controls; // - Loading UI style from XML and applying it to controls
// - Handling of global and per-control events; // - Handling of global and per-control events
#include "Scripts/Utilities/Sample.as" #include "Scripts/Utilities/Sample.as"

Просмотреть файл

@ -1,8 +1,8 @@
// Moving sprites example. // Moving sprites example.
// This sample demonstrates: // This sample demonstrates:
// - Adding Sprite elements to the UI; // - Adding Sprite elements to the UI
// - Storing custom data (sprite velocity) inside UI elements; // - Storing custom data (sprite velocity) inside UI elements
// - Handling frame update events in which the sprites are moved; // - Handling frame update events in which the sprites are moved
#include "Scripts/Utilities/Sample.as" #include "Scripts/Utilities/Sample.as"

Просмотреть файл

@ -1,8 +1,8 @@
// Static 3D scene example. // Static 3D scene example.
// This sample demonstrates: // This sample demonstrates:
// - Creating a 3D scene with static content; // - Creating a 3D scene with static content
// - Displaying the scene using the Renderer subsystem; // - Displaying the scene using the Renderer subsystem
// - Handling keyboard and mouse input to move a freelook camera; // - Handling keyboard and mouse input to move a freelook camera
#include "Scripts/Utilities/Sample.as" #include "Scripts/Utilities/Sample.as"

Просмотреть файл

@ -1,8 +1,8 @@
// Animating 3D scene example. // Animating 3D scene example.
// This sample demonstrates: // This sample demonstrates:
// - Creating a 3D scene and using a script component to animate the objects; // - Creating a 3D scene and using a script component to animate the objects
// - Controlling scene ambience with the Zone component; // - Controlling scene ambience with the Zone component
// - Attaching a light to an object (the camera); // - Attaching a light to an object (the camera)
#include "Scripts/Utilities/Sample.as" #include "Scripts/Utilities/Sample.as"

Просмотреть файл

@ -1,10 +1,10 @@
// Skeletal animation example. // Skeletal animation example.
// This sample demonstrates: // This sample demonstrates:
// - Populating a 3D scene with skeletally animated AnimatedModel components; // - Populating a 3D scene with skeletally animated AnimatedModel components
// - Moving the animated models and advancing their animation using a script object; // - Moving the animated models and advancing their animation using a script object
// - Enabling a cascaded shadow map on a directional light, which allows high-quality shadows // - Enabling a cascaded shadow map on a directional light, which allows high-quality shadows
// over a large area (typically used in outdoor scenes for shadows cast by sunlight); // over a large area (typically used in outdoor scenes for shadows cast by sunlight)
// - Displaying renderer debug geometry; // - Displaying renderer debug geometry
#include "Scripts/Utilities/Sample.as" #include "Scripts/Utilities/Sample.as"

Просмотреть файл

@ -1,8 +1,8 @@
// Billboard example. // Billboard example.
// This sample demonstrates: // This sample demonstrates:
// - Populating a 3D scene with billboard sets and several shadow casting spotlights; // - Populating a 3D scene with billboard sets and several shadow casting spotlights
// - Parenting scene nodes to allow more intuitive creation of groups of objects; // - Parenting scene nodes to allow more intuitive creation of groups of objects
// - Examining rendering performance with a somewhat large object and light count; // - Examining rendering performance with a somewhat large object and light count
#include "Scripts/Utilities/Sample.as" #include "Scripts/Utilities/Sample.as"

Просмотреть файл

@ -1,9 +1,9 @@
// Decals example. // Decals example.
// This sample demonstrates: // This sample demonstrates:
// - Performing a raycast to the octree and adding a decal to the hit location; // - Performing a raycast to the octree and adding a decal to the hit location
// - Defining a Cursor UI element which stays inside the window and can be shown/hidden; // - Defining a Cursor UI element which stays inside the window and can be shown/hidden
// - Marking suitable (large) objects as occluders for occlusion culling; // - Marking suitable (large) objects as occluders for occlusion culling
// - Displaying renderer debug geometry to see the effect of occlusion; // - Displaying renderer debug geometry to see the effect of occlusion
#include "Scripts/Utilities/Sample.as" #include "Scripts/Utilities/Sample.as"

Просмотреть файл

@ -1,7 +1,7 @@
// Multiple viewports example. // Multiple viewports example.
// This sample demonstrates: // This sample demonstrates:
// - Setting up two viewports with two separate cameras; // - Setting up two viewports with two separate cameras
// - Adding post processing effects to a viewport's render path and toggling them; // - Adding post processing effects to a viewport's render path and toggling them
#include "Scripts/Utilities/Sample.as" #include "Scripts/Utilities/Sample.as"

Просмотреть файл

@ -1,7 +1,7 @@
// Render to texture example // Render to texture example
// This sample demonstrates: // This sample demonstrates:
// - Creating two 3D scenes and rendering the other into a texture; // - Creating two 3D scenes and rendering the other into a texture
// - Creating rendertarget textures and materials programmatically; // - Creating rendertarget texture and material programmatically
#include "Scripts/Utilities/Sample.as" #include "Scripts/Utilities/Sample.as"

Просмотреть файл

@ -1,9 +1,9 @@
// Physics example. // Physics example.
// This sample demonstrates: // This sample demonstrates:
// - Creating both static and moving physics objects to a scene; // - Creating both static and moving physics objects to a scene
// - Displaying physics debug geometry; // - Displaying physics debug geometry
// - Using the Skybox component for setting up an unmoving sky; // - Using the Skybox component for setting up an unmoving sky
// - Saving a scene to a file and loading it to restore a previous state; // - Saving a scene to a file and loading it to restore a previous state
#include "Scripts/Utilities/Sample.as" #include "Scripts/Utilities/Sample.as"

Просмотреть файл

@ -1,8 +1,8 @@
// Physics stress test example. // Physics stress test example.
// This sample demonstrates: // This sample demonstrates:
// - Physics and rendering performance with a high (1000) moving object count; // - Physics and rendering performance with a high (1000) moving object count
// - Using triangle meshes for collision; // - Using triangle meshes for collision
// - Optimizing physics simulation by leaving out collision event signaling; // - Optimizing physics simulation by leaving out collision event signaling
#include "Scripts/Utilities/Sample.as" #include "Scripts/Utilities/Sample.as"

Просмотреть файл

@ -1,8 +1,8 @@
// Ragdoll example. // Ragdoll example.
// This sample demonstrates: // This sample demonstrates:
// - Detecting physics collisions; // - Detecting physics collisions
// - Moving an AnimatedModel's bones with physics and connecting them with constraints; // - Moving an AnimatedModel's bones with physics and connecting them with constraints
// - Using rolling friction to stop rolling objects from moving infinitely; // - Using rolling friction to stop rolling objects from moving infinitely
#include "Scripts/Utilities/Sample.as" #include "Scripts/Utilities/Sample.as"

Просмотреть файл

@ -1,7 +1,7 @@
// Sound effects example // Sound effects example
// This sample demonstrates: // This sample demonstrates:
// - Playing sound effects and music; // - Playing sound effects and music
// - Controlling sound and music master volume; // - Controlling sound and music master volume
#include "Scripts/Utilities/Sample.as" #include "Scripts/Utilities/Sample.as"

Просмотреть файл

@ -1,9 +1,9 @@
// Navigation example. // Navigation example.
// This sample demonstrates: // This sample demonstrates:
// - Generating a navigation mesh into the scene; // - Generating a navigation mesh into the scene
// - Performing path queries to the navigation mesh; // - Performing path queries to the navigation mesh
// - Rebuilding the navigation mesh partially when adding or removing objects; // - Rebuilding the navigation mesh partially when adding or removing objects
// - Visualizing custom debug geometry; // - Visualizing custom debug geometry
#include "Scripts/Utilities/Sample.as" #include "Scripts/Utilities/Sample.as"

Просмотреть файл

@ -1,7 +1,7 @@
// Chat example // Chat example
// This sample demonstrates: // This sample demonstrates:
// - Starting up a network server or connecting to it; // - Starting up a network server or connecting to it
// - Implementing simple chat functionality with network messages; // - Implementing simple chat functionality with network messages
#include "Scripts/Utilities/Sample.as" #include "Scripts/Utilities/Sample.as"

Просмотреть файл

@ -1,9 +1,9 @@
// Scene network replication example. // Scene network replication example.
// This sample demonstrates: // This sample demonstrates:
// - Creating a scene in which network clients can join; // - Creating a scene in which network clients can join
// - Giving each client an object to control and sending the controls from the clients to the server, // - Giving each client an object to control and sending the controls from the clients to the server,
// where the authoritative simulation happens; // where the authoritative simulation happens
// - Controlling a physics object's movement by applying forces; // - Controlling a physics object's movement by applying forces
#include "Scripts/Utilities/Sample.as" #include "Scripts/Utilities/Sample.as"

Просмотреть файл

@ -1,10 +1,9 @@
// Moving character example. // Moving character example.
// This sample demonstrates: // This sample demonstrates:
// - Controlling a humanoid character through physics; // - Controlling a humanoid character through physics
// - Driving animations using the AnimationController component; // - Driving animations using the AnimationController component
// - Implementing 1st and 3rd person cameras, using raycasts to avoid the 3rd person camera // - Implementing 1st and 3rd person cameras, using raycasts to avoid the 3rd person camera clipping into scenery
// clipping into scenery; // - Saving and loading the variables of a script object
// - Saving and loading the variables of a script object;
#include "Scripts/Utilities/Sample.as" #include "Scripts/Utilities/Sample.as"

Просмотреть файл

@ -1,8 +1,8 @@
// Vehicle example. // Vehicle example.
// This sample demonstrates: // This sample demonstrates:
// - Creating a heightmap terrain with collision; // - Creating a heightmap terrain with collision
// - Constructing a physical vehicle with rigid bodies for the hull and the wheels, joined with constraints; // - Constructing a physical vehicle with rigid bodies for the hull and the wheels, joined with constraints
// - Saving and loading the variables of a script object, including node & component references; // - Saving and loading the variables of a script object, including node & component references
#include "Scripts/Utilities/Sample.as" #include "Scripts/Utilities/Sample.as"

Просмотреть файл

@ -1,9 +1,9 @@
// Huge object count example. // Huge object count example.
// This sample demonstrates: // This sample demonstrates:
// - Creating a scene with 250 x 250 simple objects; // - Creating a scene with 250 x 250 simple objects
// - Competing with http://yosoygames.com.ar/wp/2013/07/ogre-2-0-is-up-to-3x-faster/ :) // - Competing with http://yosoygames.com.ar/wp/2013/07/ogre-2-0-is-up-to-3x-faster/ :)
// - Allowing examination of performance hotspots in the rendering code; // - Allowing examination of performance hotspots in the rendering code
// - Optionally speeding up rendering by grouping the objects using StaticModelGroup component; // - Optionally speeding up rendering by grouping objects with the StaticModelGroup component
#include "Scripts/Utilities/Sample.as" #include "Scripts/Utilities/Sample.as"

Просмотреть файл

@ -4528,6 +4528,7 @@ Methods:<br>
- void Remove() - void Remove()
- unsigned FindChild(UIElement* element) const - unsigned FindChild(UIElement* element) const
- void SetParent(UIElement* parent, unsigned index = M_MAX_UNSIGNED) - void SetParent(UIElement* parent, unsigned index = M_MAX_UNSIGNED)
- void SetVar(ShortStringHash key, const Variant& value)
- void SetInternal(bool enable) - void SetInternal(bool enable)
- void SetTraversalMode(TraversalMode traversalMode) - void SetTraversalMode(TraversalMode traversalMode)
- void SetElementEventSender(bool flag) - void SetElementEventSender(bool flag)
@ -4578,6 +4579,8 @@ Methods:<br>
- UIElement* GetParent() const - UIElement* GetParent() const
- UIElement* GetRoot() const - UIElement* GetRoot() const
- const Color& GetDerivedColor() const - const Color& GetDerivedColor() const
- const Variant& GetVar(ShortStringHash key) const
- const VariantMap& GetVars() const
- IntVector2 ScreenToElement(const IntVector2& screenPosition) - IntVector2 ScreenToElement(const IntVector2& screenPosition)
- IntVector2 ElementToScreen(const IntVector2& position) - IntVector2 ElementToScreen(const IntVector2& position)
- bool IsInside(IntVector2 position, bool isScreen) - bool IsInside(IntVector2 position, bool isScreen)

Просмотреть файл

@ -134,6 +134,7 @@ class UIElement : public Serializable
void Remove(); void Remove();
unsigned FindChild(UIElement* element) const; unsigned FindChild(UIElement* element) const;
void SetParent(UIElement* parent, unsigned index = M_MAX_UNSIGNED); void SetParent(UIElement* parent, unsigned index = M_MAX_UNSIGNED);
void SetVar(ShortStringHash key, const Variant& value);
void SetInternal(bool enable); void SetInternal(bool enable);
void SetTraversalMode(TraversalMode traversalMode); void SetTraversalMode(TraversalMode traversalMode);
void SetElementEventSender(bool flag); void SetElementEventSender(bool flag);
@ -187,6 +188,8 @@ class UIElement : public Serializable
UIElement* GetParent() const; UIElement* GetParent() const;
UIElement* GetRoot() const; UIElement* GetRoot() const;
const Color& GetDerivedColor() const; const Color& GetDerivedColor() const;
const Variant& GetVar(ShortStringHash key) const;
const VariantMap& GetVars() const;
IntVector2 ScreenToElement(const IntVector2& screenPosition); IntVector2 ScreenToElement(const IntVector2& screenPosition);
IntVector2 ElementToScreen(const IntVector2& position); IntVector2 ElementToScreen(const IntVector2& position);
bool IsInside(IntVector2 position, bool isScreen); bool IsInside(IntVector2 position, bool isScreen);

Просмотреть файл

@ -26,9 +26,9 @@
/// This first example, maintaining tradition, prints a "Hello World" message. /// This first example, maintaining tradition, prints a "Hello World" message.
/// Furthermore it shows: /// Furthermore it shows:
/// - Using the Sample / Application classes, which initialize the Urho3D engine and run the main loop; /// - Using the Sample / Application classes, which initialize the Urho3D engine and run the main loop
/// - Adding a Text element to the graphical user interface; /// - Adding a Text element to the graphical user interface
/// - Subscribing to and handling of update events; /// - Subscribing to and handling of update events
class HelloWorld : public Sample class HelloWorld : public Sample
{ {
OBJECT(HelloWorld); OBJECT(HelloWorld);

Просмотреть файл

@ -33,9 +33,9 @@ class Window;
/// A simple 'HelloWorld' GUI created purely from code. /// A simple 'HelloWorld' GUI created purely from code.
/// This sample demonstrates: /// This sample demonstrates:
/// - Creation of controls and building a UI hierarchy; /// - Creation of controls and building a UI hierarchy
/// - Loading UI style from XML and applying it to controls; /// - Loading UI style from XML and applying it to controls
/// - Handling of global and per-control events; /// - Handling of global and per-control events
class HelloGUI : public Sample class HelloGUI : public Sample
{ {
OBJECT(HelloGUI); OBJECT(HelloGUI);

Просмотреть файл

@ -26,9 +26,9 @@
/// Moving sprites example. /// Moving sprites example.
/// This sample demonstrates: /// This sample demonstrates:
/// - Adding Sprite elements to the UI; /// - Adding Sprite elements to the UI
/// - Storing custom data (sprite velocity) inside UI elements; /// - Storing custom data (sprite velocity) inside UI elements
/// - Handling frame update events in which the sprites are moved; /// - Handling frame update events in which the sprites are moved
class Sprites : public Sample class Sprites : public Sample
{ {
// Enable type information. // Enable type information.

Просмотреть файл

@ -34,9 +34,9 @@ class Scene;
/// Static 3D scene example. /// Static 3D scene example.
/// This sample demonstrates: /// This sample demonstrates:
/// - Creating a 3D scene with static content; /// - Creating a 3D scene with static content
/// - Displaying the scene using the Renderer subsystem; /// - Displaying the scene using the Renderer subsystem
/// - Handling keyboard and mouse input to move a freelook camera; /// - Handling keyboard and mouse input to move a freelook camera
class StaticScene : public Sample class StaticScene : public Sample
{ {
OBJECT(StaticScene); OBJECT(StaticScene);

Просмотреть файл

@ -34,9 +34,9 @@ class Scene;
/// Animating 3D scene example. /// Animating 3D scene example.
/// This sample demonstrates: /// This sample demonstrates:
/// - Creating a 3D scene and using a custom component to animate the objects; /// - Creating a 3D scene and using a custom component to animate the objects
/// - Controlling scene ambience with the Zone component; /// - Controlling scene ambience with the Zone component
/// - Attaching a light to an object (the camera); /// - Attaching a light to an object (the camera)
class AnimatingScene : public Sample class AnimatingScene : public Sample
{ {
OBJECT(AnimatingScene); OBJECT(AnimatingScene);

Просмотреть файл

@ -35,10 +35,10 @@ class Scene;
/// Skeletal animation example. /// Skeletal animation example.
/// This sample demonstrates: /// This sample demonstrates:
/// - Populating a 3D scene with skeletally animated AnimatedModel components; /// - Populating a 3D scene with skeletally animated AnimatedModel components;
/// - Moving the animated models and advancing their animation using a custom component; /// - Moving the animated models and advancing their animation using a custom component
/// - Enabling a cascaded shadow map on a directional light, which allows high-quality shadows /// - Enabling a cascaded shadow map on a directional light, which allows high-quality shadows
/// over a large area (typically used in outdoor scenes for shadows cast by sunlight); /// over a large area (typically used in outdoor scenes for shadows cast by sunlight)
/// - Displaying renderer debug geometry; /// - Displaying renderer debug geometry
class SkeletalAnimation : public Sample class SkeletalAnimation : public Sample
{ {
OBJECT(SkeletalAnimation); OBJECT(SkeletalAnimation);

Просмотреть файл

@ -34,9 +34,9 @@ class Scene;
/// Billboard example. /// Billboard example.
/// This sample demonstrates: /// This sample demonstrates:
/// - Populating a 3D scene with billboard sets and several shadow casting spotlights; /// - Populating a 3D scene with billboard sets and several shadow casting spotlights
/// - Parenting scene nodes to allow more intuitive creation of groups of objects; /// - Parenting scene nodes to allow more intuitive creation of groups of objects
/// - Examining rendering performance with a somewhat large object and light count; /// - Examining rendering performance with a somewhat large object and light count
class Billboards : public Sample class Billboards : public Sample
{ {
OBJECT(Billboards); OBJECT(Billboards);

Просмотреть файл

@ -35,10 +35,10 @@ class Scene;
/// Decals example. /// Decals example.
/// This sample demonstrates: /// This sample demonstrates:
/// - Performing a raycast to the octree and adding a decal to the hit location; /// - Performing a raycast to the octree and adding a decal to the hit location
/// - Defining a Cursor UI element which stays inside the window and can be shown/hidden; /// - Defining a Cursor UI element which stays inside the window and can be shown/hidden
/// - Marking suitable (large) objects as occluders for occlusion culling; /// - Marking suitable (large) objects as occluders for occlusion culling
/// - Displaying renderer debug geometry to see the effect of occlusion; /// - Displaying renderer debug geometry to see the effect of occlusion
class Decals : public Sample class Decals : public Sample
{ {
OBJECT(Decals); OBJECT(Decals);

Просмотреть файл

@ -34,8 +34,8 @@ class Scene;
/// Multiple viewports example. /// Multiple viewports example.
/// This sample demonstrates: /// This sample demonstrates:
/// - Setting up two viewports with two separate cameras; /// - Setting up two viewports with two separate cameras
/// - Adding post processing effects to a viewport's render path and toggling them; /// - Adding post processing effects to a viewport's render path and toggling them
class MultipleViewports : public Sample class MultipleViewports : public Sample
{ {
OBJECT(MultipleViewports); OBJECT(MultipleViewports);

Просмотреть файл

@ -34,8 +34,8 @@ class Scene;
/// Render to texture example /// Render to texture example
/// This sample demonstrates: /// This sample demonstrates:
/// - Creating two 3D scenes and rendering the other into a texture; /// - Creating two 3D scenes and rendering the other into a texture
/// - Creating rendertarget textures and materials programmatically; /// - Creating rendertarget texture and material programmatically
class RenderToTexture : public Sample class RenderToTexture : public Sample
{ {
OBJECT(RenderToTexture); OBJECT(RenderToTexture);

Просмотреть файл

@ -34,10 +34,10 @@ class Scene;
/// Physics example. /// Physics example.
/// This sample demonstrates: /// This sample demonstrates:
/// - Creating both static and moving physics objects to a scene; /// - Creating both static and moving physics objects to a scene
/// - Displaying physics debug geometry; /// - Displaying physics debug geometry
/// - Using the Skybox component for setting up an unmoving sky; /// - Using the Skybox component for setting up an unmoving sky
/// - Saving a scene to a file and loading it to restore a previous state; /// - Saving a scene to a file and loading it to restore a previous state
class Physics : public Sample class Physics : public Sample
{ {
OBJECT(Physics); OBJECT(Physics);

Просмотреть файл

@ -34,9 +34,9 @@ class Scene;
/// Physics stress test example. /// Physics stress test example.
/// This sample demonstrates: /// This sample demonstrates:
/// - Physics and rendering performance with a high (1000) moving object count; /// - Physics and rendering performance with a high (1000) moving object count
/// - Using triangle meshes for collision; /// - Using triangle meshes for collision
/// - Optimizing physics simulation by leaving out collision event signaling; /// - Optimizing physics simulation by leaving out collision event signaling
class PhysicsStressTest : public Sample class PhysicsStressTest : public Sample
{ {
OBJECT(PhysicsStressTest); OBJECT(PhysicsStressTest);

Просмотреть файл

@ -34,9 +34,9 @@ class Scene;
/// Ragdoll example. /// Ragdoll example.
/// This sample demonstrates: /// This sample demonstrates:
/// - Detecting physics collisions; /// - Detecting physics collisions
/// - Moving an AnimatedModel's bones with physics and connecting them with constraints; /// - Moving an AnimatedModel's bones with physics and connecting them with constraints
/// - Using rolling friction to stop rolling objects from moving infinitely; /// - Using rolling friction to stop rolling objects from moving infinitely
class Ragdolls : public Sample class Ragdolls : public Sample
{ {
OBJECT(Ragdolls); OBJECT(Ragdolls);

Просмотреть файл

@ -35,8 +35,8 @@ class Slider;
/// Sound effects example /// Sound effects example
/// This sample demonstrates: /// This sample demonstrates:
/// - Playing sound effects and music; /// - Playing sound effects and music
/// - Controlling sound and music master volume; /// - Controlling sound and music master volume
class SoundEffects : public Sample class SoundEffects : public Sample
{ {
OBJECT(SoundEffects); OBJECT(SoundEffects);

Просмотреть файл

@ -35,10 +35,10 @@ class Scene;
/// Navigation example. /// Navigation example.
/// This sample demonstrates: /// This sample demonstrates:
/// - Generating a navigation mesh into the scene; /// - Generating a navigation mesh into the scene
/// - Performing path queries to the navigation mesh; /// - Performing path queries to the navigation mesh
/// - Rebuilding the navigation mesh partially when adding or removing objects; /// - Rebuilding the navigation mesh partially when adding or removing objects
/// - Visualizing custom debug geometry; /// - Visualizing custom debug geometry
class Navigation : public Sample class Navigation : public Sample
{ {
OBJECT(Navigation); OBJECT(Navigation);

Просмотреть файл

@ -36,8 +36,8 @@ class UIElement;
/// Chat example /// Chat example
/// This sample demonstrates: /// This sample demonstrates:
/// - Starting up a network server or connecting to it; /// - Starting up a network server or connecting to it
/// - Implementing simple chat functionality with network messages; /// - Implementing simple chat functionality with network messages
class Chat : public Sample class Chat : public Sample
{ {
OBJECT(Chat); OBJECT(Chat);

Просмотреть файл

@ -37,10 +37,10 @@ class UIElement;
/// Scene network replication example. /// Scene network replication example.
/// This sample demonstrates: /// This sample demonstrates:
/// - Creating a scene in which network clients can join; /// - Creating a scene in which network clients can join
/// - Giving each client an object to control and sending the controls from the clients to the server, /// - Giving each client an object to control and sending the controls from the clients to the server
/// where the authoritative simulation happens; /// where the authoritative simulation happens
/// - Controlling a physics object's movement by applying forces; /// - Controlling a physics object's movement by applying forces
class SceneReplication : public Sample class SceneReplication : public Sample
{ {
OBJECT(SceneReplication); OBJECT(SceneReplication);

Просмотреть файл

@ -36,11 +36,10 @@ class Character;
/// Moving character example. /// Moving character example.
/// This sample demonstrates: /// This sample demonstrates:
/// - Controlling a humanoid character through physics; /// - Controlling a humanoid character through physics
/// - Driving animations using the AnimationController component; /// - Driving animations using the AnimationController component
/// - Implementing 1st and 3rd person cameras, using raycasts to avoid the 3rd person camera /// - Implementing 1st and 3rd person cameras, using raycasts to avoid the 3rd person camera clipping into scenery
/// clipping into scenery; /// - Defining attributes of a custom component so that it can be saved and loaded
/// - Defining attributes of a custom component so that it can be saved and loaded;
class CharacterDemo : public Sample class CharacterDemo : public Sample
{ {
OBJECT(CharacterDemo); OBJECT(CharacterDemo);

Просмотреть файл

@ -36,9 +36,9 @@ class Vehicle;
/// Vehicle example. /// Vehicle example.
/// This sample demonstrates: /// This sample demonstrates:
/// - Creating a heightmap terrain with collision; /// - Creating a heightmap terrain with collision
/// - Constructing a physical vehicle with rigid bodies for the hull and the wheels, joined with constraints; /// - Constructing a physical vehicle with rigid bodies for the hull and the wheels, joined with constraints
/// - Defining attributes (including node and component references) of a custom component so that it can be saved and loaded; /// - Defining attributes (including node and component references) of a custom component so that it can be saved and loaded
class VehicleDemo : public Sample class VehicleDemo : public Sample
{ {
OBJECT(VehicleDemo); OBJECT(VehicleDemo);

Просмотреть файл

@ -34,11 +34,11 @@ class Scene;
/// Huge object count example. /// Huge object count example.
/// This sample demonstrates: /// This sample demonstrates:
/// - Creating a scene with 250 x 250 simple objects; /// - Creating a scene with 250 x 250 simple objects
/// - Competing with http://yosoygames.com.ar/wp/2013/07/ogre-2-0-is-up-to-3x-faster/ :) /// - Competing with http://yosoygames.com.ar/wp/2013/07/ogre-2-0-is-up-to-3x-faster/ :)
/// - Allowing examination of performance hotspots in the rendering code; /// - Allowing examination of performance hotspots in the rendering code
/// - Using the profiler to measure the time taken to animate the scene; /// - Using the profiler to measure the time taken to animate the scene
/// - Optionally speeding up rendering by grouping the objects using StaticModelGroup component; /// - Optionally speeding up rendering by grouping objects with the StaticModelGroup component
class HugeObjectCount : public Sample class HugeObjectCount : public Sample
{ {
OBJECT(HugeObjectCount); OBJECT(HugeObjectCount);