supertux
src
editor
scroller_widget.hpp
1
// SuperTux
2
// Copyright (C) 2016 Hume2 <teratux.mail@gmail.com>
3
//
4
// This program is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// This program is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17
#ifndef HEADER_SUPERTUX_EDITOR_SCROLLER_WIDGET_HPP
18
#define HEADER_SUPERTUX_EDITOR_SCROLLER_WIDGET_HPP
19
20
#include "editor/widget.hpp"
21
#include "math/vector.hpp"
22
23
class
Editor
;
24
class
DrawingContext
;
25
union
SDL_Event;
26
29
class
EditorScrollerWidget
final :
public
Widget
30
{
31
public
:
32
static
bool
rendered;
33
34
public
:
35
EditorScrollerWidget
(
Editor
& editor);
36
37
virtual
void
draw(
DrawingContext
& context)
override
;
38
virtual
void
update(
float
dt_sec)
override
;
39
40
virtual
bool
on_mouse_button_up(
const
SDL_MouseButtonEvent& button)
override
;
41
virtual
bool
on_mouse_button_down(
const
SDL_MouseButtonEvent& button)
override
;
42
virtual
bool
on_mouse_motion(
const
SDL_MouseMotionEvent& motion)
override
;
43
virtual
bool
on_key_down(
const
SDL_KeyboardEvent& key)
override
;
44
45
public
:
46
void
draw_arrow(
DrawingContext
&,
const
Vector
& pos);
47
bool
can_scroll()
const
;
48
49
private
:
50
Editor
& m_editor;
51
bool
m_scrolling;
52
Vector
m_scrolling_vec;
53
Vector
m_mouse_pos;
54
55
private
:
56
EditorScrollerWidget
(
const
EditorScrollerWidget
&) =
delete
;
57
EditorScrollerWidget
& operator=(
const
EditorScrollerWidget
&) =
delete
;
58
};
59
60
#endif
61
62
/* EOF */
Vector
Simple two dimensional vector.
Definition:
vector.hpp:24
Editor
Definition:
editor.hpp:45
Widget
Definition:
widget.hpp:24
EditorScrollerWidget
A little virtual joystick that can be used to scroll around the level with the mouse.
Definition:
scroller_widget.hpp:29
DrawingContext
This class provides functions for drawing things on screen.
Definition:
drawing_context.hpp:42
Generated by
1.8.12