xtd 0.2.0
Loading...
Searching...
No Matches
animation.hpp
Go to the documentation of this file.
1
4#pragma once
6#include "control.hpp"
7#include "timer.hpp"
8#include <xtd/diagnostics/stopwatch>
9
11namespace xtd {
13 namespace forms {
28 struct data;
29
30 public:
32
37
39 animation(animation&& rhs);
40 animation(const animation&) = default;
41 animation& operator =(const animation&) = default;
43
45
49 virtual time_span elapsed() const noexcept;
50
53 virtual int64 elapsed_milliseconds() const noexcept;
54
57 virtual int64 elapsed_nanoseconds() const noexcept;
58
61 virtual int64 elapsed_ticks() const noexcept;
62
65 virtual uint32 frame_counter() const noexcept;
66
69 virtual uint32 frames_per_second() const noexcept;
73
76 virtual bool running() const noexcept;
77
80 virtual animation& running(bool value);
82
84
87 void start();
88
90 void stop();
92
94
98 static animation create();
102 static animation create(const drawing::point& location);
107 static animation create(const drawing::point& location, const drawing::size& size);
113 static animation create(const drawing::point& location, const drawing::size& size, const xtd::string& name);
122 static animation create(uint32 frames_per_second, const drawing::point& location);
128 static animation create(uint32 frames_per_second, const drawing::point& location, const drawing::size& size);
135 static animation create(uint32 frames_per_second, const drawing::point& location, const drawing::size& size, const xtd::string& name);
144 static animation create(const control& parent, const drawing::point& location);
150 static animation create(const control& parent, const drawing::point& location, const drawing::size& size);
157 static animation create(const control& parent, const drawing::point& location, const drawing::size& size, const xtd::string& name);
168 static animation create(const control& parent, uint32 frames_per_second, const drawing::point& location);
175 static animation create(const control& parent, uint32 frames_per_second, const drawing::point& location, const drawing::size& size);
183 static animation create(const control& parent, uint32 frames_per_second, const drawing::point& location, const drawing::size& size, const xtd::string& name);
185
187
194
195 protected:
197
199 drawing::size default_size() const noexcept override;
201
203
209 xtd::uptr<xtd::object> clone() const override;
210
215
216 private:
217 void on_frames_timer_tick(object& timer, const xtd::event_args& e);
218
219 xtd::sptr<data> data_;
220 };
221 }
222}
Contains xtd::forms::key_event_handler event handler.
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.hpp:18
Represents an event.
Definition event.hpp:21
Provides data for the animation update event.
Definition animation_update_event_args.hpp:22
Represents an animation control.
Definition animation.hpp:27
virtual time_span elapsed() const noexcept
Gets the elapsed time for the current frame, in nanoseconds.
static animation create()
A factory to create an xtd::forms::animation.
virtual int64 elapsed_milliseconds() const noexcept
Gets the elapsed time for the current frame, in milliseconds.
virtual int64 elapsed_nanoseconds() const noexcept
Gets the elapsed time for the current frame, in nanoseconds.
xtd::uptr< xtd::object > clone() const override
Creates a new object that is a copy of the current instance.
virtual int64 elapsed_ticks() const noexcept
Gets the elapsed time for the current frame, in ticks.
void start()
Starts animation of the animation control.
void stop()
Stops animation of the animation control.
animation()
Initialize a new instance of xtd::forms::animation class.
xtd::event< animation, animation_updated_event_handler > updated
Occurs when the specified interval specified by xtd::forms::animation::frames_per_second has elapsed ...
Definition animation.hpp:192
virtual uint32 frames_per_second() const noexcept
Gets the number of frame per second.
drawing::size default_size() const noexcept override
Gets the default size of the control.
virtual bool running() const noexcept
Gets a valiue that indicates if the animation is running.
virtual uint32 frame_counter() const noexcept
Gets the current frame counter value.
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.hpp:81
virtual drawing::point location() const noexcept
Gets the coordinates of the upper-left corner of the control relative to the upper-left corner of its...
virtual const xtd::string & name() const noexcept
Gets the name of the control.
virtual std::optional< control_ref > parent() const noexcept
Gets the parent container of the control.
Implements a timer that raises an event at user-defined intervals. This timer is optimized for use in...
Definition timer.hpp:38
xtd::delegate< void(xtd::object &, const xtd::forms::animation_updated_event_args &)> animation_updated_event_handler
Represents the method that will handle the update of xtd::forms::animation.
Definition animation_update_event_handler.hpp:24
int64_t int64
Represents a 64-bit signed integer.
Definition int64.hpp:23
uint32_t uint32
Represents a 32-bit unsigned integer.
Definition uint32.hpp:23
std::unique_ptr< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.hpp:25
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
std::shared_ptr< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.hpp:25
@ e
The E key.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.hpp:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
Represents a time interval.
Definition time_span.hpp:29
Contains xtd::forms::style_sheets::control class.
Contains xtd::forms::timer component.