forked from ialad/pyscumm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.py
53 lines (43 loc) · 2.04 KB
/
demo.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
# PySCUMM Engine. SCUMM based engine for Python
# Copyright (C) 2006 PySCUMM Engine. http://pyscumm.org
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
import pyscumm, random
class Playa( pyscumm.Room ):
def init( self ):
# Here write the sentences that Playa need to run right
self.logo = pyscumm.sdl.Image( 'pyscumm/artwork/pyscumm_logo.tga' )
#self.logo.set_pos( ( pyscumm.Engine().display.get_size()[0]/2, pyscumm.Engine().display.get_size()[1]/2, 0 ) )
self.container.append( self.logo )
def on_event( self, event_dict ):
# Here intercept pyscumm events
# if any double click event...
if event_dict["type"] == pyscumm.DOUBLE_CLICK and event_dict["btn"] == 1:
s = self.logo.get_size()
# Change size image
self.logo.set_size( (s[0]+50,s[1]+50) )
elif event_dict["type"] == pyscumm.DOUBLE_CLICK and event_dict["btn"] == 3:
s = self.logo.get_size()
# Change size image
self.logo.set_size( (s[0]+150,s[1]+50) )
elif event_dict["type"] == pyscumm.DRAG_START:
cur_pos = pyscumm.Engine().mouse.get_pos()
self.logo.set_pos( (cur_pos[0], cur_pos[1], 0) )
# Mute the debugger
#pyscumm.Debugger().console = False
# Create a Engine
demo = pyscumm.Engine()
# Run the Engine with Playa Room
demo.run( Playa )