theme_test.monkey2 890 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #Import "<std>"
  2. #Import "<mojo>"
  3. #Import "<mojox>"
  4. #Import "assets/simple_theme.json"
  5. Using std..
  6. Using mojo..
  7. Using mojox..
  8. Class MyWindow Extends Window
  9. Method New()
  10. Super.New( "Theme Demo",640,480,WindowFlags.Resizable )
  11. Local theme1:=App.Theme
  12. Local theme2:=Theme.Load( "asset::simple_theme.json" )
  13. App.Theme=theme2
  14. ClearColor=App.Theme.GetColor( "windowClearColor" )
  15. New Fiber( Lambda()
  16. Repeat
  17. Alert( "Click me to change theme!" )
  18. App.Theme=App.Theme=theme1 ? theme2 Else theme1
  19. ClearColor=App.Theme.GetColor( "windowClearColor" )
  20. Forever
  21. End )
  22. App.Idle+=OnIdle
  23. End
  24. Method OnIdle()
  25. App.RequestRender()
  26. App.Idle+=OnIdle
  27. End
  28. End
  29. Function Main()
  30. Local config:=New StringMap<String>
  31. ' config["initialTheme"]="asset::simple_theme.json"
  32. New AppInstance( config )
  33. New MyWindow
  34. App.Run()
  35. End