Bin jetzt vorläufig fertig mit dem Tile Interface
Für jeden Spritesheet wird ein Tile Interface erstellt.
Jedes Tile kann einzeln oder als Animation gerendert werden.
Das Start/End Frame sowie die Animationszeit kann geändert werden.
Optional kann die Animation als Oneshot abgespielt werden.
Der Animationsmodus kann geändert werden.
Alle Tiles können auch auf ein Layer gepusht werden.
Interface:
Code: Alles auswählen
;PureBasic v.5.62
Interface TILE
TileWidth.f()
TileHeight.f()
TileCenterX.f()
TileCenterY.f()
TileResize.i(Width.f,Height.f)
TileResetSize.i()
Animate.i(Flag.b = -1)
AnimateOnce.i(Flag.b = -1)
FrameClock(Clock.i = -1)
Frame.i()
Frames.i()
FrameStart.i(Index.i = -1)
FrameEnd.i(Index.i = -1)
FrameReset(Zero.b = #False)
TileDraw.i(Index.i,X.f,Y.f,Center.b = #False,Alpha.a = #Null)
TileDrawFx.i(Index.i,X.f,Y.f,Center.b = #False,Alpha.a = #Null,Angle.f = #Null,Tint.l = #Null)
TilePushDraw(Layer.i,Index.i,X.f,Y.f,Center.b = #False,Alpha.a = #Null)
TilePushDrawFx(Layer.i,Index.i,X.f,Y.f,Center.b = #False,Alpha.a = #Null,Angle.f = #Null,Tint.l = #Null)
TileShape.i(Index.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.b = #False,Alpha.a = #Null)
TileShapeFx.i(Index.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.b = #False,Alpha.a = #Null,Angle.f= #Null,Tint.l = #Null)
TilePushShape(Layer.i,Index.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.b = #False,Alpha.a = #Null)
TilePushShapeFx(Layer.i,Index.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.b = #False,Alpha.a = #Null,Angle.f = #Null,Tint.l = #Null)
TileLight.i(Index.i,X.f,Y.f,Center.b = #False,Tint.l = #Null)
TileLightFx.i(Index.i,X.f,Y.f,Center.b = #False,Angle.f = #Null,Tint.l = #Null)
TilePushLight(Layer.i,Index.i,X.f,Y.f,Center.b = #False,Tint.l = #Null)
TilePushLightFx(Layer.i,Index.i,X.f,Y.f,Center.b = #False,Angle.f = #Null,Tint.l = #Null)
TileShapeLight.i(Index.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.b = #False,Tint.l = #Null)
TileShapeLightFx.i(Index.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.b = #False,Angle.f = #Null,Tint.l = #Null)
TilePushShapeLight(Layer.i,Index.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.b = #False,Tint.l = #Null)
TilePushShapeLightFx(Layer.i,Index.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.b = #False,Angle.f = #Null,Tint.l = #Null)
TileCreateCopy.i()
Release.i()
EndInterface
Momentan wird der Render Context (bzw. das Hauptinterface) der Engine mit dem Fenster Handle (WindowID()) initialisiert.
Alle PureBasic Funktionen bleiben erhalten!
So wird die Engine (momentan) eingebunden:
Code: Alles auswählen
;PureBasic v.5.62
Procedure.i Main(Title.s,Width.i,Height.i,ViewWidth.i,ViewHeight.i)
Protected Window.i
Protected WindowHandle.i
Protected WindowFlags.i
Protected WindowMsg.i
;--------------------------
Protected *engine.ENGINE
;--------------------------
WindowFlags|#PB_Window_SystemMenu|#PB_Window_ScreenCentered
WindowFlags|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget
WindowFlags|#PB_Window_SizeGadget
Window = OpenWindow(#PB_Any,#Null,#Null,Width,Height,Title,WindowFlags)
If Window
WindowHandle = WindowID(Window)
*engine = EngineCreate(WindowHandle,Width,Height,30);width and height here are the viewport size! - fps can be set freely between 30 and 80!
If *engine
Repeat
Repeat
WindowMsg = WindowEvent();PureBasics message & event handling stays fully intact!
If WindowMsg = #PB_Event_CloseWindow
Break 2
EndIf
Until WindowMsg = #Null
*engine\RenderBegin()
;------------------------------------------
;//draw stuff
;------------------------------------------
*engine\RenderEnd()
EndIf
If *engine\RenderClock();game timer - with deltatime & fps
;does not hog cpu like PureBasics SetFrameRate() (unusable) -> i made a bug report but so far it was not addressed!
;-> https://www.purebasic.fr/english/viewtopic.php?f=4&t=69315&hilit=SetFramerate
Break
EndIf
ForEver
*engine\Release();release all resources (includes all loaded sprites and tiles (spritesheets))
EndIf
CloseWindow(Window)
EndIf
EndProcedure
Auch muss ich noch herausfinden wie ich FullScreen realisiere (#WS_POPUP + ChangeDisplaySettings_()).
Bin bei ~3000 lines of code
Für Tipps und Anregungen zu FullScreen & eigenes Fenster ja/nein wäre ich dankbar (warum das PureBasic Fenster behalten?).