fonttest.monkey2 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. Namespace myapp
  2. #Import "<std>"
  3. #Import "<mojo>"
  4. Using std..
  5. Using mojo..
  6. Const Test:="
  7. Test of extended chars:
  8. æ = &aelig;
  9. ø = &oslash;
  10. å = &aring;
  11. Æ = &AElig;
  12. Ø = &Oslash;
  13. Ã… = &Aring;
  14. élégant
  15. "
  16. Class MyWindow Extends Window
  17. Field page:Int
  18. Method New( title:String="Simple mojo app",width:Int=640,height:Int=480,flags:WindowFlags=Null )
  19. Super.New( title,width,height,flags|WindowFlags.HighDPI )
  20. End
  21. Method OnRender( canvas:Canvas ) Override
  22. App.RequestRender()
  23. If Keyboard.KeyHit( Key.Right )
  24. page=Min( page+1,255 )
  25. Else If Keyboard.KeyHit( Key.Left )
  26. page=Max( page-1,0 )
  27. End
  28. canvas.DrawText( "page="+page+" (arrows to change)",32,8 )
  29. For Local y:=0 Until 16
  30. For Local x:=0 Until 16
  31. canvas.DrawText( String.FromChar( y*16+x+page*256 ),x*16+32,y*16+32 )
  32. Next
  33. Next
  34. Local y:=0
  35. For Local line:=Eachin Test.Split( "~n" )
  36. canvas.DrawText( line,Width/2,y )
  37. y+=16
  38. Next
  39. End
  40. End
  41. Function Main()
  42. New AppInstance
  43. New MyWindow
  44. App.Run()
  45. End