PureBasic Forum
http://forums.purebasic.com/english/

2D Engine Nautilus (OpenGL)
http://forums.purebasic.com/english/viewtopic.php?f=16&t=72745
Page 1 of 1

Author:  Mijikai [ Sun May 05, 2019 1:34 pm ]
Post subject:  2D Engine Nautilus (OpenGL)

Image

I have just released the alpha version of my 2D (OpenGL) Engine Nautilus :D

Features:
- easy to integrate
- easy functions for sprites, text & tiles (rotated, scaled, resized, tinted, layered)
- support of multiple layers (0-9 or unlimited if stacked)
- render surface not bound to window size
- fps can be set freely (30 - 80)
- isometric camera system

Isometric camera example (source is included in the download):
Image

Im open for criticism and suggestions :)

Imports & Interfaces:
Code:
;Alpha 3

Import "ne32.lib"
  neContext.i(hwnd.i,width.i,height.i,fps.i)
  neVersion.i()
EndImport

Interface NAUTILUS_ISOMETRIC
  CreateCamera.i(X.f,Y.f,Width.f,Height.f)
  CameraPosition.i(Camera.i,*Position,*Offset = #Null)
  CameraMove.i(Camera.i,*Position,*Offset = #Null)
  CameraZoom.f(Camera.i,Min.f,Max.f,*Scale = #Null)
  CameraScale.f(Camera.i)
  CameraUnit.i(Camera.i,*Unit)
  CameraCartesian.i(Camera.i,*Cartesian)
  CameraIsometric.i(Camera.i,*Isometric)
  CameraClamp.i(Camera.i,*Bounds)
  CameraUpdate.i(Camera.i,*Translation = #Null)
  CameraFree.i(Camera.i)
  CreateTiles.i()
  TileSet.i(X.i,Y.i,Link.i)
  TileGet.i(X.i,Y.i)
  TileUnit.i(X.i,Y.i,*Unit)
  TileCartesian.i(X.i,Y.i,*Cartesian)
  TileIsometric.i(X.i,Y.i,*Isometric)
  TileTranslate.i(Camera.i,X.i,Y.i,*Position,*Cartesian = #Null,*Link = #Null)
  FreeTiles.i()
  MouseTranslate.i(Camera.i,*Mouse,*Cartesian,*Unit = #Null)
  MouseTest.i(*Unit)
  WorldToScreen.i(Camera.i,*Cartesian,*Position)
  ScreenToWorld.i(Camera.i,*Position,*Cartesian,*Unit = #Null)
  Translate.i(Camera.i,*Isometric,*Position)
  Isometric.i(*Cartesian,*Isometric)
  Unit.i(*Cartesian,*Unit)
  Release.i()
EndInterface

Interface NAUTILUS_FONT
  Width.f()
  Height.f()
  CenterX.f()
  CenterY.f()
  Resize.i(Width.f,Height.f)
  ResetSize.i()
  GetSpacing.i()
  SetSpacing.i(Spacing.f)
  ResetSpacing.i()
  Draw.i(X.f,Y.f,Text.s,CenterX.b = #False,CenterY.b = #False,Alpha.a = #Null,Tint.l = #Null)
  DrawRot.i(X.f,Y.f,Text.s,CenterX.b = #False,CenterY.b = #False,Alpha.a = #Null,Angle.f = #Null,Tint.l = #Null)
  DrawMod.i(X.f,Y.f,Text.s,Width.f = #Null,Height.f = #Null,CenterX.b = #False,CenterY.b = #False,Alpha.a = #Null,Tint.l = #Null)
  DrawModRot.i(X.f,Y.f,Text.s,Width.f = #Null,Height.f = #Null,CenterX.b = #False,CenterY.b = #False,Alpha.a = #Null,Angle.f = #Null,Tint.l = #Null)
  DrawLight.i(X.f,Y.f,Text.s,CenterX.b = #False,CenterY.b = #False,Tint.l = #Null)
  DrawLightRot.i(X.f,Y.f,Text.s,CenterX.b = #False,CenterY.b = #False,Angle.f = #Null,Tint.l = #Null)
  DrawLightMod.i(X.f,Y.f,Text.s,Width.f = #Null,Height.f = #Null,CenterX.b = #False,CenterY.b = #False,Tint.l = #Null)
  DrawLightModRot.i(X.f,Y.f,Text.s,Width.f = #Null,Height.f = #Null,CenterX.b = #False,CenterY.b = #False,Angle.f = #Null,Tint.l = #Null)
  LayerDraw.i(Layer.i,X.f,Y.f,Text.s,CenterX.b = #False,CenterY.b = #False,Alpha.a = #Null,Tint.l = #Null)
  LayerDrawRot.i(Layer.i,X.f,Y.f,Text.s,CenterX.b = #False,CenterY.b = #False,Alpha.a = #Null,Angle.f = #Null,Tint.l = #Null)
  LayerDrawMod.i(Layer.i,X.f,Y.f,Text.s,Width.f = #Null,Height.f = #Null,CenterX.b = #False,CenterY.b = #False,Alpha.a = #Null,Tint.l = #Null)
  LayerDrawModRot.i(Layer.i,X.f,Y.f,Text.s,Width.f = #Null,Height.f = #Null,CenterX.b = #False,CenterY.b = #False,Alpha.a = #Null,Angle.f = #Null,Tint.l = #Null)
  LayerDrawLight.i(Layer.i,X.f,Y.f,Text.s,CenterX.b = #False,CenterY.b = #False,Tint.l = #Null)
  LayerDrawLightRot.i(Layer.i,X.f,Y.f,Text.s,CenterX.b = #False,CenterY.b = #False,Angle.f = #Null,Tint.l = #Null)
  LayerDrawLightMod.i(Layer.i,X.f,Y.f,Text.s,Width.f = #Null,Height.f = #Null,CenterX.b = #False,CenterY.b = #False,Tint.l = #Null)
  LayerDrawLightModRot.i(Layer.i,X.f,Y.f,Text.s,Width.f = #Null,Height.f = #Null,CenterX.b = #False,CenterY.b = #False,Angle.f = #Null,Tint.l = #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.b = #False,Alpha.a = #Null)
  DrawRot.i(Index.i,X.f,Y.f,Center.b = #False,Alpha.a = #Null,Angle.f = #Null,Tint.l = #Null)
  DrawMod.i(Index.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.b = #False,Alpha.a = #Null)
  DrawModRot.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)
  DrawLight.i(Index.i,X.f,Y.f,Center.b = #False,Tint.l = #Null)
  DrawLightRot.i(Index.i,X.f,Y.f,Center.b = #False,Angle.f = #Null,Tint.l = #Null)
  DrawLightMod.i(Index.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.b = #False,Tint.l = #Null)
  DrawLightModRot.i(Index.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.b = #False,Angle.f = #Null,Tint.l = #Null)
  LayerDraw.i(Layer.i,Index.i,X.f,Y.f,Center.b = #False,Alpha.a = #Null)
  LayerDrawRot.i(Layer.i,Index.i,X.f,Y.f,Center.b = #False,Alpha.a = #Null,Angle.f = #Null,Tint.l = #Null)
  LayerDrawMod.i(Layer.i,Index.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.b = #False,Alpha.a = #Null)
  LayerDrawModRot.i(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)
  LayerDrawLight.i(Layer.i,Index.i,X.f,Y.f,Center.b = #False,Tint.l = #Null)
  LayerDrawLightRot.i(Layer.i,Index.i,X.f,Y.f,Center.b = #False,Angle.f = #Null,Tint.l = #Null)
  LayerDrawLightMod.i(Layer.i,Index.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.b = #False,Tint.l = #Null)
  LayerDrawLightModRot.i(Layer.i,Index.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.b = #False,Angle.f = #Null,Tint.l = #Null)
  Animation.i(Timer.f = #Null,Active.b = #False,Once.b = #False)
  AnimationState.i(Active.b = #True)
  AnimationOnce.i(Flag.b = #True)
  AnimationFrame.i()
  AnimationFrames.i()
  AnimationStart.i(Index.i = -1)
  AnimationStop.i(Index.i = -1)
  AnimationReset.i(Zero.b = #False)
  CreateCopy.i()
  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.b = #False,Alpha.a = #Null)
  DrawRot.i(X.f,Y.f,Center.b = #False,Alpha.a = #Null,Angle.f = #Null,Tint.l = #Null)
  DrawMod.i(X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.b = #False,Alpha.a = #Null)
  DrawModRot.i(X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.b = #False,Alpha.a = #Null,Angle.f = #Null,Tint.l = #Null)
  DrawLight.i(X.f,Y.f,Center.b = #False,Tint.l = #Null)
  DrawLightRot.i(X.f,Y.f,Center.b = #False,Angle.f = #Null,Tint.l = #Null)
  DrawLightMod.i(X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.b = #False,Tint.l = #Null)
  DrawLightModRot.i(X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.b = #False,Angle.f = #Null,Tint.l = #Null)
  LayerDraw.i(Layer.i,X.f,Y.f,Center.b = #False,Alpha.a = #Null)
  LayerDrawRot.i(Layer.i,X.f,Y.f,Center.b = #False,Alpha.a = #Null,Angle.f = #Null,Tint.l = #Null)
  LayerDrawMod.i(Layer.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.b = #False,Alpha.a = #Null)
  LayerDrawModRot.i(Layer.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.b = #False,Alpha.a = #Null,Angle.f = #Null,Tint.l = #Null)
  LayerLight.i(Layer.i,X.f,Y.f,Center.b = #False,Tint.l = #Null)
  LayerLightRot.i(Layer.i,X.f,Y.f,Center.b = #False,Angle.f = #Null,Tint.l = #Null)
  LayerLightMod.i(Layer.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.b = #False,Tint.l = #Null)
  LayerLightModRot.i(Layer.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.b = #False,Angle.f = #Null,Tint.l = #Null)
  Release.i() 
EndInterface

Interface NAUTILUS_ATLAS
  Width.f()
  Height.f()
  CenterX.f()
  CenterY.f()
  Resize.i(Width.f,Height.f)
  ResetSize.i()
  Draw.i(X.f,Y.f,Center.b = #False,Alpha.a = #Null)
  DrawRot.i(X.f,Y.f,Center.b = #False,Alpha.a = #Null,Angle.f = #Null,Tint.l = #Null)
  DrawMod.i(X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.b = #False,Alpha.a = #Null)
  DrawModRot.i(X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.b = #False,Alpha.a = #Null,Angle.f = #Null,Tint.l = #Null)
  Light.i(X.f,Y.f,Center.b = #False,Tint.l = #Null)
  LightRot.i(X.f,Y.f,Center.b = #False,Angle.f = #Null,Tint.l = #Null)
  LightMod.i(X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.b = #False,Tint.l = #Null)
  LightModRot.i(X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.b = #False,Angle.f = #Null,Tint.l = #Null)
  LayerDraw.i(Layer.i,X.f,Y.f,Center.b = #False,Alpha.a = #Null)
  LayerDrawRot.i(Layer.i,X.f,Y.f,Center.b = #False,Alpha.a = #Null,Angle.f = #Null,Tint.l = #Null)
  LayerDrawMod.i(Layer.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.b = #False,Alpha.a = #Null)
  LayerDrawModRot.i(Layer.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.b = #False,Alpha.a = #Null,Angle.f = #Null,Tint.l = #Null)
  LayerLight.i(Layer.i,X.f,Y.f,Center.b = #False,Tint.l = #Null)
  LayerLightRot.i(Layer.i,X.f,Y.f,Center.b = #False,Angle.f = #Null,Tint.l = #Null)
  LayerLightMod.i(Layer.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.b = #False,Tint.l = #Null)
  LayerLightModRot.i(Layer.i,X.f,Y.f,Width.f = #Null,Height.f = #Null,Center.b = #False,Angle.f = #Null,Tint.l = #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)
  Bitmap.i(*Bitmap)
  Release.i()
EndInterface

Interface NAUTILUS_LAYER
  Reset.i(Layer.i)
  Translate.i(Layer.i,X.f,Y.f,Origin.b = #False)
  Push.i(Layer.i)
  Pop.i(Layer.i)
  Rotate.i(Layer.i,Angle.f = #Null)
  Scale.i(Layer.i,X.f = 1,Y.f = 1)
  Render.i()
EndInterface

Interface NAUTILUS_DRAWING
  DrawPointSize.i(Size.f = 1)
  DrawLineSize.i(Size.f = 1)
  DrawPoint.i(X.f,Y.f,Color.l = $FFFFFFFF)
  DrawLine.i(X1.f,Y1.f,X2.f,Y2.f,Color.l = $FFFFFFFF)
  DrawTriangle.i(X.f,Y.f,Width.f,Height.f,Fill.b = #False,Color.l = $FFFFFFFF)
  DrawBox.i(X.f,Y.f,Width.f,Height.f,Center.b = #False,Fill.b = #False,Color.l = $FFFFFFFF)
  DrawDiamond.i(X.f,Y.f,Width.f,Height.f,Center.b = #False,Fill.b = #False,Color.l = $FFFFFFFF)
  DrawCircle.i(X.f,Y.f,Radius.f,Fill.b = #False,Color.l = $FFFFFFFF)
EndInterface

Interface NAUTILUS
  ViewPortResize.i(Width.i,Height.i)
  ViewPortFactor.i(*Vector)
  ViewPortSize.i(*Vector)
  ViewPortCenter.i(*Vector)
  RenderSize.i(*Vector)
  RenderHideCursor(Flag.b = #True)
  RenderFilter(Bilinear.b = #False)
  RenderColor.i(Color.l = #Null)
  RenderBegin.i(*Delta = #Null,*FPS = #Null)
  RenderEnd.i()
  RenderReset.i()
  RenderPush.i()
  RenderPop.i()
  RenderTranslate.i(X.f,Y.f)
  RenderRotate.i(Angle.f)
  RenderScale.i(X.f,Y.f)
  RenderTextWidth.f()
  RenderTextHeight.f()
  RenderTextResize.i(Width.f,Height.f)
  RenderTextResetSize.i()
  RenderTextGetSpacing.f()
  RenderTextSetSpacing.i(Spacing.f)
  RenderTextResetSpacing.i()
  RenderText.i(X.f,Y.f,Text.s,CenterX.b = #False,CenterY.b = #False,Alpha.a = #Null,Tint.l = #Null)
  RenderTextRot.i(X.f,Y.f,Text.s,CenterX.b = #False,CenterY.b = #False,Alpha.a = #Null,Angle.f = #Null,Tint.l = #Null)
  RenderTextMod.i(X.f,Y.f,Text.s,Width.f,Height.f,CenterX.b = #False,CenterY.b = #False,Alpha.a = #Null,Tint.l = #Null)
  RenderTextModRot.i(X.f,Y.f,Text.s,Width.f,Height.f,CenterX.b = #False,CenterY.b = #False,Alpha.a = #Null,Angle.f = #Null,Tint.l = #Null)
  RenderTextLight.i(X.f,Y.f,Text.s,CenterX.b = #False,CenterY.b = #False,Tint.l = #Null)
  RenderTextLightRot.i(X.f,Y.f,Text.s,CenterX.b = #False,CenterY.b = #False,Angle.f = #Null,Tint.l = #Null)
  RenderTextLightMod.i(X.f,Y.f,Text.s,Width.f,Height.f,CenterX.b = #False,CenterY.b = #False,Tint.l = #Null)
  RenderTextLightModRot.i(X.f,Y.f,Text.s,Width.f,Height.f,CenterX.b = #False,CenterY.b = #False,Angle.f = #Null,Tint.l = #Null)
  InputKey.i(Code.i)
  InputKeySgl.i(Code.i)
  InputKeyChr.i()
  InputMouse.i(*Vector)
  InputMouseLeft.i()
  InputMouseLeftSgl.i()       
  InputMouseLeftDbl.i()
  InputMouseRight.i()
  InputMouseRightSgl.i()
  InputMouseRightDbl.i()
  InputMouseMiddle.i()
  InputMouseMiddleSgl.i()
  InputMouseMiddleDbl.i()
  InputMouseWheel(Code.i = #Null,*Value.Integer = #Null)
  CreateDrawing.i()
  CreateLayer.i()
  CreateAtlas.i(*Buffer,File.s = #Null$)
  CreateFont.i(*Buffer,File.s,Width.i,Height.i)
  CreateLight.i(Width.i,Height.i,LightA.a,LightB.a,Radius.f = #Null)
  CreateIsometric.i(Width.i,Height.i,TileWidth.i,TileHeight.i)
  Release.i()
EndInterface


Download links removed - Alphatest has ended!

Author:  StarBootics [ Sun May 05, 2019 4:51 pm ]
Post subject:  Re: 2D Engine Nautilus (OpenGL)

The link to the German forum you provided doesn't work and since I don't read German ...

But it sound interesting.

Best regards
StarBootics

Author:  Mijikai [ Sun May 05, 2019 5:11 pm ]
Post subject:  Re: 2D Engine Nautilus (OpenGL)

StarBootics wrote:
The link to the German forum you provided doesn't work and since I don't read German ...


I fixed it - all info is also here now :)

Author:  Mijikai [ Wed May 15, 2019 9:01 pm ]
Post subject:  Re: 2D Engine Nautilus (OpenGL)

Update Alpha 3 (15.05.2019)

New Functions:
- Cursor can be hidden now!
- Added a new interface for isometric games (NAUTILUS_ISOMETRIC)

Have fun :D

Author:  Mijikai [ Mon Oct 21, 2019 6:53 am ]
Post subject:  Re: 2D Engine Nautilus (OpenGL)

Here is a link to the relevant thread: viewtopic.php?f=14&t=73077

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/