|
@@ -38,18 +38,10 @@ Class MyWindow Extends Window
|
|
|
'
|
|
|
ClearColor=New Color( .03,.03,.03 )
|
|
|
|
|
|
- 'Load laser sound effect
|
|
|
- '
|
|
|
- laser=Sound.Load( "asset::bang.wav" )
|
|
|
-
|
|
|
- 'Load spaceship image.
|
|
|
- '
|
|
|
- 'Note: scaling image here is faster than scaling via Canvas matrix.
|
|
|
+ 'load audio/images
|
|
|
'
|
|
|
- image=Image.Load( "asset::spaceship_32.png" )
|
|
|
- image.Scale=New Vec2f( 2 )
|
|
|
- image.Handle=New Vec2f( .5 )
|
|
|
-
|
|
|
+ LoadResources()
|
|
|
+
|
|
|
'Set initial image pos
|
|
|
'
|
|
|
pos=New Vec2f( VirtualWidth/2,VirtualHeight/2 )
|
|
@@ -63,6 +55,21 @@ Class MyWindow Extends Window
|
|
|
SwapInterval=1
|
|
|
End
|
|
|
|
|
|
+ Method LoadResources()
|
|
|
+
|
|
|
+ 'Load laser sound effect
|
|
|
+ '
|
|
|
+ laser=Sound.Load( "asset::bang.wav" )
|
|
|
+
|
|
|
+ 'Load spaceship image.
|
|
|
+ '
|
|
|
+ 'Note: scaling image here via Image.Scale is faster than scaling via Canvas matrix.
|
|
|
+ '
|
|
|
+ image=Image.Load( "asset::spaceship_32.png" )
|
|
|
+ image.Scale=New Vec2f( 2 )
|
|
|
+ image.Handle=New Vec2f( .5 )
|
|
|
+ End
|
|
|
+
|
|
|
Method OnKeyEvent( event:KeyEvent ) Override
|
|
|
Select event.Type
|
|
|
Case EventType.KeyDown
|
|
@@ -109,6 +116,10 @@ Class MyWindow Extends Window
|
|
|
|
|
|
RequestRender()
|
|
|
|
|
|
+ 'give GC a bit of a thrash....
|
|
|
+ '
|
|
|
+ 'LoadResources()
|
|
|
+
|
|
|
'rotate
|
|
|
'
|
|
|
If Keyboard.KeyDown( Key.Left )
|
|
@@ -194,7 +205,6 @@ Class MyWindow Extends Window
|
|
|
Method OnMeasure:Vec2i() Override
|
|
|
|
|
|
Return New Vec2i( VirtualWidth,VirtualHeight )
|
|
|
-
|
|
|
End
|
|
|
|
|
|
End
|