Import mojo.app
' these lines will be in bgfx.cxs
Import "native/bgfx.cpp"
' ///
Const BGFX_CLEAR_NONE:Int = $0000 '//!< No clear flags.
Const BGFX_CLEAR_COLOR:Int = $0001 '//!< Clear color.
Const BGFX_CLEAR_DEPTH:Int = $0002 '//!< Clear depth.
Const BGFX_CLEAR_STENCIL:Int = $0004 '//!< Clear stencil.
Const BGFX_CLEAR_DISCARD_COLOR_0:Int = $0008 '//!< Discard frame buffer attachment 0.
Const BGFX_CLEAR_DISCARD_COLOR_1:Int = $0010 '//!< Discard frame buffer attachment 1.
Const BGFX_CLEAR_DISCARD_COLOR_2:Int = $0020 '//!< Discard frame buffer attachment 2.
Const BGFX_CLEAR_DISCARD_COLOR_3:Int = $0040 '//!< Discard frame buffer attachment 3.
Const BGFX_CLEAR_DISCARD_COLOR_4:Int = $0080 '//!< Discard frame buffer attachment 4.
Const BGFX_CLEAR_DISCARD_COLOR_5:Int = $0100 '//!< Discard frame buffer attachment 5.
Const BGFX_CLEAR_DISCARD_COLOR_6:Int = $0200 '//!< Discard frame buffer attachment 6.
Const BGFX_CLEAR_DISCARD_COLOR_7:Int = $0400 '//!< Discard frame buffer attachment 7.
Const BGFX_CLEAR_DISCARD_DEPTH:Int = $0800 '//!< Discard frame buffer depth attachment.
Const BGFX_CLEAR_DISCARD_STENCIL:Int = $1000 '//!< Discard frame buffer stencil attachment.
Extern
Function bgfxSetDebug:Void( _debug:Int )="bgfx_set_debug"
Function bgfxSetViewClear:Void( _id:Int, _flags:Int, _rgba:Int, _depth:Float, _stencil:Int)="bgfx_set_view_clear"
Function bgfxSetViewRect:Void( _id:Int, _x:Int, _y:Int, _width:Int, _height:Int)="bgfx_set_view_rect"
Function bgfxTouch:Void( _id:Int )="bgfx_touch"
Function bgfxDbgTextClear:Void( _attr:Int, _small:Bool)="bgfx_dbg_text_clear"
' Function bgfxDbgTextImage:Void( _x:Int, _y:Int, _width:Int, _height:Int, _data:DataBuffer, _pitch:Int)="bgfx_dbg_text_image"
Function bgfxDbgTextPrintf:Void( _x:Int, _y:Int, _attr:Int, _format:String )="_bgfx_dbg_text_printf"
Function bgfxFrame:Void( _capture:Bool )="bgfx_frame"
Public
Class MojoGame Extends App
Field width:Int = 1280
Field height:Int = 720
Field debug:Int = BGFX_DEBUG_TEXT
' Field reset:Int = BGFX_RESET_VSYNC
Method OnCreate:Int()
SetUpdateRate(60)
' Enable debug text.
' bgfxSetDebug(debug)
Return 0
End
Method OnUpdate:Int()
Return 0
End
Method OnRender:Int()
' bgfxSetViewClear(0, BGFX_CLEAR_COLOR|BGFX_CLEAR_DEPTH, $303030ff, 1.0, 0)
' Set view 0 default viewport.
bgfxSetViewRect(0, 0, 0, width, height)
' This dummy draw call is here to make sure that view 0 is cleared
' if no other draw calls are submitted to view 0.
bgfxTouch(0)
' Use debug font to print information about this example.
bgfxDbgTextClear(0, False)
' bgfxDbgTextImage(Max(width/2/8, 20)-20, Max(height/2/16, 6)-6, 40, 12, s_logo, 160)
bgfxDbgTextPrintf(0, 1, $4f, "bgfx/examples/25-c99")
bgfxDbgTextPrintf(0, 2, $6f, "Description: Initialization and debug text with C99 API.")
' Advance to next frame. Rendering thread will be kicked to
' process submitted rendering primitives.
bgfxFrame(False)
Return 0
End
End
Function Main:Int()
New MojoGame()
Return 0
End