bitmapfont.monkey2 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #rem
  2. gnsh-bitmap font from opengameart.org:
  3. https://opengameart.org/content/bitmap-font-0
  4. #end
  5. Namespace myapp
  6. #Import "<std>"
  7. #Import "<mojo>"
  8. 'simple image font
  9. #Import "gnsh-bitmapfont-colour1.png"
  10. 'monochrome angel font
  11. #Import "testfont.fnt"
  12. #Import "testfont_0.png"
  13. 'fullcolor angel font
  14. #Import "coolfont.fnt"
  15. #Import "coolfont.png"
  16. Using std..
  17. Using mojo..
  18. Class MyWindow Extends Window
  19. Method New( title:String="Simple mojo app",width:Int=640,height:Int=480,flags:WindowFlags=Null )
  20. Super.New( title,width,height,flags )
  21. 'Example of loading a ttf font directly
  22. ' Style.Font=FreeTypeFont.Load( "asset::fonts/DejaVuSans.ttf",32 )
  23. 'Example of loading a simple image font where chars are 15x36
  24. ' Style.Font=ImageFont.Load( "asset::gnsh-bitmapfont-colour1.png",15,36 )
  25. 'Example of loading a monochrome angel font
  26. ' Style.Font=AngelFont.Load( "asset::testfont.fnt" )
  27. 'Example of loading a fullcolor angel font
  28. Style.Font=AngelFont.Load( "asset::coolfont.fnt" )
  29. ClearColor=Color.Blue 'so we can see nice drop shadow.
  30. End
  31. Method OnRender( canvas:Canvas ) Override
  32. App.RequestRender()
  33. canvas.DrawText( "The Quick Brown Fox Jumps Over The Lazy Dog",0,0 )
  34. End
  35. End
  36. Function Main()
  37. New AppInstance
  38. New MyWindow
  39. App.Run()
  40. End