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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
Strict #rem Script: baseScript.monkey Description: Base Script fantomEngine Author: Michael Hartlef Version: 1.0 #end Import fantomEngine Global g:game '*************************************** Class game Extends App Field eng:engine Field isSuspended:Bool = False '------------------------------------------ Method OnCreate:Int() SetUpdateRate(60) eng = New engine Return 0 End '------------------------------------------ Method OnUpdate:Int() Local d:Float = Float(eng.CalcDeltaTime())/60.0 If isSuspended = False Then eng.Update(Float(d)) Endif Return 0 End '------------------------------------------ Method OnRender:Int() Cls eng.Render() Return 0 End '------------------------------------------ Method OnResume:Int() isSuspended = False SetUpdateRate(60) Return 0 End '------------------------------------------ Method OnSuspend:Int() isSuspended = True SetUpdateRate(5) Return 0 End End '*************************************** Class engine Extends ftEngine '------------------------------------------ Method OnObjectCollision:Int(obj:ftObject, obj2:ftObject) Return 0 End '------------------------------------------ Method OnObjectTimer:Int(timerId:Int, obj:ftObject) Return 0 End '------------------------------------------ Method OnObjectTouch:Int(obj:ftObject, touchId:Int) Return 0 End '------------------------------------------ Method OnObjectTransition:Int(transId:Int, obj:ftObject) Return 0 End '------------------------------------------ Method OnObjectUpdate:Int(obj:ftObject) Return 0 End '------------------------------------------ Method OnLayerTransition:Int(transId:Int, layer:ftLayer) Return 0 End '------------------------------------------ Method OnLayerUpdate:Int(layer:ftLayer) Return 0 End End '*************************************** Function Main:Int() g = New game Return 0 End |