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"
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.
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) {}
29  bool dragging = false;
30  std::optional<Point> prev_mouse_pos;
33  PlaygroundPoint(const PlaygroundPoint&) = delete;
36 };
37 
39 
40 std::tuple<Point, Point> DrawPlaygroundLine(PlaygroundPoint& point_a,
41  PlaygroundPoint& point_b);
42 } // namespace impeller
43 #endif // FLUTTER_IMPELLER_PLAYGROUND_WIDGETS_H_
float Scalar
Definition: scalar.h:19
Point DrawPlaygroundPoint(PlaygroundPoint &point)
Definition: widgets.cc:9
std::tuple< Point, Point > DrawPlaygroundLine(PlaygroundPoint &point_a, PlaygroundPoint &point_b)
Definition: widgets.cc:50
PlaygroundPoint & operator=(const PlaygroundPoint &)=delete
PlaygroundPoint(const PlaygroundPoint &)=delete
PlaygroundPoint(Point default_position, Scalar p_radius, Color p_color)
Definition: widgets.h:22
PlaygroundPoint(PlaygroundPoint &&)=delete
std::optional< Point > prev_mouse_pos
Definition: widgets.h:30