#include <xtd/drawing/basic_colors>
#include <xtd/forms/animation>
#include <xtd/forms/application>
#include <xtd/forms/debug_form>
namespace animation_example {
class form1 :
public form {
public:
form1() {
client_size({360, 280});
controls().push_back(fish_animation);
text(
"Animation example");
fish_animation.frames_per_second(60);
fish_animation.start();
fish_animation.click += event_handler {*this, &form1::on_fish_animation_click};
fish_animation.paint += paint_event_handler {*this, &form1::on_fish_animation_paint};
fish_animation.updated += animation_updated_event_handler {*this, &form1::on_fish_animation_updated};
}
private:
void on_fish_animation_click(
object& sender,
const event_args&
e) {
fish_animation.running(!fish_animation.running());
}
e.graphics().clear(fish_animation.back_color());
static const auto fish_length = 16;
for (
auto i = 0;
i < fish_length; ++
i) {
auto radius = 100 + 10 * sin(
as<float>(fish_animation.frame_counter()) * 0.1f +
as<float>(
i) * 0.5f);
}
e.graphics().draw_lines(
pen(fish_animation.fore_color(), 4), points);
}
debug::write_line(string::format(
"frame_counter={}, elapsed={}",
e.frame_counter(),
e.elapsed()));
}
};
}
auto main() -> int {
}
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
Definition list.hpp:80
static void write_line()
Writes a line terminator to the trace listeners in the listeners collection.
Definition debug.hpp:361
static xtd::drawing::color black() noexcept
A system-defined color object.
static xtd::drawing::color lime() noexcept
A system-defined color object.
static xtd::drawing::color teal() noexcept
A system-defined color object.
static xtd::drawing::color aqua() noexcept
A system-defined color object.
Defines an object used to draw lines and curves. This class cannot be inherited.
Definition pen.hpp:32
Defines a xtd::drawing::brush of a single color. Brushes are used to fill graphics shapes,...
Definition solid_brush.hpp:29
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.hpp:18
type_t as(any_object &o)
Casts a type into another type.
Definition __as_any_object.hpp:59
@ i
The I key.
Definition console_key.hpp:104
@ e
The E key.
Definition console_key.hpp:96
The xtd::collections::generic namespace contains interfaces and classes that define generic collectio...
Definition comparer.hpp:16
The xtd::diagnostics namespace provides classes that allow you to interact with system processes,...
Definition assert_dialog_result.hpp:10
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:10
Contains classes that represent ASCII and Unicode character encodings; abstract base classes for conv...
Definition basic_string_builder.hpp:16
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Represents an ordered pair of floating-point x- and y-coordinates that defines a point in a two-dimen...
Definition point_f.hpp:35
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition point.hpp:54
int32 y
Gets or sets the y-coordinate of this xtd::drawing::point.
Definition point.hpp:198
int32 x
Gets or sets the x-coordinate of this xtd::drawing::point.
Definition point.hpp:175