xtd - Reference Guide  0.1.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
animation.h
Go to the documentation of this file.
1
4#pragma once
7#include "control.h"
8#include "timer.h"
9
11namespace xtd {
13 namespace forms {
24 public:
27
28 drawing::size default_size() const override {return {200, 100};}
29
32 virtual int64_t elapsed_milliseconds() const;
33
36 virtual int32_t frame_counter() const;
37
40 virtual int32_t frames_per_second() const;
43 virtual animation& frames_per_second(int32_t value);
44
47 virtual bool is_running() const;
48
50 void start();
51
53 void stop();
54
59
60 protected:
64
65 private:
66 void on_frames_timer_tick(object& timer, const xtd::event_args& e);
67
68 int32_t frame_counter_ = 0;
69 int32_t frames_per_second_ = 10;
71 xtd::forms::timer frames_timer_;
72 };
73 }
74}
75
Contains xtd::forms::key_event_handler event handler.
Provides a set of methods and properties that you can use to accurately measure elapsed time.
Definition: stopwatch.h:27
Stores an ordered pair of integers, which specify a height and width.
Definition: size.h:25
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition: event_args.h:18
Represents an event.
Definition: event.h:21
Provides data for the animation update event.
Definition: animation_update_event_args.h:17
Represents an animation control.
Definition: animation.h:23
virtual int32_t frame_counter() const
Gets the current frame counter value.
virtual animation & frames_per_second(int32_t value)
Sets the number of frame per second. @para value The number if frame per seconds. The default is 10.
virtual int32_t frames_per_second() const
Gets the number of frame per second.
virtual bool is_running() const
Returns if the animation is started.
void start()
Starts animation of the animation control.
void stop()
Stops animation of the animation control.
virtual int64_t elapsed_milliseconds() const
Gets the elapsed time for the current frame, in milliseconds.
animation()
Initialize a new instance of animation class.
drawing::size default_size() const override
Gets the default size of the control.
Definition: animation.h:28
virtual void on_updated(const xtd::forms::animation_updated_event_args &e)
Raises the updated event.
Defines the base class for controls, which are components with visual representation.
Definition: control.h:67
Implements a timer that raises an event at user-defined intervals. This timer is optimized for use in...
Definition: timer.h:29
Contains xtd::forms::control control.
xtd::event< animation, animation_updated_event_handler > updated
Occurs when the specified interval specified by xtd::animation::frames_per_seconds has elapsed and th...
Definition: animation.h:58
@ e
The E key.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17
Contains xtd::diagnostics::stopwatch class.
Contains xtd::forms::timer component.