-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvd_tile_view.e
67 lines (50 loc) · 1.54 KB
/
vd_tile_view.e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
note
description: "An object that represents a stone-tile, which is made of two hexes. Orginally authored by Emanuele Rudel, adjusted by Christian Estler"
class
VD_TILE_VIEW
inherit
EV_MODEL_MOVE_HANDLE
create
list_make,
make_with_hex
feature {NONE} -- Implementation
make_with_hex (a_first_hex, a_second_hex: EV_PIXMAP)
local
l_hex: EV_MODEL_PICTURE
do
default_create
create l_hex.make_with_pixmap (a_first_hex)
extend (l_hex)
l_hex.set_point_position (0, 0)
create l_hex.make_with_pixmap (a_second_hex)
extend (l_hex)
l_hex.set_point_position (0, 27)
enable_move
enable_events_sended_to_group
end
feature {NONE} -- Move features
on_pointer_motion_on_world (ax, ay: INTEGER; x_tilt, y_tilt, pressure: DOUBLE; a_screen_x, a_screen_y: INTEGER)
do
if has_capture then
print ("Dragged tile view: (" + ax.out + "," + ay.out +")%N")
set_point_position (ax, ay)
end
end
on_pointer_button_press_on_world (ax, ay, button: INTEGER; x_tilt, y_tilt, pressure: DOUBLE; a_screen_x, a_screen_y: INTEGER)
do
enable_capture
end
on_pointer_button_release_on_world (ax, ay, button: INTEGER; x_tilt, y_tilt, pressure: DOUBLE; a_screen_x, a_screen_y: INTEGER)
do
if has_capture then
disable_capture
end
end
feature -- Status setting
enable_move
do
pointer_motion_actions.extend (agent on_pointer_motion_on_world)
pointer_button_press_actions.extend (agent on_pointer_button_press_on_world)
pointer_button_release_actions.extend (agent on_pointer_button_release_on_world)
end
end