| Flutter Impeller |

widgets.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef FLUTTER_IMPELLER_PLAYGROUND_WIDGETS_H_
6 #define FLUTTER_IMPELLER_PLAYGROUND_WIDGETS_H_
7
8 #include <optional>
9 #include <tuple>
10
11 #include "impeller/base/strings.h"
12 #include "impeller/geometry/color.h"
13 #include "impeller/geometry/point.h"
14 #include "third_party/imgui/imgui.h"
15
16 namespace impeller {
17 // A point on the screen that can be dragged.
18 //
19 // Instances of this class should be preserved between frames, such as being
20 // static variables.
21 struct PlaygroundPoint {
22 PlaygroundPoint(Point default_position, Scalar p_radius, Color p_color)
23 : position(default_position),
24 reset_position(default_position),
25 radius(p_radius),
26 color(p_color) {}
27 Point position;
28 Point reset_position;
29 bool dragging = false;
30 std::optional<Point> prev_mouse_pos;
31 Scalar radius;
32 Color color;
33 PlaygroundPoint(const PlaygroundPoint&) = delete;
34 PlaygroundPoint(PlaygroundPoint&&) = delete;
35 PlaygroundPoint& operator=(const PlaygroundPoint&) = delete;
36 };
37
38 Point DrawPlaygroundPoint(PlaygroundPoint& point);
39
40 std::tuple<Point, Point> DrawPlaygroundLine(PlaygroundPoint& point_a,
41 PlaygroundPoint& point_b);
42 } // namespace impeller
43 #endif // FLUTTER_IMPELLER_PLAYGROUND_WIDGETS_H_
color.h
impeller
Definition: allocation.cc:12
impeller::Scalar
float Scalar
Definition: scalar.h:19
impeller::DrawPlaygroundPoint
Point DrawPlaygroundPoint(PlaygroundPoint &point)
Definition: widgets.cc:9
impeller::DrawPlaygroundLine
std::tuple< Point, Point > DrawPlaygroundLine(PlaygroundPoint &point_a, PlaygroundPoint &point_b)
Definition: widgets.cc:50
point.h
strings.h
impeller::Color
Definition: color.h:124
impeller::PlaygroundPoint
Definition: widgets.h:21
impeller::PlaygroundPoint::operator=
PlaygroundPoint & operator=(const PlaygroundPoint &)=delete
impeller::PlaygroundPoint::PlaygroundPoint
PlaygroundPoint(const PlaygroundPoint &)=delete
impeller::PlaygroundPoint::color
Color color
Definition: widgets.h:32
impeller::PlaygroundPoint::reset_position
Point reset_position
Definition: widgets.h:28
impeller::PlaygroundPoint::PlaygroundPoint
PlaygroundPoint(Point default_position, Scalar p_radius, Color p_color)
Definition: widgets.h:22
impeller::PlaygroundPoint::position
Point position
Definition: widgets.h:27
impeller::PlaygroundPoint::PlaygroundPoint
PlaygroundPoint(PlaygroundPoint &&)=delete
impeller::PlaygroundPoint::radius
Scalar radius
Definition: widgets.h:31
impeller::PlaygroundPoint::prev_mouse_pos
std::optional< Point > prev_mouse_pos
Definition: widgets.h:30
impeller::PlaygroundPoint::dragging
bool dragging
Definition: widgets.h:29
impeller::TPoint< Scalar >