xtd - Reference Guide  0.2.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Go to the documentation of this file.
1 #pragma once
7 #include "control.h"
8 #include "timer.h"
11 namespace xtd {
13  namespace forms {
23  class animation : public xtd::forms::control {
24  public:
26  animation();
28  drawing::size default_size() const override {return {200, 100};}
32  virtual int64_t elapsed_milliseconds() const;
36  virtual int32_t frame_counter() const;
40  virtual int32_t frames_per_second() const;
43  virtual animation& frames_per_second(int32_t value);
47  virtual bool is_running() const;
50  void start();
53  void stop();
60  protected:
65  private:
66  void on_frames_timer_tick(object& timer, const xtd::event_args& e);
68  int32_t frame_counter_ = 0;
69  int32_t frames_per_second_ = 10;
70  xtd::diagnostics::stopwatch stopwatch_;
71  xtd::forms::timer frames_timer_;
72  };
73  }
74 }
Initialize a new instance of animation class.
void stop()
Stops animation of the animation control.
drawing::size default_size() const override
Gets the default size of the control.
Definition: animation.h:28
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition: event_args.h:18
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
Stores an ordered pair of integers, which specify a height and width.
Definition: size.h:25
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Contains xtd::diagnostics::stopwatch class.
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::timer component.
Provides a set of methods and properties that you can use to accurately measure elapsed time...
Definition: stopwatch.h:27
Represents an event.
Definition: event.h:21
virtual int64_t elapsed_milliseconds() const
Gets the elapsed time for the current frame, in milliseconds.
Represents an animation control.
Definition: animation.h:23
virtual int32_t frame_counter() const
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.h:68
Provides data for the animation update event.
Definition: animation_update_event_args.h:17
virtual int32_t frames_per_second() const
Gets the number of frame per second.
Contains xtd::forms::control control.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
void start()
Starts animation of the animation control.
Contains xtd::forms::key_event_handler event handler.
virtual bool is_running() const
Returns if the animation is started.