Aktuelle Zeit: 18.10.2019 01:05

Alle Zeiten sind UTC + 1 Stunde [ Sommerzeit ]




Ein neues Thema erstellen Auf das Thema antworten  [ 22 Beiträge ]  Gehe zu Seite 1, 2, 3  Nächste
Autor Nachricht
 Betreff des Beitrags: [ENGINE] 2D Engine Nautilus (Win)
BeitragVerfasst: 23.06.2019 13:21 
Offline
Benutzeravatar

Registriert: 25.09.2016 01:42
Nautilus ist eine kleine 2D Engine (OpenGL)
Aktuelle Version: 1.04

Download:
Version 1.04

Der Download enthält Beispiele :wink:

Features:
- Einfache Integration in die PureBasic Umgebung
- Libraries für 32 und 64 Bit
- Rendern von Tiles, Sprites und Text (verformt / skaliert / rotiert / eingefärbt)
- Animationssystem für Tiles
- 10 Zeichenebenen (Layer 0 - 9 oder unlimitiert in Folge)
- Funktionen für Maus & Tastatureingaben (Maus kann versteckt und oder auf den Zeichenbereich begrenzt werden)
- Kollisionsabfragen für Linien, Quadrate, Tiles und Sprites
- Pathfinding (AStar)
- 2D Tilemap und Kamerafunktionen

Sonstiges:
Unterstützt wird bisher nur Windows.
Funktioniert nur mit einem Unicode Compiler.
Bisher gibt es noch keine Dokumentation aber die meisten Funktionen sind selbsterklärend.

Das Include für einen Übersicht der Funktionen:
Code:
;Nautilus Engine v.1.04

Enumeration
  #NE_WINDOW_NORMAL
  #NE_WINDOW_SIZEABLE
  #NE_WINDOW_POPUP
  #NE_WINDOW_FULLSCREEN
EndEnumeration

#NE_VERSION = 1004

CompilerIf  #PB_Compiler_Processor = #PB_Processor_x86
  Import "ne32.lib"
    nautilusCreate(hWnd.i,ScreenWidth.i = 320,ScreenHeight.i = 200,FPS.i = 60)
    nautilusWindow.i(Title.s,Width.i,Height.i,Mode.i = #NE_WINDOW_NORMAL,ScreenWidth.i = 320,ScreenHeight.i = 200,FPS.i = 60)
    nautilusVersion.i()
  EndImport
CompilerElse
  Import "ne64.lib"
    nautilusCreate(hWnd.i,ScreenWidth.i = 320,ScreenHeight.i = 200,FPS.i = 60)
    nautilusWindow.i(Title.s,Width.i,Height.i,Mode.i = #NE_WINDOW_NORMAL,ScreenWidth.i = 320,ScreenHeight.i = 200,FPS.i = 60)
    nautilusVersion.i()
  EndImport
CompilerEndIf

Structure NE_VECTOR
  x.f
  y.f
EndStructure

Structure NE_INDEX
  x.i
  y.i
EndStructure

Structure NE_CLAMP
  min.NE_INDEX
  max.NE_INDEX
EndStructure

Structure NE_WORLD_ENTRY_STRUCT
  index.NE_INDEX
  offset.NE_VECTOR
  link.i
EndStructure

Structure NE_WORLD_STRUCT
  size.i
  Array entry.NE_WORLD_ENTRY_STRUCT(0,0)
EndStructure

Interface NAUTILUS_WORLD
  Tiles.i()
  TilesX.i()
  TilesY.i()
  TileWidth.i()
  TileHeight.i()
  CameraCreate.i(X.f,Y.i,Width.f,Height.f)
  CameraOrigin.i(Camera.i,*Origin,*Offset = #Null)
  CameraOriginIndex.i(Camera.i,*Origin,*Offset = #Null)
  CameraMove.i(Camera.i,*Move,*Offset = #Null)
  CameraMoveIndex.i(Camera.i,*Move,*Offset = #Null)
  CameraIndex.i(Camera.i,*Index)
  CameraPosition.i(Camera.i,*Position)
  CameraClamp.i(Camera.i,TilesX.i = 2,TilesY.i = 2)
  CameraZoom.f(Camera.i,Min.f,Max.f,*Scale = #Null)
  CameraScale.f(Camera.i)
  CameraUpdate.i(Camera.i,*Clamp = #Null,*Translation = #Null)
  CameraDestroy.i(Camera.i)
  Mouse.i(Camera.i,*Mouse,*Position,*Index = #Null)
  WorldToScreen.i(Camera.i,*Input,*Output)
  ScreenToWorld.i(Camera.i,*Input,*Output)
  TileMapCreate.i()
  TileMapToScreen.i(Camera.i,X.i,Y.i,*Position,*Link = #Null)
  TileMapSet.i(X.i,Y.i,Link.i)
  TileMapGet.i(X.i,Y.i)
  TileMapDestroy.i()
  ProjectionFx.i(*Origin,*Target,*Position,Factor.f = 10)
  Release.i()
EndInterface

Interface NAUTILUS_LOGIC
  TestBox.i(X1.f,Y1.f,W1.f,H1.f,X2.f,Y2.f,W2.f,H2.f)
  TestBoxEx.i(*PosA,W1.f,H1.f,*PosB,W2.f,H2.f)
  TestSpriteBox.i(X1.f,Y1.f,*SpriteA,X2.f,Y2.f,*SpriteB)
  TestSpriteBoxEx.i(*PosA,*SpriteA,*PosB,*SpriteB)
  TestLine.i(*a,*b,*c,*d,*e)
  TestLineEx.i(*LineA,*LineB,*Offset)
  TestCircle.i(X1.f,Y1.f,R1.f,X2.f,Y2.f,R2.f)
  TestCircleEx.i(*PosA,R1.f,*PosB,R2.f)
  TestPointBox.i(PX.f,PY.f,X.f,Y.f,W.f,H.f)
  TestPointBoxEx.i(*Point,*Pos,W.f,H.f)
  TestSpritePoint.i(PX.f,PY.f,X.f,Y.f,*Sprite)
  TestSpritePointEx.i(*Point,*Pos,*Sprite)
  Distance.f(*PosA,*PosB)
  AStarMaskCreate.i(*Buffer,Width.i,Height.i)
  AStarMaskWidth.i(*Mask)
  AStarMaskHeight.i(*Mask)
  AStarMaskSet.i(*Mask,X.i,Y.i,Flag.b = #True)
  AStarMaskGet.i(*Mask,X.i,Y.i)
  AStarMaskFree.i(*Mask)
  AstarPathDistance.i(*Start,*Stop)
  AStarPathCreate.i(*Mask,*Start,*Stop,Diagonal.i = #False,Smooth.i = #False,Distance.i = #Null,Nodes.i = #Null)
  AStarPath.i(*Path,*Offset)
  AStarPathGet.i(*Path)
  AStarPathSet.i(*Path,Node.i = #Null)
  AStarPathFree.i(*Path)
EndInterface

Interface NAUTILUS_FONT
  Width.f()
  Height.f()
  CenterX.f()
  CenterY.f()
  Resize.i(Width.f,Height.f)
  ResetSize.i()
  SpacingGet.f()
  SpacingSet.i(Spacing.f = #Null)
  SpacingRese.i()
  Draw.i(X.f,Y.f,Text.s,CenterX.i = #False,CenterY.i = #False,Alpha.a = #Null,Tint.i = #Null)
  DrawEx.i(X.f,Y.f,Text.s,CenterX.i = #False,CenterY.i = #False,Alpha.a = #Null,Angle.f = #Null,Tint.i = #Null)
  DrawMod.i(X.f,Y.f,Text.s,Width.f = #Null,Height.f = #Null,CenterX.i = #False,CenterY.i = #False,Alpha.a = #Null,Tint.i = #Null)
  DrawModEx.i(X.f,Y.f,Text.s,Width.f = #Null,Height.f = #Null,CenterX.i = #False,CenterY.i = #False,Alpha.a = #Null,Angle.f = #Null,Tint.i = #Null)
  Light.i(X.f,Y.f,Text.s,CenterX.i = #False,CenterY.i = #False,Tint.i = #Null)
  LightEx.i(X.f,Y.f,Text.s,CenterX.i = #False,CenterY.i = #False,Angle.f = #Null,Tint.i = #Null)
  LightMod.i(X.f,Y.f,Text.s,Width.f = #Null,Height.f = #Null,CenterX.i = #False,CenterY.i = #False,Tint.i = #Null)
  LightModEx.i(X.f,Y.f,Text.s,Width.f = #Null,Height.f = #Null,CenterX.i = #False,CenterY.i = #False,Angle.f = #Null,Tint.i = #Null)
  LayerDraw.i(Layer.i,X.f,Y.f,Text.s,CenterX.i = #False,CenterY.i = #False,Alpha.a = #Null,Tint.i = #Null)
  LayerDrawEx.i(Layer.i,X.f,Y.f,Text.s,CenterX.i = #False,CenterY.i = #False,Alpha.a = #Null,Angle.f = #Null,Tint.i = #Null)
  LayerMod.i(Layer.i,X.f,Y.f,Text.s,Width.f = #Null,Height.f = #Null,CenterX.i = #False,CenterY.i = #False,Alpha.a = #Null,Tint.i = #Null)
  LayerModEx.i(Layer.i,X.f,Y.f,Text.s,Width.f = #Null,Height.f = #Null,CenterX.i = #False,CenterY.i = #False,Alpha.a = #Null,Angle.f = #Null,Tint.i = #Null)
  LayerLight.i(Layer.i,X.f,Y.f,Text.s,CenterX.i = #False,CenterY.i = #False,Tint.i = #Null)
  LayerLightEx.i(Layer.i,X.f,Y.f,Text.s,CenterX.i = #False,CenterY.i = #False,Angle.f = #Null,Tint.i = #Null)
  LayerLightMod.i(Layer.i,X.f,Y.f,Text.s,Width.f = #Null,Height.f = #Null,CenterX.i = #False,CenterY.i = #False,Tint.i = #Null)
  LayerLightModEx.i(Layer.i,X.f,Y.f,Text.s,Width.f = #Null,Height.f = #Null,CenterX.i = #False,CenterY.i = #False,Angle.f = #Null,Tint.i = #Null)
  Release.i()
EndInterface

Interface NAUTILUS_SPRITE
  Width.f()
  Height.f()
  CenterX.f()
  CenterY.f()
  Resize.i(Width.f,Height.f)
  ResetSize.i()
  Draw.i(X.f,Y.f,Center.i = #False,Alpha.a = #Null)
  DrawEx.i(X.f,Y.f,Center.i = #False,Alpha.a = #Null,Angle.f = #Null,Tint.i = #Null)
  DrawMod.i(X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.i = #False,Alpha.a = #Null)
  DrawModEx.i(X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.i = #False,Alpha.a = #Null,Angle.f = #Null,Tint.i = #Null)
  DrawMap.i(X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null)
  DrawMapEx.i(X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null,AnchorX.f = #Null,AnchorY.f = #Null,Angle.f = #Null,Tint.i = #Null)
  Light.i(X.f,Y.f,Center.i = #False,Tint.i = #Null)
  LightEx.i(X.f,Y.f,Center.i = #False,Angle.f = #Null,Tint.i = #Null)
  LightMod.i(X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.i = #False,Tint.i = #Null)
  LightModEx.i(X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.i = #False,Angle.f = #Null,Tint.i = #Null)
  LightDrawMap.i(X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null)
  LightDrawMapEx.i(X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null,AnchorX.f = #Null,AnchorY.f = #Null,Angle.f = #Null,Tint.i = #Null)
  LayerDraw.i(Layer.i,X.f,Y.f,Center.i = #False,Alpha.a = #Null);14
  LayerDrawEx.i(Layer.i,X.f,Y.f,Center.i = #False,Alpha.a = #Null,Angle.f = #Null,Tint.i = #Null)
  LayerDrawMod.i(Layer.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.i = #False,Alpha.a = #Null)
  LayerDrawModEx.i(Layer.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.i = #False,Alpha.a = #Null,Angle.f = #Null,Tint.i = #Null)
  LayerDrawMap.i(Layer.i,X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null)
  LayerDrawMapEx.i(Layer.i,X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null,AnchorX.f = #Null,AnchorY.f = #Null,Angle.f = #Null,Tint.i = #Null)
  LayerLight.i(Layer.i,X.f,Y.f,Center.i = #False,Tint.i = #Null)
  LayerLightEx.i(Layer.i,X.f,Y.f,Center.i = #False,Angle.f = #Null,Tint.i = #Null)
  LayerLightMod.i(Layer.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.i = #False,Tint.i = #Null)
  LayerLightModEx.i(Layer.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.i = #False,Angle.f = #Null,Tint.i = #Null)
  LayerLightDrawMap.i(Layer.i,X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null)
  LayerLightDrawMapEx.i(Layer.i,X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null,AnchorX.f = #Null,AnchorY.f = #Null,Angle.f = #Null,Tint.i = #Null)
  Release.i()
EndInterface

Interface NAUTILUS_TILE
  Width.f()
  Height.f()
  CenterX.f()
  CenterY.f()
  Resize.i(Width.f,Height.f)
  ResetSize.i()
  Draw.i(Index.i,X.f,Y.f,Center.i = #False,Alpha.a = #Null)
  DrawEx.i(Index.i,X.f,Y.f,Center.i = #False,Alpha.a = #Null,Angle.f = #Null,Tint.i = #Null)
  DrawMod.i(Index.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.i = #False,Alpha.a = #Null)
  DrawModEx.i(Index.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.i = #False,Alpha.a = #Null,Angle.f = #Null,Tint.i = #Null)
  DrawMap.i(Index.i,X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null)
  DrawMapEx.i(Index.i,X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null,AnchorX.f = #Null,AnchorY.f = #Null,Angle.f = #Null,Tint.i = #Null)
  Light.i(Index.i,X.f,Y.f,Center.i = #False,Tint.i = #Null)
  LightEx.i(Index.i,X.f,Y.f,Center.i = #False,Angle.f = #Null,Tint.i = #Null)
  LightMod.i(Index.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.i = #False,Tint.i = #Null)
  LightModEx.i(Index.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.i = #False,Angle.f = #Null,Tint.i = #Null)
  LightDrawMap.i(Index.i,X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null)
  LightDrawMapEx.i(Index.i,X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null,AnchorX.f = #Null,AnchorY.f = #Null,Angle.f = #Null,Tint.i = #Null)
  LayerDraw.i(Layer.i,Index.i,X.f,Y.f,Center.i = #False,Alpha.a = #Null)
  LayerDrawEx.i(Layer.i,Index.i,X.f,Y.f,Center.i = #False,Alpha.a = #Null,Angle.f = #Null,Tint.i = #Null)
  LayerDrawMod.i(Layer.i,Index.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.i = #False,Alpha.a = #Null)
  LayerDrawModEx.i(Layer.i,Index.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.i = #False,Alpha.a = #Null,Angle.f = #Null,Tint.i = #Null)
  LayerDrawMap.i(Layer.i,Index.i,X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null)
  LayerDrawMapEx.i(Layer.i,Index.i,X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null,AnchorX.f = #Null,AnchorY.f = #Null,Angle.f = #Null,Tint.i = #Null)
  LayerLight.i(Layer.i,Index.i,X.f,Y.f,Center.i = #False,Tint.i = #Null)
  LayerLightEx.i(Layer.i,Index.i,X.f,Y.f,Center.i = #False,Angle.f = #Null,Tint.i = #Null)
  LayerLightMod.i(Layer.i,Index.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.i = #False,Tint.i = #Null)
  LayerLightModEx.i(Layer.i,Index.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.i = #False,Angle.f = #Null,Tint.i = #Null)
  LayerLightDrawMap.i(Layer.i,Index.i,X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null)
  LayerLightDrawMapEx.i(Layer.i,Index.i,X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null,AnchorX.f = #Null,AnchorY.f = #Null,Angle.f = #Null,Tint.i = #Null)
  Animation.i(Timer.i = #Null,Active.i = #True,Once.i = #False)
  AnimationState.i(Active.i = #True)
  AnimationOnce.i(Flag.i = #True)
  AnimationFrame.i()
  AnimationFrames.i()
  AnimationStart.i(Index.i = -1)
  AnimationStop.i(Index.i = -1)
  AnimationReset.i(Zero.i = #False)
  CreateCopy.i()
  Release.i()
EndInterface

Interface NAUTILUS_TEXTURE
  Pixel.i()
  PixelSize.i(*Bits)
  PixelGet.i(*Bits,X.i,Y.i)
  PixelSet.i(*Bits,X.i,Y.i,Color.i)
  PixelUpdate.i(X.i,Y.i,Width.i,Height.i,*Bits)
  PixelFree.i(*Bits)
  Bitmap.i(*Bitmap = #Null)
  Width.f()
  Height.f()
  CenterX.f()
  CenterY.f()
  Resize.i(Width.f,Height.f)
  ResetSize.i()
  Draw.i(X.f,Y.f,Center.i = #False,Alpha.a = #Null)
  DrawEx.i(X.f,Y.f,Center.i = #False,Alpha.a = #Null,Angle.f = #Null,Tint.i = #Null)
  DrawMod.i(X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.i = #False,Alpha.a = #Null)
  DrawModEx.i(X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.i = #False,Alpha.a = #Null,Angle.f = #Null,Tint.i = #Null)
  Light.i(X.f,Y.f,Center.i = #False,Tint.i = #Null)
  LightEx.i(X.f,Y.f,Center.i = #False,Angle.f = #Null,Tint.i = #Null)
  LightMod.i(X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.i = #False,Tint.i = #Null)
  LightModEx.i(X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.i = #False,Angle.f = #Null,Tint.i = #Null)
  LayerDraw.i(Layer.i,X.f,Y.f,Center.i = #False,Alpha.a = #Null)
  LayerDrawEx.i(Layer.i,X.f,Y.f,Center.i = #False,Alpha.a = #Null,Angle.f = #Null,Tint.i = #Null)
  LayerDrawMod.i(Layer.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.i = #False,Alpha.a = #Null)
  LayerDrawModEx.i(Layer.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.i = #False,Alpha.a = #Null,Angle.f = #Null,Tint.i = #Null)
  LayerLight.i(Layer.i,X.f,Y.f,Center.i = #False,Tint.i = #Null)
  LayerLightEx.i(Layer.i,X.f,Y.f,Center.i = #False,Angle.f = #Null,Tint.i = #Null)
  LayerLightMod.i(Layer.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.i = #False,Tint.i = #Null)
  LayerLightModEx.i(Layer.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.i = #False,Angle.f = #Null,Tint.i = #Null)
  CreateSprite.i(X.i,Y.i,Width.i,Height.i)
  CreateTile.i(CountX.i,CountY.i,X.i,Y.i,Width.i,Height.i,OffsetX.i = #Null,OffsetY.i = #Null)
  CreateFont.i(CountX.i,CountY.i,X.i,Y.i,Width.i,Height.i,OffsetX.i = #Null,OffsetY.i = #Null)
  Release.i()
EndInterface

Interface NAUTILUS_ENGINE
  Window.i()
  WindowTitle.i(Title.s)
  WindowIcon.i(*Icon)
  WindowRect.i(*Rect)
  WindowSize.i(*Vector)
  WindowCenter.i(*Vector)
  WindowMode.i()
  WindowChange.i(Mode.i,TopMost.i = #False)
  WindowExit.i()
  ScreenSize.i(*Vector)
  ScreenCenter.i(*Vector)
  ScreenFactor.i(*Vector)
  ScreenResize.i(Width.i,Height.i)
  ScreenResetSize.i()
  ScreenVSync.i()
  ScreenVSyncMode.i(Flag.i = #False)
  ScreenCursorClip.i(Flag.i = #True)
  ScreenCursorHide.i(Flag.i = #True)
  RenderAspect(Flag.i = #True)
  RenderFilter(Bilinear.i = #True)
  RenderColor(ColorABGR.i = #Null)
  RenderBegin.i(*Delta = #Null,*Frames = #Null,*Clock = #Null)
  RenderClip.i(X.f,Y.f,Width.f,Height.f)
  RenderUnclip.i()
  RenderPush.i()
  RenderPop.i()
  RenderRotate.i(Angle.f)
  RenderScale.i(X.f,Y.f)
  RenderTranslate.i(X.f,Y.f)
  RenderReset.i()
  RenderEnd.i()
  DrawPointSize.i(Size.f = 1)
  DrawLineSize.i(Size.f = 1)
  DrawPoint.i(X.f,Y.f,ColorABGR.i = $FFFFFFFF)
  DrawCircle.i(X.f,Y.f,Radius.f,Skip.i = #Null,Fill.i = #False,ColorABGR.i = $FFFFFFFF)
  DrawLine.i(X1.f,Y1.f,X2.f,Y2.f,ColorABGR.i = $FFFFFFFF)
  DrawLineEx.i(X1.f,Y1.f,X2.f,Y2.f,C1.i = $FFFFFFFF,C2.i = $FFFFFFFF)
  DrawTriangle.i(X.f,Y.f,Width.f,Height.f,Fill.i = #False,ColorABGR.i = $FFFFFFFF)
  DrawTriangleEx.i(X.f,Y.f,Width.f,Height.f,Fill.i = #False,C1.i = $FFFFFFFF,C2.i = $FFFFFFFF,C3.i = $FFFFFFFF)
  DrawBox.i(X.f,Y.f,Width.f,Height.f,Center.i = #False,Fill.i = #False,ColorABGR.i = $FFFFFFFF)
  DrawBoxEx.i(X.f,Y.f,Width.f,Height.f,Center.i = #False,Fill.i = #False,C1.i = $FFFFFFFF,C2.i = $FFFFFFFF,C3.i = $FFFFFFFF,C4.i = $FFFFFFFF)
  DrawDiamond.i(X.f,Y.f,Width.f,Height.f,Center.i = #False,Fill.i = #False,ColorABGR.i = $FFFFFFFF)
  DrawDiamondEx.i(X.f,Y.f,Width.f,Height.f,Center.i = #False,Fill.i = #False,C1.i = $FFFFFFFF,C2.i = $FFFFFFFF,C3.i = $FFFFFFFF,C4.i = $FFFFFFFF)
  DrawTextWidth.f()
  DrawTextHeight.f()
  DrawTextResize.i(Width.f,Height.f)
  DrawTextResetSize.i()
  DrawTextGetSpacing.f()
  DrawTextSetSpacing.i(Spacing.f)
  DrawTextResetSpacing.i()
  DrawText.i(X.f,Y.f,Text.s,CenterX.i = #False,CenterY.i = #False,Alpha.a = #Null,Tint.i = #Null)
  DrawTextRot.i(X.f,Y.f,Text.s,CenterX.i = #False,CenterY.i = #False,Alpha.a = #Null,Angle.f = #Null,Tint.i = #Null)
  DrawTextMod.i(X.f,Y.f,Text.s,Width.f,Height.f,CenterX.i = #False,CenterY.i = #False,Alpha.a = #Null,Tint.i = #Null)
  DrawTextModEx.i(X.f,Y.f,Text.s,Width.f,Height.f,CenterX.i = #False,CenterY.i = #False,Alpha.a = #Null,Angle.f = #Null,Tint.i = #Null)
  DrawTextLight.i(X.f,Y.f,Text.s,CenterX.i = #False,CenterY.i = #False,Tint.i = #Null)
  DrawTextLightEx.i(X.f,Y.f,Text.s,CenterX.i = #False,CenterY.i = #False,Angle.f = #Null,Tint.i = #Null)
  DrawTextLightMod.i(X.f,Y.f,Text.s,Width.f,Height.f,CenterX.i = #False,CenterY.i = #False,Tint.i = #Null)
  DrawTextLightModEx.i(X.f,Y.f,Text.s,Width.f,Height.f,CenterX.i = #False,CenterY.i = #False,Angle.f = #Null,Tint.i = #Null)
  ListBegin.i()
  ListTexture.i(Flag.i = #False)
  ListMode.i(Mode.i)
  ListPushColor.i(ColorABGR.i = $FFFFFFFF)
  ListPushVertex.i(X.f,Y.f)
  ListPushPoint.i(X.f,Y.f,ColorABGR.i = $FFFFFFFF)
  ListPushCircle.i(X.f,Y.f,Radius.f,Skip.i = #Null,ColorABGR.i = $FFFFFFFF)
  ListPushLine.i(X1.f,Y1.f,X2.f,Y2.f,ColorABGR.i = $FFFFFFFF)
  ListPushLineEx.i(X1.f,Y1.f,X2.f,Y2.f,C1.i = $FFFFFFFF,C2.i = $FFFFFFFF)
  ListPushTriangle.i(X.f,Y.f,Width.f,Height.f,ColorABGR.i = $FFFFFFFF)
  ListPushTriangleEx.i(X.f,Y.f,Width.f,Height.f,C1.i = $FFFFFFFF,C2.i = $FFFFFFFF,C3.i = $FFFFFFFF)
  ListPushBox.i(X.f,Y.f,Width.f,Height.f,Center.i = #False,ColorABGR.i = $FFFFFFFF)
  ListPushBoxEx.i(X.f,Y.f,Width.f,Height.f,Center.i = #False,C1.i = $FFFFFFFF,C2.i = $FFFFFFFF,C3.i = $FFFFFFFF,C4.i = $FFFFFFFF)
  ListPushDiamond.i(X.f,Y.f,Width.f,Height.f,Center.i = #False,ColorABGR.i = $FFFFFFFF)
  ListPushDiamondEx.i(X.f,Y.f,Width.f,Height.f,Center.i = #False,C1.i = $FFFFFFFF,C2.i = $FFFFFFFF,C3.i = $FFFFFFFF,C4.i = $FFFFFFFF)
  ListModeEnd.i()
  ListEnd.i()
  ListDraw.i(ListId.i)
  ListLayer.i(Layer.i,ListId.i)
  ListFree.i(ListId.i)
  LayerPush(Layer.i)
  LayerPop(Layer.i)
  LayerRotate(Layer.i,Angle.f)
  LayerScale(Layer.i,X.f,Y.f)
  LayerTranslate(Layer.i,X.f,Y.f,Origin.i = #False)
  LayerReset(Layer.i)
  LayerDraw()
  InputKey.i(Code.i)
  InputKeySgl.i(Code.i)
  InputKeyChr.i(*Code)
  InputMouse.i(*Vector)
  InputMouseLeft.i()
  InputMouseLeftSgl.i()
  InputMouseLeftDbl.i()
  InputMouseRight.i()
  InputMouseRightSgl.i()
  InputMouseRightDbl.i()
  InputMouseMiddle.i()
  InputMouseMiddleSgl.i()
  InputMouseMiddleDbl.i()
  InputMouseWheel.i(Code.i = #Null,*Value.Integer = #Null)
  CreateTexture.i(*Buffer,File.s = #Null$)
  CreateTextureFont.i(*Buffer,File.s,CharWidth.i,CharHeight.i)
  CreateFont.i(*Buffer,BufferSize.i,FontName.s,Size.i = 12,Bold.i = #False,Italic.i = #False,ColorABGR.i = $FFFFFFFF)
  CreateLogic.i()
  CreateWorld.i(TilesX.i,TilesY.i,TileWidth.i,TileHeight.i)
  Release.i()
EndInterface


Bei Fragen, Anregungen und Kritik einfach melden :)

_________________

Links:
PureBasic Discord
[ENGINE] 2D Engine Nautilus (Win)
[INCLUDE] GLFW 3.3 Library
[MODULE] Bass Library 2.4 (Win)
[LIBRARY] Hexi Binary2Hex (Win)



Zuletzt geändert von Mijikai am 30.08.2019 09:21, insgesamt 39-mal geändert.

Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Re: [ENGINE] 2D Engine Nautilus (Win)
BeitragVerfasst: 29.06.2019 11:20 
Offline
Benutzeravatar

Registriert: 25.09.2016 01:42
Update: Version 0.26 beta

Neue Funktionen um Lichter zu erstellen.

Neue Engine Funktion:
Code:
;...
CreateLight(Width.i,Height.i)
;...


Das Licht Interface:
Code:
Interface NAUTILUS_LIGHT;light texture object/interface created with CreateLight()
  Point.i(X.i,Y.i,Radius.i,ColorARGB.i = $FFFFFFFF)
  PointLinear.i(X.i,Y.i,Radius.i,X1.i,Y1.i,X2.i,Y2.i,ColorARGB.i = $FFFFFFFF)
  Box.i(X.i,Y.i,Width.i,Height.i,ColorARGB.i = $FFFFFFFF)
  BoxLinear.i(X.i,Y.i,Width.i,Height.i,X1.i,Y1.i,X2.i,Y2.i,ColorARGB.i = $FFFFFFFF)
  Area.i(X.i,Y.i,RadiusX.i,RadiusY.i,ColorARGB.i = $FFFFFFFF)
  AreaLinear.i(X.i,Y.i,RadiusX.i,RadiusY.i,X1.i,Y1.i,X2.i,Y2.i,ColorARGB.i = $FFFFFFFF)
  Save.i(File.s)
  CreateAtlas.i()
  Release.i()
EndInterface

_________________

Links:
PureBasic Discord
[ENGINE] 2D Engine Nautilus (Win)
[INCLUDE] GLFW 3.3 Library
[MODULE] Bass Library 2.4 (Win)
[LIBRARY] Hexi Binary2Hex (Win)



Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Re: [ENGINE] 2D Engine Nautilus (Win)
BeitragVerfasst: 30.06.2019 12:29 
Offline
Benutzeravatar

Registriert: 25.09.2016 01:42
Update: Version 0.30 beta

- Optimierung aller Sprite & Tile Funktionen
- Neue Funktionen für Sprites & Tiles (ermöglicht freie Transformation mit Rotation, Tint & Alpha)

Neue Funktionen:
Code:
Interface NAUTILUS_TILE
  ;...
  DrawMap.i(Index.i,X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null)
  DrawMapFx.i(Index.i,X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null,AnchorX.f = #Null,AnchorY.f = #Null,Angle.f = #Null,Tint.l = #Null)
  ;...
  DrawLightMap.i(Index.i,X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null)
  DrawLightMapFx.i(Index.i,X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null,AnchorX.f = #Null,AnchorY.f = #Null,Angle.f = #Null,Tint.l = #Null)
  ;...
  LayerDrawMap.i(Layer.i,Index.i,X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null)
  LayerDrawMapFx.i(Layer.i,Index.i,X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null,AnchorX.f = #Null,AnchorY.f = #Null,Angle.f = #Null,Tint.l = #Null)
  ;...
  LayerLightMap.i(Layer.i,Index.i,X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null)
  LayerLightMapFx.i(Layer.i,Index.i,X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null,AnchorX.f = #Null,AnchorY.f = #Null,Angle.f = #Null,Tint.l = #Null)
  ;...
EndInterface

Interface NAUTILUS_SPRITE
  ;...
  DrawMap.i(X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null)
  DrawMapFx.i(X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null,Angle.f = #Null,AnchorX.f = #Null,AnchorY.f = #Null,Tint.l = #Null)
  ;...
  DrawLightMap.i(X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null)
  DrawLightMapFx.i(X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null,AnchorX.f = #Null,AnchorY.f = #Null,Angle.f = #Null,Tint.l = #Null)
  ;...
  LayerDrawMap.i(Layer.i,X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null)
  LayerDrawMapFx.i(Layer.i,X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null,AnchorX.f = #Null,AnchorY.f = #Null,Angle.f = #Null,Tint.l = #Null)
  ;...
  LayerLightMap.i(Layer.i,X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null)
  LayerLightMapFx.i(Layer.i,X1.f,Y1.f,X2.f,Y2.f,X3.f,Y3.f,X4.f,Y4.f,Alpha.a = #Null,AnchorX.f = #Null,AnchorY.f = #Null,Angle.f = #Null,Tint.l = #Null)
  ;...
EndInterface



Beispiel:
Bild

Code:
Code:
EnableExplicit

;Nautilus Engine Example
;Version: 0.30 beta
;Author: Mijikai

XIncludeFile "nautilus.pbi"

Structure VECTOR_STRUCT
  x.f
  y.f
EndStructure

Procedure.i DrawPlant(*tile.NAUTILUS_TILE,X.f,Y.f,Distortion.f)
  *tile\DrawMap(-1,X + Distortion ,Y      ,X + 64 + Distortion,Y      ,X + 64,Y + 64,X,Y + 64)
  *tile\DrawMap(-1,X              ,Y + 64 ,X + 64             ,Y + 64 ,X + 64 + Distortion,Y + 128,X + Distortion,Y + 128)
  *tile\DrawMap(-1,X + Distortion ,Y +128 ,X + 64 + Distortion,Y + 128,X + 64,Y + 192,X,Y + 192)
EndProcedure

Procedure.i Main(Width.i,Height.i,Title.s,ViewWidth.i,ViewHeight.i,FPS.i)
  Protected win.i
  Protected win_handle.i
  Protected win_flag.i
  Protected win_msg.i
  Protected *engine.NAUTILUS_ENGINE
  Protected engine_delta.f
  Protected engine_fps.i
  Protected engine_error.i
  Protected screen_center.VECTOR_STRUCT
  Protected *atlas.NAUTILUS_ATLAS
  Protected *tile.NAUTILUS_TILE
  Protected dist.f
  Protected dist_flag.b
  win_flag|#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_MinimizeGadget
  win_flag|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget
  win = OpenWindow(#PB_Any,#Null,#Null,Width,Height,Title,win_flag)
  If win
    win_handle = WindowID(win)
    *engine = nautilusCreate(win_handle,ViewWidth,ViewHeight,FPS);init the engine
    If *engine
      *engine\RenderAspect()                ;keep the aspect ratio
      *engine\RenderColor($400A05)          ;change render color
      *engine\RenderFilter()
      *engine\ViewPortCenter(@screen_center);get the screen (viewport) center
      *engine\DrawTextResize(8,12)          ;set new size for standart text drawing with the ENGINE interface
      *engine\DrawTextSetSpacing(6)         ;and set the spacing between chars
      *atlas = *engine\CreateAtlas(?plant,#Null$)
      *tile  = *atlas\CreateTile(4,1,0,0,64,64)
      *tile\Animation(120,#True)
      Repeat
        Repeat
          win_msg = WindowEvent()
          If win_msg = #PB_Event_CloseWindow
            Break 2
          EndIf
        Until win_msg = #Null
        *engine\RenderBegin(@engine_delta,@engine_fps,@engine_error)
       
        If dist_flag
          dist - 0.25 * engine_delta
          If dist < -5
            dist_flag = #False
          EndIf
        Else
          dist + 0.25 * engine_delta
          If dist > 5
            dist_flag = #True
          EndIf
        EndIf
        DrawPlant(*tile,120,100,dist)
        DrawPlant(*tile,220,100,dist)
        DrawPlant(*tile,320,100,dist)
        DrawPlant(*tile,420,100,dist)
        *engine\DrawText(10,10,"Nautilus Engine",#False,#False,200,$FFDFBF)
        *engine\DrawText(10,25,"FPS " + Str(engine_fps),#False,#False,200,$FFDFBF)
        *engine\DrawText(10,40,"DLT " + StrF(engine_delta,2),#False,#False,200,$FFDFBF)
        *engine\RenderEnd()
        If engine_error
          Break
        EndIf
      ForEver
      *engine\Release()
    EndIf
    CloseWindow(win)
  EndIf
EndProcedure

Main(1080,720,"Example Nautilu Engine v.0.30 beta",600,400,30)

End

DataSection
  plant:
  ;{ File: plant.png - Size: 1265 Bytes
  !dw 05089h, 0474Eh, 00A0Dh, 00A1Ah, 00000h, 00D00h, 04849h, 05244h, 00000h, 00001h, 00000h, 04000h, 00208h, 00000h, 07A00h, 03E3Fh, 000E9h, 00000h, 07406h, 04E52h, 00053h, 00000h, 00000h, 06E00h, 007A6h, 00091h, 00000h, 07009h, 05948h, 00073h, 00E00h, 000C4h, 00E00h, 001C4h, 02B95h, 01B0Eh, 00000h, 09104h, 04449h, 05441h
  !dw 0DA78h, 09CEDh, 06E3Dh, 0311Bh, 08510h, 0C5E5h, 05222h, 0C290h, 0D406h, 08545h, 01700h, 00F86h, 052A1h, 001A5h, 0425Fh, 0D077h, 07419h, 05D07h, 080C2h, 0974Bh, 0443Eh, 0C290h, 00B80h, 08155h, 0A4E0h, 00AF2h, 038D8h, 00829h, 00410h, 0E5C9h, 067F2h, 0CB86h, 0DEB5h, 059D7h, 09612h, 0338Fh, 0C8F3h, 01FD9h, 0C5EFh, 09484h
  !dw 087EBh, 0D3BBh, 03FCFh, 0CFF2h, 0DF2Fh, 07DBFh, 0B7BCh, 0D7D5h, 0E3FAh, 06DBDh, 0CD8Fh, 0F6F4h, 0E5EAh, 071FEh, 03052h, 07FD0h, 0FA6Eh, 009ABh, 06700h, 00C0Ch, 06000h, 00000h, 00060h, 06000h, 00000h, 00060h, 06000h, 00000h, 08060h, 05912h, 0D7EEh, 0FDCBh, 0991Ah, 0E703h, 08068h, 04BF2h, 0FE1Fh, 054FCh, 0C806h, 0CB99h
  !dw 0B1DEh, 00FE4h, 0375Eh, 0654Fh, 006DAh, 03FA5h, 015BAh, 0F2A1h, 0A74Ch, 00698h, 04CDFh, 078C6h, 06C64h, 0457Dh, 08FE9h, 0CFABh, 0542Ah, 050E2h, 0F099h, 0D719h, 01BF1h, 02BEDh, 03F6Eh, 093BBh, 01D64h, 0F437h, 03873h, 0448Dh, 03576h, 0C98Ah, 0C2ABh, 0FDDCh, 0C94Fh, 0AE1Bh, 0985Bh, 05798h, 04397h, 0BB42h, 0BE3Eh, 0742Eh
  !dw 07BBCh, 03591h, 095B6h, 08663h, 08279h, 09BDEh, 05500h, 05B8Fh, 0FC92h, 0D876h, 09924h, 0B522h, 0A7B8h, 0B607h, 042C0h, 0E594h, 03BD5h, 041D9h, 07794h, 05A0Dh, 01215h, 0AEDFh, 00DDAh, 0A375h, 01C79h, 009F1h, 09993h, 051DDh, 06D0Ah, 054B4h, 03E91h, 05CEDh, 0D6E6h, 067C8h, 0EB07h, 02FD5h, 0CF3Eh, 05D5Ch, 0430Eh, 09E56h
  !dw 0F54Eh, 02029h, 061EDh, 08D6Eh, 03E7Ah, 0FBFBh, 0B9ABh, 0B87Eh, 05FF3h, 01738h, 055BBh, 092CAh, 0DCB9h, 0E5AFh, 07C11h, 0D388h, 09B4Fh, 0B14Bh, 0A9CBh, 010EDh, 07EB7h, 08B07h, 02ADDh, 0C3C8h, 007A6h, 0E358h, 02BDFh, 0EA4Ch, 0D477h, 0DD58h, 0E26Bh, 06EC5h, 0D875h, 08B3Eh, 0696Fh, 02D93h, 0A68Eh, 02A0Eh, 05886h, 0D7EEh
  !dw 09BAFh, 03927h, 00A6Eh, 07CF5h, 0E666h, 0AF80h, 053C7h, 0A443h, 01B8Eh, 09031h, 0543Ch, 06C7Bh, 0F9EAh, 07F2Ch, 0B0CFh, 0ADD8h, 0E3ACh, 0767Ah, 0DAA1h, 0662Ah, 05E5Dh, 07B59h, 0556Ch, 063BFh, 0DAA0h, 03267h, 01E7Ch, 04AE8h, 04A7Ch, 01C74h, 0493Bh, 0EACEh, 07749h, 01AAFh, 0CF7Fh, 01699h, 05FA5h, 0D870h, 0673Eh, 0BF8Bh
  !dw 0B159h, 05761h, 0DC81h, 04873h, 0469Ch, 06C7Bh, 0B7DAh, 04F93h, 0DBE8h, 04363h, 0DA9Bh, 0FA9Ch, 063DBh, 05843h, 00E3Dh, 0A1FDh, 03221h, 05BF5h, 0085Bh, 0FD6Eh, 099D1h, 0C775h, 0365Fh, 0628Dh, 07F20h, 095FDh, 01CFFh, 0977Ah, 097D2h, 0C7FBh, 0CDE9h, 0E3A5h, 0D307h, 04B9Bh, 0FFF7h, 08A74h, 0D3E3h, 05F46h, 0EFD3h, 07FE8h
  !dw 0A446h, 05ADFh, 0E946h, 0DBFAh, 02363h, 0EAC7h, 0AABAh, 0A893h, 0E1DFh, 04481h, 0AFFDh, 0A79Bh, 0FD2Eh, 026AEh, 0D439h, 062C7h, 0A60Ch, 0D76Dh, 01EACh, 07EC2h, 0EA5Dh, 028E7h, 04D50h, 0C73Fh, 0FC85h, 0FA3Ch, 0F9EBh, 0E98Ch, 0842Eh, 007DCh, 0F568h, 06ECBh, 01DD9h, 0027Fh, 0F003h, 0C1CDh, 07D1Dh, 04BC2h, 04C60h, 03C5Bh
  !dw 0FEABh, 0F1CCh, 0ED67h, 049D1h, 0217Ah, 025C7h, 06B07h, 0BBF5h, 0AA07h, 0AB3Dh, 01E47h, 03085h, 07207h, 05202h, 0B5BDh, 0987Ah, 007CEh, 06A48h, 04C48h, 0ABA1h, 0487Ah, 0786Eh, 04769h, 0E7ABh, 07233h, 0F30Fh, 06E75h, 0FA79h, 0AE88h, 0C7D5h, 0FE27h, 04475h, 06826h, 051D7h, 0FA35h, 0971Ch, 0CC35h, 00A63h, 051A7h, 057E9h
  !dw 04EFBh, 06456h, 0680Ah, 0C03Dh, 0FD5Dh, 06BDCh, 0A268h, 02AFEh, 07AA8h, 06DE4h, 09F1Ah, 0E273h, 0AAA2h, 09AC7h, 07492h, 0DCFDh, 063D5h, 0115Dh, 0E2A8h, 09DAFh, 0B235h, 05A86h, 02B3Bh, 0BB15h, 00965h, 0AFF1h, 072E3h, 0F5A0h, 01173h, 0E40Ah, 033E4h, 0FF57h, 0F4E8h, 0C773h, 0ED5Fh, 0F21Ch, 0FD3Ch, 05EA5h, 01FADh, 0FE3Ch
  !dw 0BA75h, 027B3h, 0F7E1h, 0C44Dh, 03A5Dh, 08F71h, 0F693h, 0B129h, 00F08h, 0BB88h, 029C5h, 0F3FAh, 0353Fh, 0A848h, 07ADFh, 08545h, 0BDDBh, 02F6Ah, 01E97h, 0B8FFh, 023D1h, 0600Dh, 06BD6h, 00E68h, 07AA4h, 09CF3h, 0833Dh, 0B419h, 04578h, 090D4h, 07FA9h, 0E790h, 0E567h, 0A1A0h, 0A435h, 09FE9h, 0FA0Ch, 06678h, 0FC7Ah, 0F513h
  !dw 0445Fh, 08D14h, 06999h, 069A9h, 07B7Ah, 07EE5h, 0E9B9h, 0C7E9h, 04D6Fh, 0E7BDh, 0E410h, 0AFD5h, 03F1Eh, 07F51h, 08B86h, 0D657h, 0A889h, 044BDh, 0FC62h, 087ADh, 060CDh, 07500h, 04D0Dh, 04FD7h, 0127Fh, 059ECh, 0879Ah, 0B3EDh, 033E7h, 05D5Bh, 07BEAh, 0F59Fh, 06D67h, 013ACh, 067F5h, 06F16h, 02466h, 0FE3Dh, 07799h, 07330h
  !dw 0261Fh, 0CFD1h, 003B2h, 05FF8h, 05D5Bh, 056ECh, 00E3Eh, 0EA1Eh, 0D7ACh, 06F67h, 0592Dh, 06F7Fh, 0C622h, 07F12h, 03EC7h, 05F9Ch, 0C07Fh, 0516Bh, 0D77Ah, 01F39h, 0C565h, 0FF56h, 0F4B8h, 0135Bh, 0BA31h, 09BF8h, 070FBh, 0FD7Eh, 097F1h, 00141h, 0E920h, 086DFh, 046A5h, 0C64Ah, 07C82h, 06472h, 04BD4h, 06952h, 061E2h, 05400h
  !dw 059CFh, 09783h, 002E3h, 00018h, 01800h, 00000h, 00018h, 01800h, 00000h, 00018h, 01800h, 00000h, 0C018h, 0F21Bh, 0F357h, 00665h, 0CFFAh, 03F50h, 00076h, 01D80h, 00000h, 08018h, 0F69Bh, 0E4EDh, 06AF3h, 062C1h, 0FE81h, 0A94Fh, 0D29Fh, 03D00h, 0B6AFh, 0F8FBh, 0FBD7h, 0BE6Ah, 08161h, 033FEh, 08FD4h, 00816h, 005A0h, 00002h
  !dw 00006h, 00600h, 00000h, 00006h, 00600h, 00000h, 00006h, 00600h, 00000h, 00006h, 00600h, 00000h, 00006h, 00600h, 00000h, 00006h, 00600h, 00000h, 00006h, 00600h, 06000h, 0FC7Ch, 0BA07h, 0D3D6h, 0562Dh, 0CDB2h, 0009Bh, 00000h, 04900h, 04E45h, 0AE44h, 06042h, 00082h
  ;}
EndDataSection

_________________

Links:
PureBasic Discord
[ENGINE] 2D Engine Nautilus (Win)
[INCLUDE] GLFW 3.3 Library
[MODULE] Bass Library 2.4 (Win)
[LIBRARY] Hexi Binary2Hex (Win)



Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Re: [ENGINE] 2D Engine Nautilus (Win)
BeitragVerfasst: 30.06.2019 14:07 
Offline
Benutzeravatar

Registriert: 23.07.2011 02:08
Hi,

coole Sache. Ich hab mich gefragt, was der Vorteil ggü. den PB-Funktionen ist, aber wie ich sehe hast du eine Light-Engine.
Hast du dafür zufällig ein Beispiel?

_________________
Signatur und so


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Re: [ENGINE] 2D Engine Nautilus (Win)
BeitragVerfasst: 30.06.2019 14:56 
Offline
Benutzeravatar

Registriert: 25.09.2016 01:42
Derren hat geschrieben:
Hi,

coole Sache. Ich hab mich gefragt, was der Vorteil ggü. den PB-Funktionen ist, aber wie ich sehe hast du eine Light-Engine.
Hast du dafür zufällig ein Beispiel?


Ein kleines Beispiel :)

Zwei Lichtquellen die sich überschneiden (werden zusammenaddiert).

Bild

Code:
Code:
EnableExplicit

;Nautilus Engine Example
;Version: 0.30 beta
;Author: Mijikai

XIncludeFile "nautilus.pbi"

Structure VECTOR_STRUCT
  x.f
  y.f
EndStructure

Procedure.i Main(Width.i,Height.i,Title.s,ViewWidth.i,ViewHeight.i,FPS.i)
  Protected win.i
  Protected win_handle.i
  Protected win_flag.i
  Protected win_msg.i
  Protected *engine.NAUTILUS_ENGINE
  Protected engine_delta.f
  Protected engine_fps.i
  Protected engine_error.i
  Protected screen_center.VECTOR_STRUCT
  Protected *light.NAUTILUS_LIGHT
  Protected *light_a.NAUTILUS_ATLAS
  Protected *light_b.NAUTILUS_ATLAS
  win_flag|#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_MinimizeGadget
  win_flag|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget
  win = OpenWindow(#PB_Any,#Null,#Null,Width,Height,Title,win_flag)
  If win
    win_handle = WindowID(win)
    *engine = nautilusCreate(win_handle,ViewWidth,ViewHeight,FPS);init the engine
    If *engine
      *engine\RenderAspect()                ;keep the aspect ratio
      *engine\RenderColor($400A05)          ;change render color
      *engine\RenderFilter()
      *engine\ViewPortCenter(@screen_center);get the screen (viewport) center
      *engine\DrawTextResize(8,12)          ;set new size for standart text drawing with the ENGINE interface
      *engine\DrawTextSetSpacing(6)         ;and set the spacing between chars
     
      *light = *engine\CreateLight(32,128);create a empty light template (sprite)
      *light\BoxLinear(0,0,32,128,16,0,16,128,$FFFF00FF);draw a linar box gradient - the actual light
      ;-> add as many lights as needed
                                               
      ;BoxLinear
      ;-> X & Y + Width & Height -> area (box) of the gradient
      ;-> X1&Y1 / X2&Y2 -> where does the gradient start / end

      *light_a = *light\CreateAtlas();create a atlas from where a tile or sprite object can be created
      *light\Release();release the light template we dont really need it any longer

      *light = *engine\CreateLight(32,128);create a new template
      *light\BoxLinear(0,0,32,128,16,0,16,128,$FF00FFFF)
      *light_b = *light\CreateAtlas()
     
      Repeat
        Repeat
          win_msg = WindowEvent()
          If win_msg = #PB_Event_CloseWindow
            Break 2
          EndIf
        Until win_msg = #Null
        *engine\RenderBegin(@engine_delta,@engine_fps,@engine_error)
       
        *light_a\Light(200,200)
        *light_b\LightEx(200,200,#False,45)
         
        *engine\DrawText(10,10,"Nautilus Engine",#False,#False,200,$FFDFBF)
        *engine\DrawText(10,25,"FPS " + Str(engine_fps),#False,#False,200,$FFDFBF)
        *engine\DrawText(10,40,"DLT " + StrF(engine_delta,2),#False,#False,200,$FFDFBF)
        *engine\RenderEnd()
        If engine_error
          Break
        EndIf
      ForEver
      *engine\Release()
    EndIf
    CloseWindow(win)
  EndIf
EndProcedure

Main(1080,720,"Example Nautilus Engine v.0.30 beta",600,400,30)

End

_________________

Links:
PureBasic Discord
[ENGINE] 2D Engine Nautilus (Win)
[INCLUDE] GLFW 3.3 Library
[MODULE] Bass Library 2.4 (Win)
[LIBRARY] Hexi Binary2Hex (Win)



Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Re: [ENGINE] 2D Engine Nautilus (Win)
BeitragVerfasst: 30.06.2019 15:53 
Offline
Benutzeravatar

Registriert: 23.07.2011 02:08
Ah, okay. Aber das krieg ich mit PB auch noch hin. Einfach nur zwei sich überlappende Gradients.


Code:
InitSprite()
OpenWindow(0,0,0,800, 600, "", #PB_Window_ScreenCentered|#PB_Window_SystemMenu)
OpenWindowedScreen(WindowID(0), 0, 0, 800, 600)

CreateImage(0, 100, 300, 32,#PB_Image_Transparent )
CreateImage(1, 100, 300, 32,#PB_Image_Transparent )


CreateSprite(0, 100, 300, #PB_Sprite_AlphaBlending )


StartDrawing(ImageOutput(0))

DrawingMode(#PB_2DDrawing_Gradient|#PB_2DDrawing_AlphaBlend )     
BackColor(RGBA(255,0,255,255))
FrontColor(RGBA(100,0,200,0))

LinearGradient(0, 0, 0, 300)     
Box(0, 0, 100, 400)

StopDrawing()
UsePNGImageEncoder()
UsePNGImageDecoder()
StartDrawing(SpriteOutput(0))
DrawingMode( #PB_2DDrawing_AllChannels )     
   DrawImage(ImageID(0), 0, 0)
StopDrawing()




CreateSprite(1, 100, 300, #PB_Sprite_AlphaBlending )


StartDrawing(ImageOutput(1))

DrawingMode(#PB_2DDrawing_Gradient|#PB_2DDrawing_AlphaBlend )     
BackColor(RGBA(255,255,0,255))
FrontColor(RGBA(200,200,0,0))

LinearGradient(0, 0, 0, 300)     
Box(0, 0, 100, 400)

StopDrawing()
UsePNGImageEncoder()
UsePNGImageDecoder()
StartDrawing(SpriteOutput(1))
DrawingMode( #PB_2DDrawing_AllChannels )     
   DrawImage(ImageID(1), 0, 0)
StopDrawing()


Repeat
   
   
    FlipBuffers()
   
    ClearScreen(RGB(0,0,50))
    DisplayTransparentSprite(0, 200, 200)
   
    RotateSprite(1, 45, #PB_Absolute)
   
    DisplayTransparentSprite(1, 250, 220)
   
Until WaitWindowEvent() = #PB_Event_CloseWindow


Spannend wäre, wenn man vollfarbige Sprites verwenden könnte, diese werden "abgedunkelt" und nur da wo Licht ist, sieht man, entsprechend der Helligkeit der Lichtquelle das Originale Sprite.

Bild

_________________
Signatur und so


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Re: [ENGINE] 2D Engine Nautilus (Win)
BeitragVerfasst: 30.06.2019 17:54 
Offline
Benutzeravatar

Registriert: 25.09.2016 01:42
Die interne Licht Erstellung ist eher für einfache Spiele und Tests gedacht.
Kompliziertere bzw. andere Lichter, Shatten, Masken (wie bei den Dinos) usw. müssen manuell geladen werden.
Alle Licht Zeichenfunktionen nutzen Blending um Licht zu simulieren (die Farbe einer Lichtquelle wird immer mit der Umgebung verrechnet).

Lichter intern, Sprites mit MS-Paint & IrfanView:
Bild

Bild

Die Laterne wird einmal normal und einmal dunkler gerendert auch die Schatten des Spielers werden so erzeugt.
Für die beleuchteten Bereiche des Spielers (zweites Bild) gibt es eine Maske.

_________________

Links:
PureBasic Discord
[ENGINE] 2D Engine Nautilus (Win)
[INCLUDE] GLFW 3.3 Library
[MODULE] Bass Library 2.4 (Win)
[LIBRARY] Hexi Binary2Hex (Win)



Zuletzt geändert von Mijikai am 30.06.2019 19:51, insgesamt 2-mal geändert.

Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Re: [ENGINE] 2D Engine Nautilus (Win)
BeitragVerfasst: 30.06.2019 19:08 
Offline
Benutzeravatar

Registriert: 25.09.2016 01:42
Derren hat geschrieben:
Spannend wäre, wenn man vollfarbige Sprites verwenden könnte...


Einfärben ist kein Problem (ob Tile, Sprite oder Text):

Bild

Eingefärbtes Licht:

Bild

_________________

Links:
PureBasic Discord
[ENGINE] 2D Engine Nautilus (Win)
[INCLUDE] GLFW 3.3 Library
[MODULE] Bass Library 2.4 (Win)
[LIBRARY] Hexi Binary2Hex (Win)



Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Re: [ENGINE] 2D Engine Nautilus (Win)
BeitragVerfasst: 03.07.2019 23:47 
Offline

Registriert: 25.08.2013 18:04
Wohnort: Schöppenstedt
schaut doch alles schon mal sehr gut aus :)

_________________
Bild


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Re: [ENGINE] 2D Engine Nautilus (Win)
BeitragVerfasst: 06.07.2019 12:33 
Offline
Benutzeravatar

Registriert: 25.09.2016 01:42
northstarex hat geschrieben:
schaut doch alles schon mal sehr gut aus :)


Danke :)

------------------------------------------------------------

Update: Version 0.31 beta

Es gibt ein neues Interface für Kollisionsabfragen.

Code:
Interface NAUTILUS_ENGINE
  ;...
  CreateCollision.i();<- create collision interface
  ;...
EndInterface

Interface NAUTILUS_COLLISION
  Box(X1.f,Y1.f,W1.f,H1.f,X2.f,Y2.f,W2.f,H2.f)
  BoxEx(*PosA,W1.f,H1.f,*PosB,W2.f,H2.f)
  Sprite.i(X1.f,Y1.f,*SpriteA,X2.f,Y2.f,*SpriteB);<- sprites or tiles (or both)!
  SpriteEx.i(*PosA,*SpriteA,*PosB,*SpriteB);<- sprites or tiles (or both)!
  LineLine.i(*LineA_XY1,*LineA_XY2,*LineB_XY1,*LineB_XY2,*Offset = #Null)
  LineLineEx.i(*LineA,*LineB,*Offset = #Null)
EndInterface


Momentan werden Linien, Quadrate, Sprite & Tiles unterstützt.
(Quadrate, Sprites und Tiles noch ohne Rotation!)

Beispiel:
Bild

Code:

EnableExplicit

;Nautilus Engine Demo
;Version: 0.31 beta
;Author: Mijikai

;Look at nautilus.pbi to see all interfaces and functions!

XIncludeFile "nautilus.pbi"

Structure VECTOR_STRUCT
  x.f
  y.f
EndStructure

Structure LINE_STRUCT
  a.VECTOR_STRUCT
  b.VECTOR_STRUCT
EndStructure

Procedure.i Demo(Width.i,Height.i,Title.s,ViewWidth.i,ViewHeight.i,FPS.i)
  Protected win.i
  Protected win_handle.i
  Protected win_flag.i
  Protected win_msg.i
  Protected *engine.NAUTILUS_ENGINE
  Protected engine_delta.f
  Protected engine_fps.i
  Protected engine_error.i
  Protected *collision.NAUTILUS_COLLISION
  Protected LineA.LINE_STRUCT
  Protected LineB.LINE_STRUCT
  Protected Intersect.VECTOR_STRUCT
  Protected BoxPos.VECTOR_STRUCT
  win_flag|#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_MinimizeGadget
  win_flag|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget
  win = OpenWindow(#PB_Any,#Null,#Null,Width,Height,Title,win_flag)
  If win
    win_handle = WindowID(win)
    *engine = nautilusCreate(win_handle,ViewWidth,ViewHeight,FPS)
    If *engine
      *engine\RenderAspect()
      *collision = *engine\CreateCollision()
      LineA\a\x = 300
      LineA\a\y = 100
      LineA\b\x = 400
      LineA\b\y = 500
      LineB\a\x = 10
      LineB\a\y = 100
      Repeat
        Repeat
          win_msg = WindowEvent()
          If win_msg = #PB_Event_CloseWindow
            Break 2
          EndIf
        Until win_msg = #Null
        *engine\InputMouse(@LineB\b)
        BoxPos = LineB\b
        BoxPos\x - 50
        BoxPos\y - 50
        *engine\RenderBegin(@engine_delta,@engine_fps,@engine_error)
        *engine\DrawLine(LineA\a\x,LineA\a\y,LineA\b\x,LineA\b\y)
        *engine\DrawLine(LineB\a\x,LineB\a\y,LineB\b\x,LineB\b\y)
        If *collision\LineLineEx(@LineA,@LineB,@Intersect)
          *engine\DrawCircle(Intersect\x,Intersect\y,10)
          *engine\DrawText(Intersect\x + 20,Intersect\y,"LINE INTERSECTION!")
        EndIf
        *engine\DrawBox(200,200,100,100)
        *engine\DrawBox(BoxPos\x,BoxPos\y,100,100)
        If *collision\Box(200,200,100,100,BoxPos\x,BoxPos\y,100,100)
          *engine\DrawText(BoxPos\x,BoxPos\y - 20,"BOX COLLISION!")
        EndIf
        *engine\RenderEnd()
        If engine_error
          Break
        EndIf
      ForEver
      *engine\Release()
    EndIf
    CloseWindow(win)
  EndIf
EndProcedure

Demo(1080,720,"Box Collosion & Line Intersection - Nautilus Engine v.0.31 beta",600,400,30)

End

_________________

Links:
PureBasic Discord
[ENGINE] 2D Engine Nautilus (Win)
[INCLUDE] GLFW 3.3 Library
[MODULE] Bass Library 2.4 (Win)
[LIBRARY] Hexi Binary2Hex (Win)



Nach oben
 Profil  
Mit Zitat antworten  
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen Auf das Thema antworten  [ 22 Beiträge ]  Gehe zu Seite 1, 2, 3  Nächste

Alle Zeiten sind UTC + 1 Stunde [ Sommerzeit ]


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 2 Gäste


Sie dürfen keine neuen Themen in diesem Forum erstellen.
Sie dürfen keine Antworten zu Themen in diesem Forum erstellen.
Sie dürfen Ihre Beiträge in diesem Forum nicht ändern.
Sie dürfen Ihre Beiträge in diesem Forum nicht löschen.

Suche nach:
Gehe zu:  

 


Powered by phpBB © 2008 phpBB Group | Deutsche Übersetzung durch phpBB.de
subSilver+ theme by Canver Software, sponsor Sanal Modifiye