Euphoria
canvaslogic.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "base/vec2.h"
4 #include "base/range.h"
5 
6 namespace eu::core
7 {
8  struct CanvasLogic
9  {
10  // canvas view
11  vec2f scroll = vec2f {0, 0};
12  float scale = 1;
13 
14  // "config"
16 
17  void
18  pan(const vec2f& p);
19 
20  void
21  zoom(const vec2f& mouse, float zoom);
22 
23  [[nodiscard]] vec2f
24  from_screen_to_world(const vec2f& p) const;
25 
26  [[nodiscard]] vec2f
27  from_world_to_screen(const vec2f& p) const;
28  };
29 }
Range< T > make_range(T min, T max)
Definition: range.h:39
void pan(const vec2f &p)
Definition: canvaslogic.cc:7
vec2f from_world_to_screen(const vec2f &p) const
Definition: canvaslogic.cc:38
void zoom(const vec2f &mouse, float zoom)
Definition: canvaslogic.cc:13
Range< float > scale_range
Definition: canvaslogic.h:15
vec2f from_screen_to_world(const vec2f &p) const
Definition: canvaslogic.cc:44
Definition: vec2.h:33