From 82d4fce775fe81a21f63aca1d3e70533f489774e Mon Sep 17 00:00:00 2001 From: Michael Hartlef Date: Sun, 22 Apr 2018 10:50:26 +0200 Subject: [PATCH] Fixes for current release Fixes for current release --- cftEngine.cxs | 20 +- cftImageMng.cxs | 1 - cftObject.cxs | 4 +- examples/BaseScript/BaseScript.cxs | 6 +- .../VirtualResolution/VirtualResolution.cxs | 4 +- examples/Gui/Buttons/Buttons.cxs | 4 +- examples/Gui/Checkbox/Checkbox.cxs | 4 +- examples/Gui/Gui_Complete/Gui_Complete.cxs | 6 +- examples/Gui/Joysticks/Joysticks.cxs | 4 +- examples/Gui/Label/Label.cxs | 4 +- examples/Gui/Listview/Listview.cxs | 4 +- examples/Gui/Listview/Listview2.cxs | 4 +- examples/Gui/Slider/Slider.cxs | 4 +- examples/Gui/Switch/Switch.cxs | 4 +- examples/Gui/Textfield/Textfield.cxs | 4 +- examples/Input/KeyMapping/KeyMapping.cxs | 4 +- .../Input/SwipeDetection/SwipeDetection.cxs | 4 +- .../Input/TouchInput/DragNDrop/DragNDrop.cxs | 4 +- examples/Input/TouchInputEX/TouchInputEX.cxs | 4 +- .../Layer/ScalingLayers/ScalingLayers.cxs | 4 +- .../Layer/ScrollingLayers/ScrollingLayers.cxs | 4 +- examples/Localization/Localization.cxs | 4 +- examples/Misc/MultiClass/MultiClass.cxs | 4 +- examples/Misc/RunJump/RunJump.cxs | 4 +- examples/Misc/UpdateObjects/UpdateObjects.cxs | 4 +- .../9SliceScaling/9SliceScaling.cxs | 4 +- .../Appearance/BlendMode/BlendMode.cxs | 4 +- .../Appearance/FlashObject/FlashObject.cxs | 4 +- .../Appearance/FlashObject/FlashObject2.cxs | 4 +- .../ObjectMovement/ObjectMovement.cxs | 4 +- .../ObjectMovement/ObjectMovement2.cxs | 4 +- examples/Objects/Collision/Collision.cxs | 4 +- .../Creation/AnimObject/AnimObject.cxs | 4 +- .../Creation/CopyObject/CopyObject.cxs | 4 +- .../CreatePrimitives/CreatePrimitives.cxs | 4 +- .../Creation/CustomObject/CustomObject.cxs | 6 +- .../Objects/Creation/LoadImage/LoadImage.cxs | 4 +- .../PoolingObjects/PoolingObjects.cxs | 4 +- .../Creation/RemoveObject/RemoveObject.cxs | 4 +- examples/Objects/DataStorage/DataStorage.cxs | 4 +- .../Hierachy/ParentChild/ParentChild.cxs | 4 +- .../Hierachy/SortObjects/SortObjects.cxs | 4 +- examples/Pathfinding/Pathfinding.cxs | 4 +- .../Box2DIntegration/Box2DIntegration.cxs | 4 +- examples/Physics/Canon/Canon.cxs | 11 +- .../JuggleSoccerBall/JuggleSoccerBall.cxs | 4 +- examples/Physics/MouseJoint/MouseJoint.cxs | 4 +- .../Physics/RevoluteJoint/RevoluteJoint.cxs | 4 +- .../Scenes/SceneCreation/SceneCreation.cxs | 4 +- examples/Sound/Sound.cxs | 4 +- examples/SpriteSheets/SheetAnim/SheetAnim.cxs | 4 +- .../TexturePacker/TexturePacker.cxs | 4 +- examples/Test/Ground.svg | 149 ++++++++++ examples/Test/Test.cxs | 281 ++++++++++++++++++ examples/Test/Test.data/ground.png | Bin 0 -> 1560 bytes examples/Text/FontMachine/FontMachine.cxs | 4 +- examples/Text/MultilineText/MultilineText.cxs | 4 +- examples/TileMaps/DynamicMap/DynamicMap.cxs | 4 +- examples/TileMaps/EndlessMap/EndlessMap.cxs | 4 +- examples/TileMaps/Platformer/Platformer.cxs | 4 +- .../Platformer_Physics/Platformer_Physics.cxs | 4 +- examples/TileMaps/Tiled/MultiTileSets.cxs | 4 +- examples/TileMaps/Tiled/Tiled.cxs | 22 +- examples/TileMaps/Tiled/TiledIsometric.cxs | 4 +- examples/Timers/Timers.cxs | 4 +- .../ObjectTransition/ObjectTransition.cxs | 4 +- .../ObjectTransitionImage.cxs | 4 +- examples/Waypoints/Waypoints.cxs | 4 +- 68 files changed, 590 insertions(+), 144 deletions(-) create mode 100644 examples/Test/Ground.svg create mode 100644 examples/Test/Test.cxs create mode 100644 examples/Test/Test.data/ground.png diff --git a/cftEngine.cxs b/cftEngine.cxs index 5ef7486..2f582ce 100644 --- a/cftEngine.cxs +++ b/cftEngine.cxs @@ -1503,14 +1503,18 @@ The layerIndex tells fantomCX to load the tileLayer at that index. Index starts newTileSet.spacing = spacing newTileSet.tileheight = tlH newTileSet.tilewidth = tlW - + + If obj.objImg.Length() = 0 + obj.objImg = obj.objImg.Resize(1) + Endif + If tileSheetIndex > 0 Then Local currSize:Int = obj.objImg.Length() obj.objImg = obj.objImg.Resize(currSize + 1) currSize = obj.tileMap.tileSets.Length() obj.tileMap.tileSets = obj.tileMap.tileSets.Resize(currSize + 1) Endif - + obj.tileMap.tileSets[tileSheetIndex] = newTileSet If Image.Load(dataTileSet.GetItem("image"),0.5,0.5,Image.Filter)<> Null Then @@ -2546,6 +2550,17 @@ The current default file formats are: #End 'seeAlso:OnObjectRender,RenderFlush,ftObject.ActivateRenderEvent Method Render:Void() + Local sc:Int[4] + Local _scissor:Bool = False + Local sx :Int + Local sy :Int + Local sw :Int + Local sh :Int + sc = Self.currentCanvas.Scissor() + sx = sc[0] + sy = sc[1] + sw = sc[2] + sh = sc[3] '#If TARGET="html5" Self.red = 255 Self.green = 255 @@ -2562,6 +2577,7 @@ The current default file formats are: For Local layer := Eachin layerList If layer.isVisible And layer.isActive Then layer.Render() Next +Self.currentCanvas.SetScissor( sx, sy ,sw , sh ) Self.currentCanvas.PopMatrix() End '------------------------------------------ diff --git a/cftImageMng.cxs b/cftImageMng.cxs index 1804664..2454f93 100644 --- a/cftImageMng.cxs +++ b/cftImageMng.cxs @@ -347,7 +347,6 @@ Class ftImageManager If newImg.img[0] = Null Then Error ("~n~nError in file cftImageMng.cxs, Method ftImageManager.LoadImage~n~nCould not load image~n~n"+path) #End newImg.imageNode = Self.imageList.AddLast(newImg) - tmpImg.Discard() Endif Return newImg diff --git a/cftObject.cxs b/cftObject.cxs index ec9eb9a..393af67 100644 --- a/cftObject.cxs +++ b/cftObject.cxs @@ -1658,7 +1658,7 @@ The returned value is the stored width multiplied by the X scale factor. Local xLast:Int = Self.tileMap.tileCountX Local yFirst:Int = 1 Local yLast:Int = Self.tileMap.tileCountY - + If Self.tileMap.tiles[0].tileType = 0 'Determine the first x coordinates For ytX = 1 To Self.tileMap.tileCountX @@ -1713,7 +1713,7 @@ The returned value is the stored width multiplied by the X scale factor. If tileIDx <> - 1 Then tlxPos = xoff+xPos+Self.tileMap.tiles[tilePos].xOff * Self.scaleX + (Self.tileMap.tiles[tilePos].sizeX/2-Self.tileMap.tileSizeX/2) tlyPos = yoff+yPos+Self.tileMap.tiles[tilePos].yOff * Self.scaleY - (Self.tileMap.tiles[tilePos].sizeY/2-Self.tileMap.tileSizeY/2) - + 'Print( tileSetIndex+":"+tileIDx+":"+tlxPos+":"+tlyPos+":"+tempScaleX+":"+tempScaleY) 'DrawImageRect( Self.objImg[tileSetIndex].img, tlxPos, tlyPos, tileMap.tileSpacing, tileMap.tileSpacing, Self.tileMap.tileSets[tileSetIndex].tilewidth-tileMap.tileSpacing, Self.tileMap.tileSets[tileSetIndex].tileheight-tileMap.tileSpacing, drawAngle, tempScaleX, tempScaleY, tileIDx) Self.engine.currentCanvas.DrawImage( Self.objImg[tileSetIndex].img[tileIDx], tlxPos, tlyPos, drawAngle, tempScaleX, tempScaleY) Endif diff --git a/examples/BaseScript/BaseScript.cxs b/examples/BaseScript/BaseScript.cxs index 71ba113..08c02a0 100644 --- a/examples/BaseScript/BaseScript.cxs +++ b/examples/BaseScript/BaseScript.cxs @@ -47,7 +47,7 @@ Class cGame Extends App fE = New cEngine 'Set the virtual size of the canvas - fE.SetCanvasSize(800,600) + fE.SetCanvasSize(600,600) ' Get the default scene of the engine defScene = fE.GetDefaultScene() @@ -92,11 +92,13 @@ Class cGame Extends App fE.Render() ' Now draw the current FPS value to the screen - fE.SetColor(255, 255, 0) + fE.SetColor(255, 255, 255) fE.GetCanvas().DrawText( "FPS= "+fE.GetFPS(),fE.GetLocalX(10), fE.GetLocalY(10)) ' Last, flip the previously drawn content to the screen, make it visible fE.RenderFlush() Else + fE.Clear( 255,0,0) + fE.SetColor(255, 255, 255) fE.GetCanvas().DrawText("**** PAUSED ****",fE.GetLocalX(fE.GetCanvasWidth()/2.0),fE.GetLocalY(fE.GetCanvasHeight()/2.0),0.5, 0.5) ' Last, flip the previously drawn content to the screen, make it visible fE.RenderFlush() diff --git a/examples/Canvas/VirtualResolution/VirtualResolution.cxs b/examples/Canvas/VirtualResolution/VirtualResolution.cxs index c653cf3..c357163 100644 --- a/examples/Canvas/VirtualResolution/VirtualResolution.cxs +++ b/examples/Canvas/VirtualResolution/VirtualResolution.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: VirtualResolution.monkey + Script: VirtualResolution.cxs Description: A sample script to show how to deal with a virtual canvas size/resolution Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Gui/Buttons/Buttons.cxs b/examples/Gui/Buttons/Buttons.cxs index 79c9ebf..8aaaf7b 100644 --- a/examples/Gui/Buttons/Buttons.cxs +++ b/examples/Gui/Buttons/Buttons.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: Buttons.monkey + Script: Buttons.cxs Description: fantomCX sample script that shows how to use the custom gui button object Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Gui/Checkbox/Checkbox.cxs b/examples/Gui/Checkbox/Checkbox.cxs index aa0244c..7e479d6 100644 --- a/examples/Gui/Checkbox/Checkbox.cxs +++ b/examples/Gui/Checkbox/Checkbox.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: Checkbox.monkey + Script: Checkbox.cxs Description: fantomCX sample script that shows how to use the custom gui checkbox object Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Gui/Gui_Complete/Gui_Complete.cxs b/examples/Gui/Gui_Complete/Gui_Complete.cxs index 668e394..0c2b5d7 100644 --- a/examples/Gui/Gui_Complete/Gui_Complete.cxs +++ b/examples/Gui/Gui_Complete/Gui_Complete.cxs @@ -1,16 +1,16 @@ Strict #rem - Script: Gui_Complete.monkey + Script: Gui_Complete.cxs Description: fantomCX sample script that shows how to use the gui objects Author: Michael Hartlef - Version: 2.01 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called #MOJO_AUTO_SUSPEND_ENABLED=True #MOJO_IMAGE_FILTERING_ENABLED=True -#GLFW_WINDOW_TITLE="Gui_Complete.monkey" +#GLFW_WINDOW_TITLE="Gui_Complete.cxs" 'Set to false to disable webaudio support for mojo audio, and to use older multimedia audio system instead. #HTML5_WEBAUDIO_ENABLED=True diff --git a/examples/Gui/Joysticks/Joysticks.cxs b/examples/Gui/Joysticks/Joysticks.cxs index 8397543..73e3d84 100644 --- a/examples/Gui/Joysticks/Joysticks.cxs +++ b/examples/Gui/Joysticks/Joysticks.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: Joysticks.monkey + Script: Joysticks.cxs Description: fantomCX sample script that shows how to use the custom gui joystick object Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Gui/Label/Label.cxs b/examples/Gui/Label/Label.cxs index f97a0e4..27c8841 100644 --- a/examples/Gui/Label/Label.cxs +++ b/examples/Gui/Label/Label.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: Label.monkey + Script: Label.cxs Description: fantomCX sample script that shows how to use the custom gui label object Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Gui/Listview/Listview.cxs b/examples/Gui/Listview/Listview.cxs index 0d8410d..390871e 100644 --- a/examples/Gui/Listview/Listview.cxs +++ b/examples/Gui/Listview/Listview.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: Listview.monkey + Script: Listview.cxs Description: fantomCX sample script that shows how to use the custom gui listbox object Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Gui/Listview/Listview2.cxs b/examples/Gui/Listview/Listview2.cxs index de159d9..f5be43e 100644 --- a/examples/Gui/Listview/Listview2.cxs +++ b/examples/Gui/Listview/Listview2.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: Listview2.monkey + Script: Listview2.cxs Description: fantomCX sample script that shows how to use the custom gui listbox object Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Gui/Slider/Slider.cxs b/examples/Gui/Slider/Slider.cxs index 4c4f41b..b37da89 100644 --- a/examples/Gui/Slider/Slider.cxs +++ b/examples/Gui/Slider/Slider.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: Slider.monkey + Script: Slider.cxs Description: fantomCX sample script that shows how to use the custom gui slider object Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Gui/Switch/Switch.cxs b/examples/Gui/Switch/Switch.cxs index ad1adc0..bfd90c7 100644 --- a/examples/Gui/Switch/Switch.cxs +++ b/examples/Gui/Switch/Switch.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: Switch.monkey + Script: Switch.cxs Description: fantomCX sample script that shows how to use the custom gui switch object Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Gui/Textfield/Textfield.cxs b/examples/Gui/Textfield/Textfield.cxs index c03654d..47be755 100644 --- a/examples/Gui/Textfield/Textfield.cxs +++ b/examples/Gui/Textfield/Textfield.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: Textfield.monkey + Script: Textfield.cxs Description: fantomCX sample script that shows how to use the custom gui textfield object Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Input/KeyMapping/KeyMapping.cxs b/examples/Input/KeyMapping/KeyMapping.cxs index dccd543..af50e54 100644 --- a/examples/Input/KeyMapping/KeyMapping.cxs +++ b/examples/Input/KeyMapping/KeyMapping.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: KeyMapping.monkey + Script: KeyMapping.cxs Description: Sample script that shows how to use the ftKeyMapping class Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Input/SwipeDetection/SwipeDetection.cxs b/examples/Input/SwipeDetection/SwipeDetection.cxs index ed5abd6..3557b39 100644 --- a/examples/Input/SwipeDetection/SwipeDetection.cxs +++ b/examples/Input/SwipeDetection/SwipeDetection.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: SwipeDetection.monkey + Script: SwipeDetection.cxs Description: Example script on how to use ther swipe detection And its OnSwipeDone event Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Input/TouchInput/DragNDrop/DragNDrop.cxs b/examples/Input/TouchInput/DragNDrop/DragNDrop.cxs index 4c0994b..248f213 100644 --- a/examples/Input/TouchInput/DragNDrop/DragNDrop.cxs +++ b/examples/Input/TouchInput/DragNDrop/DragNDrop.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: DragNDrop.monkey + Script: DragNDrop.cxs Description: Sample script to show how to drag and drop and object Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Input/TouchInputEX/TouchInputEX.cxs b/examples/Input/TouchInputEX/TouchInputEX.cxs index 149aaa4..7f2aced 100644 --- a/examples/Input/TouchInputEX/TouchInputEX.cxs +++ b/examples/Input/TouchInputEX/TouchInputEX.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: TouchInputEX.monkey + Script: TouchInputEX.cxs Description: Sample fantomCX script, that shows how to use the extended touch events Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Layer/ScalingLayers/ScalingLayers.cxs b/examples/Layer/ScalingLayers/ScalingLayers.cxs index d202b6a..d06c558 100644 --- a/examples/Layer/ScalingLayers/ScalingLayers.cxs +++ b/examples/Layer/ScalingLayers/ScalingLayers.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: ScalingLayers.monkey + Script: ScalingLayers.cxs Description: fantomCX sample script that shows how to scale and position layers Author: Michael Hartlef - Version: 2.01 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Layer/ScrollingLayers/ScrollingLayers.cxs b/examples/Layer/ScrollingLayers/ScrollingLayers.cxs index aca9128..c7a0300 100644 --- a/examples/Layer/ScrollingLayers/ScrollingLayers.cxs +++ b/examples/Layer/ScrollingLayers/ScrollingLayers.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: ScrollingLayers.monkey + Script: ScrollingLayers.cxs Description: This fantomCX sample script shows how to use multiple scrolling layers Author: Douglas Williams - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Localization/Localization.cxs b/examples/Localization/Localization.cxs index aa1056f..5cb7e60 100644 --- a/examples/Localization/Localization.cxs +++ b/examples/Localization/Localization.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: Localization.monkey + Script: Localization.cxs Description: Sample script that shows how to use the ftLocalization class Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Misc/MultiClass/MultiClass.cxs b/examples/Misc/MultiClass/MultiClass.cxs index 0710cd5..7707791 100644 --- a/examples/Misc/MultiClass/MultiClass.cxs +++ b/examples/Misc/MultiClass/MultiClass.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: MultiClass.monkey + Script: MultiClass.cxs Description: This sample script shows how to split your project into several classes and files Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Misc/RunJump/RunJump.cxs b/examples/Misc/RunJump/RunJump.cxs index 3c77228..0c3ddac 100644 --- a/examples/Misc/RunJump/RunJump.cxs +++ b/examples/Misc/RunJump/RunJump.cxs @@ -1,11 +1,11 @@ Strict #rem - Script: RunJump.monkey + Script: RunJump.cxs Description: This fantomCX sample script shows basics of run & jump game Player stays in place, while clouds and enemy move Author: Douglas Williams - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Misc/UpdateObjects/UpdateObjects.cxs b/examples/Misc/UpdateObjects/UpdateObjects.cxs index ed769a6..8c74d08 100644 --- a/examples/Misc/UpdateObjects/UpdateObjects.cxs +++ b/examples/Misc/UpdateObjects/UpdateObjects.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: UpdateObjects.monkey + Script: UpdateObjects.cxs Description: Sample script to show how to update objects based on their category Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Objects/Appearance/9SliceScaling/9SliceScaling.cxs b/examples/Objects/Appearance/9SliceScaling/9SliceScaling.cxs index f03b8f8..88b2364 100644 --- a/examples/Objects/Appearance/9SliceScaling/9SliceScaling.cxs +++ b/examples/Objects/Appearance/9SliceScaling/9SliceScaling.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: 9ScliceScaling.monkey + Script: 9ScliceScaling.cxs Description: Sample script that shows how to use the 9-slice image scaling feature Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Objects/Appearance/BlendMode/BlendMode.cxs b/examples/Objects/Appearance/BlendMode/BlendMode.cxs index c96b21b..e77e5e9 100644 --- a/examples/Objects/Appearance/BlendMode/BlendMode.cxs +++ b/examples/Objects/Appearance/BlendMode/BlendMode.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: BlendMode.monkey + Script: BlendMode.cxs Description: Sample script that shows how to use the blend mode Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Objects/Appearance/FlashObject/FlashObject.cxs b/examples/Objects/Appearance/FlashObject/FlashObject.cxs index 8241fcc..d5f1e7e 100644 --- a/examples/Objects/Appearance/FlashObject/FlashObject.cxs +++ b/examples/Objects/Appearance/FlashObject/FlashObject.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: FlashObject.monkey + Script: FlashObject.cxs Description: This sample script shows some ways on how to flash an object Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Objects/Appearance/FlashObject/FlashObject2.cxs b/examples/Objects/Appearance/FlashObject/FlashObject2.cxs index 92f09f5..877b74d 100644 --- a/examples/Objects/Appearance/FlashObject/FlashObject2.cxs +++ b/examples/Objects/Appearance/FlashObject/FlashObject2.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: FlashObject2.monkey + Script: FlashObject2.cxs Description: This sample script shows some ways on how to flash an object Author: based on sample from Michael Hartlef, expanded by Douglas Williams - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Objects/Behaviour/ObjectMovement/ObjectMovement.cxs b/examples/Objects/Behaviour/ObjectMovement/ObjectMovement.cxs index 1915ce1..7d93e4e 100644 --- a/examples/Objects/Behaviour/ObjectMovement/ObjectMovement.cxs +++ b/examples/Objects/Behaviour/ObjectMovement/ObjectMovement.cxs @@ -1,10 +1,10 @@ Strict #Rem - Script: ObjectMovement.monkey + Script: ObjectMovement.cxs Description: Sample script that shows how to control your objects at runtime Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Objects/Behaviour/ObjectMovement/ObjectMovement2.cxs b/examples/Objects/Behaviour/ObjectMovement/ObjectMovement2.cxs index 0a1e967..4281fdc 100644 --- a/examples/Objects/Behaviour/ObjectMovement/ObjectMovement2.cxs +++ b/examples/Objects/Behaviour/ObjectMovement/ObjectMovement2.cxs @@ -1,10 +1,10 @@ Strict #Rem - Script: ObjectMovement2.monkey + Script: ObjectMovement2.cxs Description: Sample script that shows how to control your objects at runtime Author: Michael Hartlef - Version: 1.01 + Version: 3.0 #End ' Import the fantomCX framework which imports mojo itself diff --git a/examples/Objects/Collision/Collision.cxs b/examples/Objects/Collision/Collision.cxs index 32de67d..875aff9 100644 --- a/examples/Objects/Collision/Collision.cxs +++ b/examples/Objects/Collision/Collision.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: Collision.monkey + Script: Collision.cxs Description: Sample script to show how to do collisions Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Objects/Creation/AnimObject/AnimObject.cxs b/examples/Objects/Creation/AnimObject/AnimObject.cxs index 0ff7e6d..bc67b08 100644 --- a/examples/Objects/Creation/AnimObject/AnimObject.cxs +++ b/examples/Objects/Creation/AnimObject/AnimObject.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: AnimObject.monkey + Script: AnimObject.cxs Description: Sample script that shows how to load/create animated objects Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Objects/Creation/CopyObject/CopyObject.cxs b/examples/Objects/Creation/CopyObject/CopyObject.cxs index 7cf1e3a..318b2f7 100644 --- a/examples/Objects/Creation/CopyObject/CopyObject.cxs +++ b/examples/Objects/Creation/CopyObject/CopyObject.cxs @@ -1,10 +1,10 @@ Strict #Rem - Script: CopyObject.monkey + Script: CopyObject.cxs Description: Sample script that shows how to copy an object with most of its parameters at runtime Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Objects/Creation/CreatePrimitives/CreatePrimitives.cxs b/examples/Objects/Creation/CreatePrimitives/CreatePrimitives.cxs index df1d98d..e932d19 100644 --- a/examples/Objects/Creation/CreatePrimitives/CreatePrimitives.cxs +++ b/examples/Objects/Creation/CreatePrimitives/CreatePrimitives.cxs @@ -1,11 +1,11 @@ Strict #rem - Script: CreatePrimitives.monkey + Script: CreatePrimitives.cxs Description: This fantomCX sample script shows how to create the following: box, circle, polygon, oval, point, stickman (with visable bound box), line Author: Douglas Williams - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Objects/Creation/CustomObject/CustomObject.cxs b/examples/Objects/Creation/CustomObject/CustomObject.cxs index 383c0b1..cfaf21b 100644 --- a/examples/Objects/Creation/CustomObject/CustomObject.cxs +++ b/examples/Objects/Creation/CustomObject/CustomObject.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: ExtendedObject.monkey - Description: Sample script that shows how To extend the Object class + Script: ExtendedObject.cxs + Description: Sample script that shows how to extend the Object class Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Objects/Creation/LoadImage/LoadImage.cxs b/examples/Objects/Creation/LoadImage/LoadImage.cxs index ed1d5c6..fc424c7 100644 --- a/examples/Objects/Creation/LoadImage/LoadImage.cxs +++ b/examples/Objects/Creation/LoadImage/LoadImage.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: LoadImage.monkey + Script: LoadImage.cxs 'Description: Same script that shows how to load and a single image Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Objects/Creation/PoolingObjects/PoolingObjects.cxs b/examples/Objects/Creation/PoolingObjects/PoolingObjects.cxs index b9dce0e..177b650 100644 --- a/examples/Objects/Creation/PoolingObjects/PoolingObjects.cxs +++ b/examples/Objects/Creation/PoolingObjects/PoolingObjects.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: PoolingObjects.monkey + Script: PoolingObjects.cxs Description: Sample script that shows how to use pooling with ftObjects Author: Michael Hartlef - Version: 1.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Objects/Creation/RemoveObject/RemoveObject.cxs b/examples/Objects/Creation/RemoveObject/RemoveObject.cxs index fd2b8da..4f5b9b8 100644 --- a/examples/Objects/Creation/RemoveObject/RemoveObject.cxs +++ b/examples/Objects/Creation/RemoveObject/RemoveObject.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: RemoveObject.monkey + Script: RemoveObject.cxs Description: Sampe script that shows how to remove objects Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Objects/DataStorage/DataStorage.cxs b/examples/Objects/DataStorage/DataStorage.cxs index 91b6a53..4f56943 100644 --- a/examples/Objects/DataStorage/DataStorage.cxs +++ b/examples/Objects/DataStorage/DataStorage.cxs @@ -1,10 +1,10 @@ Strict #Rem - Script: DataStorage.monkey + Script: DataStorage.cxs Description: Sample script that shows how to store any data inside an Object and use it at runtime Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Objects/Hierachy/ParentChild/ParentChild.cxs b/examples/Objects/Hierachy/ParentChild/ParentChild.cxs index bcfdd4f..771d5a5 100644 --- a/examples/Objects/Hierachy/ParentChild/ParentChild.cxs +++ b/examples/Objects/Hierachy/ParentChild/ParentChild.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: ParentChild.monkey + Script: ParentChild.cxs Description: Sample script to show how to use parent/child relationships. Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Objects/Hierachy/SortObjects/SortObjects.cxs b/examples/Objects/Hierachy/SortObjects/SortObjects.cxs index 065a4a2..6a4dff1 100644 --- a/examples/Objects/Hierachy/SortObjects/SortObjects.cxs +++ b/examples/Objects/Hierachy/SortObjects/SortObjects.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: SortObjects.monkey + Script: SortObjects.cxs Description: Sample script that shows how so sort objects inside a layer Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Pathfinding/Pathfinding.cxs b/examples/Pathfinding/Pathfinding.cxs index 8e93cc2..fa297c3 100644 --- a/examples/Pathfinding/Pathfinding.cxs +++ b/examples/Pathfinding/Pathfinding.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: PathFinding.monkey + Script: PathFinding.cxs Description: Sample fantomCX script that shows how to do A* pathfinding in the fantomCX Author: Michael Hartlef - Version: 2.01 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Physics/Box2DIntegration/Box2DIntegration.cxs b/examples/Physics/Box2DIntegration/Box2DIntegration.cxs index 68bd189..c2a8935 100644 --- a/examples/Physics/Box2DIntegration/Box2DIntegration.cxs +++ b/examples/Physics/Box2DIntegration/Box2DIntegration.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: MouseJoint.monkey + Script: MouseJoint.cxs 'Description: Sample script on how to integrate Box2D with fantomCX Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Physics/Canon/Canon.cxs b/examples/Physics/Canon/Canon.cxs index d6a941e..e0c6b62 100644 --- a/examples/Physics/Canon/Canon.cxs +++ b/examples/Physics/Canon/Canon.cxs @@ -1,17 +1,10 @@ Strict #rem - Script: Canon.monkey + Script: Canon.cxs Description: A fantomCX sample script that shows how to shoot a box2D object in the direction of a touch event. Author: Michael Hartlef - Version: 2.0 -#End - -#rem - Script: MouseJoint.monkey - 'Description: Sample script on how to integrate Box2D with fantomCX - Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Physics/JuggleSoccerBall/JuggleSoccerBall.cxs b/examples/Physics/JuggleSoccerBall/JuggleSoccerBall.cxs index e1ab209..016f6a8 100644 --- a/examples/Physics/JuggleSoccerBall/JuggleSoccerBall.cxs +++ b/examples/Physics/JuggleSoccerBall/JuggleSoccerBall.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: JuggleSoccerBall.monkey + Script: JuggleSoccerBall.cxs Description: Sample fantomCX script that shows how to setup a little game Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Physics/MouseJoint/MouseJoint.cxs b/examples/Physics/MouseJoint/MouseJoint.cxs index e7ae40d..61352af 100644 --- a/examples/Physics/MouseJoint/MouseJoint.cxs +++ b/examples/Physics/MouseJoint/MouseJoint.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: MouseJoint.monkey + Script: MouseJoint.cxs 'Description: Sample script on how to use a Box2D mouse joint with fantomCX Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Physics/RevoluteJoint/RevoluteJoint.cxs b/examples/Physics/RevoluteJoint/RevoluteJoint.cxs index d0d4ae5..50ba292 100644 --- a/examples/Physics/RevoluteJoint/RevoluteJoint.cxs +++ b/examples/Physics/RevoluteJoint/RevoluteJoint.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: RevoluteJoint.monkey + Script: RevoluteJoint.cxs 'Description: Sample script on how to use a Box2D revolute joint with fantomCX Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Scenes/SceneCreation/SceneCreation.cxs b/examples/Scenes/SceneCreation/SceneCreation.cxs index 8a40f2a..5b0d3e6 100644 --- a/examples/Scenes/SceneCreation/SceneCreation.cxs +++ b/examples/Scenes/SceneCreation/SceneCreation.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: SceneCreation.monkey + Script: SceneCreation.cxs Description: Sample fantomCX script to show how to create an use scenes Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Sound/Sound.cxs b/examples/Sound/Sound.cxs index d92f9bb..fd44d38 100644 --- a/examples/Sound/Sound.cxs +++ b/examples/Sound/Sound.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: Sound.monkey + Script: Sound.cxs Description: Sample script to show how to use sounds and mousic in fantomCX Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/SpriteSheets/SheetAnim/SheetAnim.cxs b/examples/SpriteSheets/SheetAnim/SheetAnim.cxs index 91d0fb2..5aa9b4d 100644 --- a/examples/SpriteSheets/SheetAnim/SheetAnim.cxs +++ b/examples/SpriteSheets/SheetAnim/SheetAnim.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: SheetAnim.monkey + Script: SheetAnim.cxs Description: Sample script that shows how to use spritesheets for animated objects Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/SpriteSheets/TexturePacker/TexturePacker.cxs b/examples/SpriteSheets/TexturePacker/TexturePacker.cxs index 43e9068..70f2b34 100644 --- a/examples/SpriteSheets/TexturePacker/TexturePacker.cxs +++ b/examples/SpriteSheets/TexturePacker/TexturePacker.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: TexturePacker.monkey + Script: TexturePacker.cxs Description: Example script on how To use packed texture images created by the tool TexturePacker Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #end ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Test/Ground.svg b/examples/Test/Ground.svg new file mode 100644 index 0000000..b374d23 --- /dev/null +++ b/examples/Test/Ground.svg @@ -0,0 +1,149 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/Test/Test.cxs b/examples/Test/Test.cxs new file mode 100644 index 0000000..2fd9378 --- /dev/null +++ b/examples/Test/Test.cxs @@ -0,0 +1,281 @@ +Strict + +#rem + Script: Test.cxs + Description: Basic fantomCX script for testing purpose + Author: Michael Hartlef + Version: 3.0 +#End + +' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called +#MOJO_AUTO_SUSPEND_ENABLED=True + +'Set to false to disable webaudio support for mojo audio, and to use older multimedia audio system instead. +#HTML5_WEBAUDIO_ENABLED=True +#MOJO_IMAGE_FILTERING_ENABLED=False + +' Tell fantomCX to import physics related classes/fields/methods +#fantomCX_UsePhysics = False + +' Import the fantomCX framework which imports mojo2 itself +Import fantomCX + +' The _g variable holds an instance to the cGame class +Global _g:cGame + +'*************************************** +' The cGame class controls the app +Class cGame Extends App + ' Create a field to store the instance of the cEngine class, which is an instance + ' of the ftEngine class itself + Field fE:cEngine + + ' Create a field for the default scene and layer of the engine + Field defLayer:ftLayer + Field defScene:ftScene + Field camDefault:ftCamera + Field cam0:ftCamera + Field cam1:ftCamera + + + Field cW:Int + Field cH:Int + '------------------------------------------ + Method OnClose:Int() + fE.ExitApp() + Return 0 + End + '------------------------------------------ + Method OnBack:Int() + Return 0 + End + '------------------------------------------ + Method OnCreate:Int() + ' Create an instance of the fantomCX, which was created via the cEngine class + fE = New cEngine + + 'Set the virtual size of the canvas + fE.SetCanvasSize(640,960) + + cW = fE.GetCanvasWidth() + cH = fE.GetCanvasHeight() + + camDefault = fE.GetCamera() + cam0 = fE.CreateCamera() + cam1 = fE.CreateCamera() + + camDefault.SetDimensions(0, 0, DeviceWidth(), DeviceHeight()) + cam0.SetDimensions(0, 0, DeviceWidth()/2.0, DeviceHeight()) + cam1.SetDimensions(DeviceWidth()/2.0, 0, DeviceWidth()/2.0, DeviceHeight()) + + + ' Get the default scene of the engine + defScene = fE.GetDefaultScene() + + ' Get the default layer of the engine + defLayer = fE.GetDefaultLayer() + + For Local x:= 16 To fE.GetCanvasWidth() Step 32 + Local block := fE.CreateImage("ground.png",x,fE.GetCanvasHeight()-16) + block.SetAngle(Int(Rnd(0,4))*90) + Next + + + Return 0 + End + '------------------------------------------ + Method OnUpdate:Int() + ' If the CLOSE key was hit, exit the app ... needed for GLFW and Android I think. + If KeyHit( KEY_CLOSE ) Then fE.ExitApp() + + ' Determine the delta time and the update factor for the engine + Local timeDelta:Float = Float(fE.CalcDeltaTime())/60.0 + + ' Check if the engine is not paused + If fE.GetPaused() = False Then + ' Update all objects of the engine + fE.Update(timeDelta) + + If KeyDown(KEY_RIGHT) Then cam0.SetPosX( 0.5, True) + If KeyDown(KEY_LEFT) Then cam0.SetPosX(-0.5, True) + If KeyHit(KEY_SPACE) + Print(fE.autofitX+":"+fE.autofitY+" "+fE.scaleX+":"+fE.scaleY) + Endif + cam1.Use() + Endif + Return 0 + End + '------------------------------------------ + Method OnRender:Int() + ' Check if the engine is not paused + If fE.GetPaused() = False Then + fE.GetCanvas().SetScissor(0,0,10000.0, 10000.0) + fE.GetCanvas().SetViewport (0,0,DeviceWidth(), DeviceHeight()) + fE.GetCanvas().SetProjection2d (0,DeviceWidth()-1,0, DeviceHeight()-1) + camDefault.Use() + fE.Clear( 255,0,255) + + If KeyDown(KEY_A) + cam0.Use() + fE.GetCanvas().SetViewport (0, 0, DeviceWidth()/2.0, DeviceHeight()) + fE.GetCanvas().SetProjection2d (0, DeviceWidth()/2.0-1.0, 0, DeviceHeight()-1) + Endif + ' Clear the screen + fE.Clear( 200,200,0) + ' Render all visible objects of the engine + fE.Render() + ' Now draw the current FPS value to the screen + fE.SetColor(255, 255, 255) + fE.GetCanvas().DrawText( "FPS= "+fE.GetFPS(),fE.GetLocalX(10, False), fE.GetLocalY(10, False)) + ' Last, flip the previously drawn content to the screen, make it visible + fE.GetCanvas().DrawText( "X/Y= "+Int(fE.GetTouchX(0, False))+":"+Int(fE.GetTouchY(0, False)),fE.GetLocalX(10, False), fE.GetLocalY(25, False)) + + If KeyDown(KEY_A) + cam1.Use() + ' Clear the screen + fE.GetCanvas().SetViewport (DeviceWidth()/2.0, 0, DeviceWidth()/2.0, DeviceHeight()/2.0) + fE.GetCanvas().SetProjection2d (0, DeviceWidth()/2.0-1.0, 0, (DeviceHeight()-1.0)) + fE.Clear( 0,200,200) + ' Render all visible objects of the engine + fE.Render() + ' Now draw the current FPS value to the screen + fE.SetColor(255, 255, 255) + fE.GetCanvas().DrawText( "FPS= "+fE.GetFPS(),fE.GetLocalX(10, False), fE.GetLocalY(10, False)) + ' Last, flip the previously drawn content to the screen, make it visible + fE.GetCanvas().DrawText( "X/Y= "+Int(fE.GetTouchX(0, False))+":"+Int(fE.GetTouchY(0, False)),fE.GetLocalX(10, False), fE.GetLocalY(25, False)) + Endif + + fE.RenderFlush() + Else + fE.GetCanvas().DrawText("**** PAUSED ****",fE.GetLocalX(fE.GetCanvasWidth()/2.0),fE.GetLocalY(fE.GetCanvasHeight()/2.0),0.5, 0.5) + ' Last, flip the previously drawn content to the screen, make it visible + fE.RenderFlush() + Endif + Return 0 + End + '------------------------------------------ + Method OnLoading:Int() + ' If loading of assets in OnCreate takes longer, render a simple loading screen + fE.RenderLoadingBar() + + Return 0 + End + '------------------------------------------ + Method OnResume:Int() + ' Set the pause flag of the engine to FALSE so objects, timers and transitions are updated again + fE.SetPaused(False) + + Return 0 + End + '------------------------------------------ + Method OnSuspend:Int() + ' Set the pause flag of the engine to TRUE so objects, timers and transitions are paused (not updated) + fE.SetPaused(True) + + Return 0 + End +End + +'*************************************** +' The cEngine class extends the ftEngine class to override the On... methods +Class cEngine Extends ftEngine + '------------------------------------------ + Method OnLayerTransition:Int(transId:Int, layer:ftLayer) + ' This method is called when a layer finishes its transition + Return 0 + End + '------------------------------------------ + Method OnLayerUpdate:Int(layer:ftLayer) + ' This method is called when a layer finishes its update + Return 0 + End + '------------------------------------------ + Method OnObjectAnim:Int(obj:ftObject) + 'This Method is called when an animation of an object (obj) has finished one loop. + Return 0 + End + '------------------------------------------ + Method OnObjectCollision:Int(obj:ftObject, obj2:ftObject) + ' This method is called when an object collided with another object + Return 0 + End + '------------------------------------------ + Method OnObjectDelete:Int(obj:ftObject) + ' This method is called when an object is removed. You need to activate the event via ftObject.ActivateDeleteEvent. + Return 0 + End + '------------------------------------------ + Method OnObjectRender:Int(obj:ftObject) + ' This method is called when an object was being rendered. You need to activate the event via ftObject.ActivateRenderEvent. + Return 0 + End + '------------------------------------------ + Method OnObjectSort:Int(obj1:ftObject, obj2:ftObject) + ' This method is called when objects are compared during a sort of its layer list + Return 0 + End + '------------------------------------------ + Method OnObjectTimer:Int(timerId:Int, obj:ftObject) + ' This method is called when an objects' timer was being fired. + Return 0 + End + '------------------------------------------ + Method OnObjectTouch:Int(obj:ftObject, touchId:Int) + ' This method is called when an object was touched + Return 0 + End + '------------------------------------------ + Method OnObjectTransition:Int(transId:Int, obj:ftObject) + ' This method is called when an object finishes its transition and the transition has an ID > 0. + Return 0 + End + '------------------------------------------ + Method OnObjectUpdate:Int(obj:ftObject) + ' This method is called when an object finishes its update. You can deactivate the event via ftObject.ActivateUpdateEvent. + Return 0 + End + '------------------------------------------ + Method OnMarkerBounce:Int(marker:ftMarker, obj:ftObject) + ' This method is called, when a path marker reaches the end of the path and is about to bounce backwards. + Return 0 + End + '------------------------------------------ + Method OnMarkerCircle:Int(marker:ftMarker, obj:ftObject) + ' This method is called, when a path marker reaches the end of the path and is about to do another circle. + Return 0 + End + '------------------------------------------ + Method OnMarkerStop:Int(marker:ftMarker, obj:ftObject) + ' This method is called, when a path marker reaches the end of the path and stops there. + Return 0 + End + '------------------------------------------ + Method OnMarkerWarp:Int(marker:ftMarker, obj:ftObject) + ' This method is called, when a path marker reaches the end of the path and is about to warp to the start to go on. + Return 0 + End + '------------------------------------------ + Method OnMarkerWP:Int(marker:ftMarker, obj:ftObject) + ' This method is called, when a path marker reaches a waypoint of its path. + Return 0 + End + '------------------------------------------ + Method OnSwipeDone:Int(touchIndex:Int, sAngle:Float, sDist:Float, sSpeed:Float) + ' This method is called when a swipe gesture was detected + Return 0 + End + '------------------------------------------ + Method OnTimer:Int(timerId:Int) + ' This method is called when an engine timer was being fired. + Return 0 + End +End + +'*************************************** +Function Main:Int() + ' Create an instance of the cGame class and store it inside the global var '_g' + _g = New cGame + + Return 0 +End + diff --git a/examples/Test/Test.data/ground.png b/examples/Test/Test.data/ground.png new file mode 100644 index 0000000000000000000000000000000000000000..0d383539b0d85239f4f7b1aa3a918230b5377911 GIT binary patch literal 1560 zcmV+z2Iu*SP)G$ z1la|7nE-x(0LeS#9kR*BPO{1bWDx{`7lz@6?R2-gAyd?)INa$BSzL#qi#r~ zWn*3nK`T`B6HR6urp8J@ys3dtwgG2_<>j=vUiez(yyt9^69PI|H3l^0H;Xjc;cN1v5s4&j)^LGzBiD06=Ly<3&Yb9Qnp?R#={;IfZcuAvozr zXej{tjaXeQD#r7Q58v#emEd77x)T9_NmlJ0_rS%xp3_qBpj%_F2$aV0{j}ns6%eX= zxD)C-6DW+oQ7_ZNU|c=djTEt#YXWI*08b}Us|}6hxr3F~?H%{PG&igNok%q!08ngf zE~@=Nx0&0Qt4mAsYIQ6r#G1fT6r4>8CRxo=O0fd~&`UIr1__T3TXdq`Ym#FBKB%wg za$Zqd&m^x{?e4{zG&494|NQTSkAE;|Tt^KIKYG;XWJ8>f?>j#G@&dm+wG@y9&3)T; zJ})_+m-YJV!B(gkwgLd=rR8tmrWosxnGOul2;n7RXSW6ys*JU_Vf_H`q z_mTi11X@W>`Z2AI2<=?pK|7=yX)YEO)7j{6a6kMQC^ z?u=cN*c*YPcF3?@>tMX7IG>etBeipHuWO@u#ZjjjmE1U9&dOZ^{aCM@8&{{u|6@Y1 zda^GU6|=$+YXx{p>nTjLwyX%WBZc!Y$ql1fx%qCtwhdbWtx)kS%~xZE@sze|G%R}w zoJ|U#xU= z-;MLti+C%6m(!y09(F^$x6a>G`L&cg>#g&gO$z)H`IQ9brR99OP8lIU?b%_R=X|X0BKe=LUz+>%Nv@I@P-$4G_P>}77;>S&GZI{S^9Avo?hm7Jh7Iv zLq#i6I~CFR{XK_zn@QeK52?_ zk{SN>Y|2mG>JuqR5-O5Fp@A9D*(UHT%}GK z@jT6m13?rhyx{X&KThvvo^)XuFUq}X8EMHI{g_Y-1dOGWAE>`RNk<>QJ^Z~F;#9yJ zz}-KGRwjr8$)FX`iS?>+iM3?d4tdxMQBqt1e^65X^4Fg~dHO%q4uQM)(L}=l0000< KMNUMnLSTZRwA)?) literal 0 HcmV?d00001 diff --git a/examples/Text/FontMachine/FontMachine.cxs b/examples/Text/FontMachine/FontMachine.cxs index 7b1840a..955a905 100644 --- a/examples/Text/FontMachine/FontMachine.cxs +++ b/examples/Text/FontMachine/FontMachine.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: Fontmachine.monkey + Script: Fontmachine.cxs Description: Sample script that shows how to handle fontmachine bitmap fonts Author: Michael Hartlef - Version: 2.01 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Text/MultilineText/MultilineText.cxs b/examples/Text/MultilineText/MultilineText.cxs index 59da0d9..965c3fd 100644 --- a/examples/Text/MultilineText/MultilineText.cxs +++ b/examples/Text/MultilineText/MultilineText.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: MultilineText.Cerberus X + Script: MultilineText.cxs Description: Sample fantomCX script, that shows how to use multiline text objects Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/TileMaps/DynamicMap/DynamicMap.cxs b/examples/TileMaps/DynamicMap/DynamicMap.cxs index 09db63e..f074c71 100644 --- a/examples/TileMaps/DynamicMap/DynamicMap.cxs +++ b/examples/TileMaps/DynamicMap/DynamicMap.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: DynamicMap.monkey + Script: DynamicMap.cxs Description: Example script on how to self build a (dynamic) map. Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #end ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/TileMaps/EndlessMap/EndlessMap.cxs b/examples/TileMaps/EndlessMap/EndlessMap.cxs index 7b75fa0..22dbe14 100644 --- a/examples/TileMaps/EndlessMap/EndlessMap.cxs +++ b/examples/TileMaps/EndlessMap/EndlessMap.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: endlessMap.monkey + Script: endlessMap.cxs Description: Sample script that illustrates how to build an endless map Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/TileMaps/Platformer/Platformer.cxs b/examples/TileMaps/Platformer/Platformer.cxs index 8e08158..2358522 100644 --- a/examples/TileMaps/Platformer/Platformer.cxs +++ b/examples/TileMaps/Platformer/Platformer.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: Platformer.monkey + Script: Platformer.cxs Description: Sample script which shows how to create a platfomer type of game using Tiled maps Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/TileMaps/Platformer_Physics/Platformer_Physics.cxs b/examples/TileMaps/Platformer_Physics/Platformer_Physics.cxs index 8e9ceea..f5049b9 100644 --- a/examples/TileMaps/Platformer_Physics/Platformer_Physics.cxs +++ b/examples/TileMaps/Platformer_Physics/Platformer_Physics.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: Platformer.monkey + Script: Platformer.cxs Description: Sample script which shows how to create a platfomer type of game using Tiled maps and box2D physics Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/TileMaps/Tiled/MultiTileSets.cxs b/examples/TileMaps/Tiled/MultiTileSets.cxs index 6dd9c07..4b0181a 100644 --- a/examples/TileMaps/Tiled/MultiTileSets.cxs +++ b/examples/TileMaps/Tiled/MultiTileSets.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: MultiTileSets.monkey + Script: MultiTileSets.cxs Description: Example script on how to use tilemaps with more than one tile set Author: Michael Hartlef - Version: 2.0 + Version: 30 #end ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/TileMaps/Tiled/Tiled.cxs b/examples/TileMaps/Tiled/Tiled.cxs index 4f9967d..8187e48 100644 --- a/examples/TileMaps/Tiled/Tiled.cxs +++ b/examples/TileMaps/Tiled/Tiled.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: Tiled.monkey + Script: Tiled.cxs Description: Example script on how to use tilemaps created by the tool Tiled Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #end ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called @@ -106,7 +106,7 @@ Class cGame Extends App txtInfo3 = fE.CreateText(font,"Obj=????",10,fE.GetCanvasHeight()/2.0, fE.taCenterLeft) txtInfo3.SetName("txtInfo3") - + Return 0 End '------------------------------------------ @@ -147,17 +147,18 @@ Class cGame Extends App If KeyDown(KEY_DOWN) Then fE.SetCamY(5*timeDelta,True) 'Update the info text objects - txtInfo1.SetText("FPS:"+fE.GetFPS()) - txtInfo2.SetText(x+":"+y+" tileID="+tm.GetTileIDAt(x,y)) + + If txtInfo1 <> Null Then txtInfo1.SetText("FPS:"+fE.GetFPS()) + If txtInfo2 <> Null Then txtInfo2.SetText(x+":"+y+" tileID="+tm.GetTileIDAt(x,y)) 'Check which object on the layers is under the cursor and outout its name If layerGUI.GetObjAt(x,y) <> Null Then - txtInfo3.SetText("Obj="+layerGUI.GetObjAt(x,y).GetName()) + If txtInfo3 <> Null Then txtInfo3.SetText("Obj="+layerGUI.GetObjAt(x,y).GetName()) Else If layerMap.GetObjAt(x,y) = objCircle Then - txtInfo3.SetText("Obj="+layerMap.GetObjAt(x,y).GetName()) + If txtInfo3 <> Null Then txtInfo3.SetText("Obj="+layerMap.GetObjAt(x,y).GetName()) Else - txtInfo3.SetText("Obj=????") + If txtInfo3 <> Null Then txtInfo3.SetText("Obj=????") Endif Endif @@ -173,6 +174,11 @@ Class cGame Extends App ' Render all objects fE.Render() + 'tm.Render() + + ' Now draw the current FPS value to the screen + fE.SetColor(255, 255, 0) + fE.GetCanvas().DrawText( "FPS= "+fE.GetFPS(),fE.GetLocalX(10), fE.GetLocalY(10)) ' Last, flip the previously drawn content to the screen, make it visible fE.RenderFlush() diff --git a/examples/TileMaps/Tiled/TiledIsometric.cxs b/examples/TileMaps/Tiled/TiledIsometric.cxs index f882f66..3faa8b9 100644 --- a/examples/TileMaps/Tiled/TiledIsometric.cxs +++ b/examples/TileMaps/Tiled/TiledIsometric.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: TiledIsometric.monkey + Script: TiledIsometric.cxs Description: Example script on how to use isometric tilemaps created by the tool Tiled Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #end ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Timers/Timers.cxs b/examples/Timers/Timers.cxs index 96c8d30..a1a4112 100644 --- a/examples/Timers/Timers.cxs +++ b/examples/Timers/Timers.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: Timer.monkey + Script: Timer.cxs Description: Sample script to show how to use timer Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Transitions/ObjectTransition/ObjectTransition.cxs b/examples/Transitions/ObjectTransition/ObjectTransition.cxs index cade536..f55888d 100644 --- a/examples/Transitions/ObjectTransition/ObjectTransition.cxs +++ b/examples/Transitions/ObjectTransition/ObjectTransition.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: ObjectTransition.monkey + Script: ObjectTransition.cxs Description: Sample script that shows how to use transitions to transform objects Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Transitions/ObjectTransition/ObjectTransitionImage.cxs b/examples/Transitions/ObjectTransition/ObjectTransitionImage.cxs index 4440886..957907a 100644 --- a/examples/Transitions/ObjectTransition/ObjectTransitionImage.cxs +++ b/examples/Transitions/ObjectTransition/ObjectTransitionImage.cxs @@ -1,10 +1,10 @@ Strict #rem - Script: ObjectTransitionImage.monkey + Script: ObjectTransitionImage.cxs Description: Sample script that shows how to use transitions to transform image objects Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called diff --git a/examples/Waypoints/Waypoints.cxs b/examples/Waypoints/Waypoints.cxs index 36561a8..ab79c35 100644 --- a/examples/Waypoints/Waypoints.cxs +++ b/examples/Waypoints/Waypoints.cxs @@ -2,10 +2,10 @@ Strict #rem - Script: Waypoints.monkey + Script: Waypoints.cxs Description: Example script on how to use waypoints Author: Michael Hartlef - Version: 2.0 + Version: 3.0 #End ' Set the AutoSuspend functionality to TRUE so OnResume/OnSuspend are called