Initial commit

This commit is contained in:
2025-07-17 20:36:20 +02:00
commit 069402c4ec
37 changed files with 7849 additions and 0 deletions

181
MoveEngine.pbi Normal file
View File

@@ -0,0 +1,181 @@
Structure MoveEngine
MoveStartTime.q
StartValue.f
EndValue.f
StartTime.l
Duration.l
Easing.l
Event.l
AutoDestroySprites.b
ValueType.l ; #PB_Long / #PB_Float
*ValueL.Long; Each field (Long, Float resides at the
*ValueF.Float ; same address in memory.
*AutoDestroy.Byte ;
EndStructure
Global NewList MoveEngine.MoveEngine()
Procedure AddmoveToEngine(*Value,ValueType.l,StartTime.l,Duration.l,StartValue.f,EndValue.f,Easing.l,Event.l=-1,*AutoDestroy=0)
AddElement(MoveEngine())
MoveEngine()\ValueType=ValueType
Select MoveEngine()\ValueType
Case #PB_Long
MoveEngine()\ValueL=*Value
;Debug "AddmoveToEngine() Long Value="+Str(*Value)
Case #PB_Float
MoveEngine()\ValueF=*Value
;Debug "AddmoveToEngine() Float Value="+Str(*Value)
EndSelect
MoveEngine()\StartTime=StartTime
MoveEngine()\Duration=Duration
MoveEngine()\StartValue=StartValue
MoveEngine()\EndValue=EndValue
MoveEngine()\Easing=Easing
MoveEngine()\Event=Event
MoveEngine()\AutoDestroy=*AutoDestroy
EndProcedure
Procedure RunMoveEngine()
Protected ThisStartTime.q
Protected ThisEndTime.q
Protected ElapsedTime.l
If ListSize(MoveEngine())>0
ForEach MoveEngine()
If MoveEngine()\MoveStartTime=0
MoveEngine()\MoveStartTime=ElapsedMilliseconds()
EndIf
ThisStartTime=MoveEngine()\MoveStartTime+MoveEngine()\StartTime
ThisEndTime=ThisStartTime+MoveEngine()\Duration
If ElapsedMilliseconds()>=ThisStartTime And ElapsedMilliseconds()<=ThisEndTime
ElapsedTime=ElapsedMilliseconds()-ThisStartTime
If MoveEngine()\ValueL<>0 Or MoveEngine()\ValueF<>0
Select MoveEngine()\ValueType
Case #PB_Long
MoveEngine()\ValueL\l=GetEasingPosValue(MoveEngine()\StartValue, MoveEngine()\EndValue,ThisStartTime, MoveEngine()\Duration, MoveEngine()\Easing)
Case #PB_Float
MoveEngine()\ValueF\f=GetEasingPosValue(MoveEngine()\StartValue, MoveEngine()\EndValue,ThisStartTime, MoveEngine()\Duration, MoveEngine()\Easing)
EndSelect
EndIf
;At the End
ElseIf ElapsedMilliseconds()>=ThisEndTime
If MoveEngine()\ValueL<>0 Or MoveEngine()\ValueF<>0
Select MoveEngine()\ValueType
Case #PB_Long
MoveEngine()\ValueL\l=MoveEngine()\EndValue
Case #PB_Float
MoveEngine()\ValueF\f=MoveEngine()\EndValue
EndSelect
EndIf
;new Event
If MoveEngine()\Event>-1
PostEventGUI(MoveEngine()\Event)
MoveEngine()\Event=-1
EndIf
If MoveEngine()\AutoDestroy<>0
MoveEngine()\AutoDestroy\b=#True
EndIf
DeleteElement(MoveEngine())
EndIf
Next
EndIf
EndProcedure
Procedure ClearMoveEngine()
ClearList(MoveEngine())
EndProcedure
Enumeration
#Type_Sprite
#Type_BitmapText
#Type_DisplayMenu
#Type_DisplayTitle
#Type_DisplayBench
#Type_DisplayCursor
#Type_DisplayScore
#Type_DisplayMessage
#Type_DisplayBonus
#Type_DisplayEarthQuakeFall
#Type_DisplayTimer
EndEnumeration
Structure DisplayEngine
Type.l
*Pointer
EndStructure
Global NewList DisplayEngine.DisplayEngine()
Procedure RenderingDisplayEngine()
Protected *SprPointer.SpriteData
Protected *TxtPointer.TextData
ForEach DisplayEngine()
Select DisplayEngine()\Type
Case #Type_Sprite
*SprPointer=DisplayEngine()\Pointer
If *SprPointer\AutoDestroy=#True
ForEach Sprites()
If Sprites()=*SprPointer
DeleteElement(Sprites())
Debug "DeleteElement(Sprites())"
Break;
EndIf
Next
DeleteElement(DisplayEngine())
Debug "DeleteElement(DisplayEngine())"
Else
myDisplaySprite(DisplayEngine()\Pointer)
EndIf
Case #Type_BitmapText
*TxtPointer=DisplayEngine()\Pointer
If *TxtPointer\AutoDestroy=#True
ForEach Sprites()
If Sprites()=*TxtPointer
DeleteElement(Sprites())
Break;
EndIf
Next
DeleteElement(DisplayEngine())
Else
DisplayText(DisplayEngine()\Pointer)
EndIf
Case #Type_DisplayMenu
DisplayMenu()
Case #Type_DisplayTitle
DisplayTitles()
Case #Type_DisplayBench
DisplayBench()
Case #Type_DisplayCursor
DisplayCursor()
Case #Type_DisplayScore
DisplayScore()
Case #Type_DisplayMessage
DisplayMessage()
Case #Type_DisplayBonus
DisplayBonus()
Case #Type_DisplayEarthQuakeFall
DisplayEarthQuakeFall()
Case #Type_DisplayTimer
DisplayTimer()
EndSelect
Next
EndProcedure
Procedure AddItemToDisplayEngine(*Pointer,Type.l,InsertIndex.l=-1)
AddElement(DisplayEngine())
DisplayEngine()\Pointer=*Pointer
DisplayEngine()\Type=Type
ProcedureReturn ListIndex(DisplayEngine())
EndProcedure
Procedure ClearDisplayEngine()
ClearList(DisplayEngine())
EndProcedure
; IDE Options = PureBasic 6.00 Beta 6 (Windows - x64)
; CursorPosition = 27
; FirstLine = 18
; Folding = --
; EnableXP