-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_gfx.py
55 lines (42 loc) · 1.32 KB
/
test_gfx.py
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
import pygame
from pygame.locals import *
from lib import gfx_engine, event, mod_base
def main():
pygame.init()
screen = pygame.display.set_mode((640,480))
event_handler = event.Handler()
eng = gfx_engine.GFXEngine(screen, 'main')
if eng.failed:
return
## units = mod_base.UnitHandler()
## units.load_dir('data/scenarios/main/units/')
## units.load_dir('data/units/')
## print units.units
## m_tile = eng.mapd.make_entity('gui_mouse-hover2.png', (0,0))
while 1:
event_handler.update()
if event_handler.quit:
pygame.quit()
return None
mx, my = event_handler.mouse.get_pos()
if mx < 5:
eng.camera.move(-0.1, 0)
elif mx > 635:
eng.camera.move(0.1, 0)
else:
print(eng.mapd.get_mouse_tile())
if my < 5:
eng.camera.move(0, -0.1)
elif my > 475:
eng.camera.move(0, 0.1)
else:
print(eng.mapd.get_mouse_tile())
xy = eng.mapd.get_mouse_tile()
eng.mapd.clear_highlights()
if xy:
x,y = xy
eng.mapd.add_highlight('gui_mouse-hover2.png', (x,y))
screen.fill((0,0,0))
eng.render()
pygame.display.flip()
main()