Hi folks,
after a bit of work and with permission of Richard Vanner, I am pleased to let you know that
Cerberus X has a new official target. AppGameKit Tier 2.
With this, you can code your game in CX with its language and all its OOP bells and whistles and use the powerfull API of AppGameKit.
Of course, you need to own AppGameKit to use it with Cerberus X but I think it is another nice way to code your game.
A sample code could look like this:
Strict
#TEXT_FILES+="*.obj"
#AGK_DEVICE_WIDTH = 640
#AGK_DEVICE_HEIGHT = 480
#AGK_DEVICE_POS_X = 32
#AGK_DEVICE_POS_Y = 32
#AGK_FULLSCREEN = False
Import agk2
Global game:myGame = Null
'*********************************************************************
Class cShip
Field _id:Int
Field _img:Int
Field _name:String
'---------------------------------------------
Method New()
_id = LoadObjectWithChildren("data/Lifeboat.obj")
_img = LoadImage("data/lifeboat_diffuse.png")
SetObjectImage(_id, _img, 0)
SetObjectScale(_id,3,3,3)
SetObjectCastShadow(_id, 1)
SetObjectPosition(_id,0,-0.1,0)
SetObjectRotation(_id,0,135,0)
End
'---------------------------------------------
Method Remove:Int()
DeleteImage(Self._img)
DeleteObject(Self._id)
Return 0
End
'---------------------------------------------
Method Update:Int()
SetObjectRotation(_id,0,GetObjectAngleY(_id)+10*GetFrameTime() ,0)
Return 0
End
End
'*********************************************************************
Class myGame
Field ship:cShip
Field counter:Int = 1
'---------------------------------------------
Method LoadMedia:Int()
'The ship
ship = New cShip
'Water plane
Local plane := CreateObjectPlane(150,150)
Local img2 := LoadImage("data/water.jpg")
SetObjectImage(plane, img2, 0)
SetObjectRotation( plane, 90,0,0)
Return 0
End
'---------------------------------------------
Method Setup_Camera:Int()
SetCameraRange(1,1,1510)
SetCameraPosition( 1,-2,2,4 )
SetCameraLookAt( 1,0,0,0,0 )
SetPrintSize(20)
SetShadowMappingMode( 2 )
Return 0
End
'---------------------------------------------
Method Setup_Lights:Int()
SetSunColor( 255,255,155 )
SetSunActive(1)
'SetSunDirection( -0.3, -0.3, 0.5 )
SetAmbientColor( 80,80,180 )
Return 0
End
'---------------------------------------------
Method Setup_Window:Int()
SetWindowTitle("Cerberus X -> AppGameKit")
SetVirtualResolution(GetDeviceWidth(),GetDeviceHeight())
SetClearColor(0,0,100)
SetAntialiasMode( 1 )
SetGenerateMipmaps(0)
SetSyncRate(0,0)
SetVSync(1)
SetScissor(0,0,0,0)
Return 0
End
'---------------------------------------------
Method New()
' Setup stuff
Setup_Window()
Setup_Camera()
Setup_Lights()
LoadMedia()
End
'---------------------------------------------
Method Update:Int()
' Update the ship
ship.Update()
' Delete and recreate the ship when ESCAPE is pressed
If GetRawKeyState(KEY_ESCAPE) = 1
ship.Remove()
ship = New cShip
counter += 1
Endif
Return 0
End
'---------------------------------------------
Method Render:Int()
' Print out some debug informations
agk_PrintC( "ScreenFPS= " ) ; agk_Print( ScreenFPS() )
agk_PrintC( "Polygons= " ) ; agk_Print( GetPolygonsDrawn() )
agk_PrintC( "Memory= " ) ; agk_Print( GetImageMemoryUsage() )
agk_PrintC( "Objects created= " ) ; agk_Print( counter )
' Render everything
Sync()
Return 0
End
End
'*********************************************************************
Function Main:Int()
' The Main function will be called from the AGK template continuously
' in every frame/loop, till you return a value of 1. That will close the app.
' Create our main class
If game = Null Then game = New myGame
' Update and render the content
game.Update()
game.Render()
Return GetPointerPressed()
End
EDIT: Currently it is Windows 64 bit, OSX, and IOS only.
Android support is already on GitHub.
So guys, let me know what you think.
If you want to check it out, go here:
https://www.cerberus-x.com
Cheers
Michael