Urho 1.0.0.0 Urho.UrhoObject Urho3D engine. Creates the other subsystems. Before a Urho3D application can enter its main loop, the Engine subsystem object must be created and initialized by calling the  method. 

Main Loop Iteration

The main loop iteration (also called a frame) is driven by the Engine. In contrast it is the program's (for example Urho3DPlayer) responsibility to continuously loop this iteration by calling . This function calls in turn the  subsystem's  and  functions, and sends various update events in between.  There are a number of events that are raised, these events can be monitored by calling one of the various SubscribeToXxx methods in the UrhoObject base class. The event order is: : signals the beginning of the new frame.  and  react to this to check for operating system window messages and arrived network packets. : application-wide logic update event. By default each update-enabled  reacts to this and triggers the scene update (more on this below). : application-wide logic post-update event. The  subsystem updates its logic here.  updates its viewports here to prepare for rendering, and the  generates render commands necessary to render the user interface. : by default nothing hooks to this. This can be used to implement logic that requires the rendering views to be up-to-date, for example to do accurate raycasts. Scenes may not be modified at this point; especially scene objects may not be deleted or crashes may occur. EndFrame: signals the end of the frame. Before this, rendering the frame and measuring the next frame's timestep will have occurred. The update of each  causes further events to be sent: SceneUpdate: variable timestep scene update. This is a good place to implement any scene logic that does not need to happen at a fixed step. SceneSubsystemUpdate: update scene-wide subsystems. Currently only the  component listens to this, which causes it to step the physics simulation and send the following two events for each simulation step: PhysicsPreStep: called before the simulation iteration. Happens at a fixed rate (the physics FPS). If fixed timestep logic updates are needed, this is a good event to listen to. PhysicsPostStep: called after the simulation iteration. Happens at the same rate as PhysicsPreStep. SmoothingUpdate: update  components in network client scenes. ScenePostUpdate: variable timestep scene post-update.   and  update themselves as a response to this event. Variable timestep logic updates are preferable to fixed timestep, because they are only executed once per frame. In contrast, if the rendering framerate is low, several physics simulation steps will be performed on each frame to keep up the apparent passage of time, and if this also causes a lot of logic code to be executed for each step, the program may bog down further if the CPU can not handle the load. Note that the Engine’s minimum FPS, by default 10, sets a hard cap for the timestep to prevent spiraling down to a complete halt; if exceeded, animation and physics will instead appear to slow down.

Main Loop and the Application Activation State

The application window's state (has input focus, minimized or not) can be queried from the  subsystem. It can also effect the main loop in the following ways: Rendering is always skipped when the window is minimized. To avoid spinning the CPU and GPU unnecessarily, it is possible to define a smaller maximum FPS when no input focus. See . It is also possible to automatically pause update events and audio when the window is minimized. Use  to control this behaviour. By default it is not enabled on desktop, and enabled on mobile devices (Android and iOS.) For singleplayer games this is recommended to avoid unwanted progression while away from the program. However in a multiplayer game this should not be used, as the missing scene updates would likely desync the client with the server. On mobile devices the window becoming minimized can mean that it will never become maximized again, in case the OS decides it needs to free memory and kills your program. Therefore you should listen for the InputFocus event from the  subsystem and immediately save your program state as applicable if the program loses input focus or is minimized. On mobile devices it is also unsafe to access or create any graphics resources while the window is minimized (as the graphics context may be destroyed during this time); doing so can crash the program. It is recommended to leave the pause-minimized feature on to ensure you do not have to check for this in your update code. Note that on iOS calling  is a no-op as there is no officially sanctioned way to manually exit your program. On Android it will cause the activity to manually exit.

Application Framework

The T:Urho.Application class provides a minimal framework to run your game with a main loop and a handful of methods that you can override to prepare and run your game.
Constructor 1.0.0.0 Preserve Constructs a new instance of Urho.Engine which is tied to the . Constructor 1.0.0.0 Preserve Pointer to the raw unmanaged Urho object. Constructs a new instance of Urho.Engine, given a raw pointer to an unmanaged object This creates a new managed wrapper for the type using the raw pointer to an unmanaged object. Objects that are created in this fashion get registered with the UrhoSharp runtime. This is intended to be used by the UrhoSharp runtime, and is not intended to be used by users. Constructor 1.0.0.0 Preserve The context that this object will be attached to. Constructs a new instance of Urho.Engine linked to a specific . Constructor 1.0.0.0 Preserve Pass UrhoObjectFlag.Empty. Empty constructor, chain to this constructor when you provide your own constructor that sets the handle field. This constructor should be invoked by your code if you provide your own constructor that sets the handle field. This essentially circumvents the default path that creates a new object and sets the handle and does not call RegisterObject on the target, you must do this on your own constructor. You would typically chain to this constructor from your own, and then set the handle to the unmanaged object from your code, and then register your object. Method 1.0.0.0 System.Int32 Get the timestep for the next frame and sleep for frame limiting if necessary. To be added. To be added. Property 1.0.0.0 System.Boolean Return whether to exit automatically on exit request. Or Set whether to exit automatically on exit request (window close button.) To be added. To be added. Method 1.0.0.0 Urho.UrhoConsole Create the console and return it. May return null if engine configuration does not allow creation (headless mode.) To be added. To be added. Method 1.0.0.0 Urho.DebugHud Create the debug hud. To be added. To be added. Method 1.0.0.0 System.Void Dump information of all memory allocations to the log. Supported in MSVC debug mode only. To be added. Method 1.0.0.0 System.Void Dump profiling information to the log. To be added. Method 1.0.0.0 System.Void To be added. Dump information of all resources to the log. To be added. Property 1.0.0.0 System.Boolean Return whether exit has been requested. To be added. To be added. Property 1.0.0.0 System.Boolean Return whether the engine has been created in headless mode. To be added. To be added. Property 1.0.0.0 System.Boolean Return whether engine has been initialized. To be added. To be added. Property 1.0.0.0 System.Int32 Return the maximum frames per second. Or Set maximum frames per second. The engine will sleep if FPS is higher than this. To be added. To be added. Property 1.0.0.0 System.Int32 Return the maximum frames per second when the application does not have input focus. Or Set maximum frames per second when the application does not have input focus. To be added. To be added. Property 1.0.0.0 System.Int32 Return the minimum frames per second. Or Set minimum frames per second. If FPS goes lower than this, time will appear to slow down. To be added. To be added. Property 1.0.0.0 System.Single Get timestep of the next frame. Updated by ApplyFrameLimit(). Or Override timestep of the next frame. Should be called in between RunFrame() calls. To be added. To be added. Property 1.0.0.0 System.Boolean Return whether to pause update events and audio when minimized. Or Set whether to pause update events and audio when minimized. To be added. To be added. Event 1.0.0.0 System.Action<Urho.PostRenderUpdateEventArgs> Invoked after the  event has been raised. This can be used to implement logic that requires the rendering views to be up-to-date, for example to do accurate raycasts.  Scenes may not be modified at this point; especially scene objects may not be deleted or crashes may occur. Event 1.0.0.0 System.Action<Urho.PostUpdateEventArgs> Event raised after the  event is from the  method. The  subsystem updates its logic here. Method 1.0.0.0 System.Void Render after frame update. To be added. Event 1.0.0.0 System.Action<Urho.RenderUpdateEventArgs> Event raised after  event in preparation for rendering.  updates its viewports here to prepare for rendering, and the  generates render commands necessary to render the user interface. Method 1.0.0.0 System.Int32 Run one frame. To be added. To be added. Method 1.0.0.0 System.Obsolete("SubscribeTo API may lead to unxpected behaviour and will be removed in a future version. Use C# event '.PostRenderUpdate += ...' instead.") Urho.Subscription The handler to invoke when this event is raised. Subscribes to the PostRenderUpdate event raised by the Engine. Returns an Urho.Subscription that can be used to cancel the subscription. This method will override any prior subscription, including those assigned to on event handlers. This has the advantage that it does a straight connection and returns a handle that is easy to unsubscribe from. For a more event-like approach, use the event. Method 1.0.0.0 System.Obsolete("SubscribeTo API may lead to unxpected behaviour and will be removed in a future version. Use C# event '.PostUpdate += ...' instead.") Urho.Subscription The handler to invoke when this event is raised. Subscribes to the PostUpdate event raised by the Engine. Returns an Urho.Subscription that can be used to cancel the subscription. This method will override any prior subscription, including those assigned to on event handlers. This has the advantage that it does a straight connection and returns a handle that is easy to unsubscribe from. For a more event-like approach, use the event. Method 1.0.0.0 System.Obsolete("SubscribeTo API may lead to unxpected behaviour and will be removed in a future version. Use C# event '.RenderUpdate += ...' instead.") Urho.Subscription The handler to invoke when this event is raised. Subscribes to the RenderUpdate event raised by the Engine. Returns an Urho.Subscription that can be used to cancel the subscription. This method will override any prior subscription, including those assigned to on event handlers. This has the advantage that it does a straight connection and returns a handle that is easy to unsubscribe from. For a more event-like approach, use the event. Property 1.0.0.0 System.Int32 Return how many frames to average for timestep smoothing. Or Set how many frames to average for timestep smoothing. Default is 2. 1 disables smoothing. To be added. To be added. Property 1.0.0.0 Urho.StringHash Urho's type system type. StringHash representing the type for this C# type. This returns the Urho's type and is surfaced for low-level Urho code. Property 1.0.0.0 System.String Urho's low-level type name. Stringified low-level type name. Property 1.0.0.0 System.String Urho's low-level type name, accessible as a static method. Stringified low-level type name. Property 1.0.0.0 Preserve Urho.StringHash Urho's low-level type, accessible as a static method. This returns the Urho's type and is surface for the low-level Urho code. Event 1.0.0.0 System.Action<Urho.UpdateEventArgs> Application-wide logic update event, the first called from the  method. By default each update-enabled  reacts to this and triggers the scene update Method 1.0.0.0 System.Void Sends the frame update events. This method is usually invoked from the  method and it rasises the  and  events in that order.