Advertisement
heroofhyla

Graphical Quality Toggle

Apr 22nd, 2015
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.93 KB | None | 0 0
  1. boolean fancyGraphics = true;
  2. BufferedImage fancyLightSurface;
  3. BufferedImage fastLightSurface;
  4. BufferedImage lightSurface;
  5.  
  6. BufferedImage fastLight;
  7. BufferedImage fancyLight;
  8. BufferedImage light;
  9.  
  10. Graphics2D lightG2D;
  11.  
  12. //constructor
  13. fancyLightSurface = game.createImage(608,480,Transparency.TRANSLUCENT);
  14. fastLightSurface = game.createImage(608, 480, Transparency.BITMASK);
  15. lightSurface = fancyLightSurface;
  16. lightG2D = (Graphics2D)lightSurface.getGraphics();
  17.  
  18. fancyLight = importImage("resources/alphalight.png",Transparency.TRANSLUCENT);
  19. fastLight = importImage("resources/alphalight.png",Transparency.BITMASK);
  20. light = fancylight;
  21.  
  22. //when quality is toggled
  23. game.fancygraphics = !game.fancygraphics;
  24. if (game.fancygraphics){
  25.     lightSurface = fancyLightSurface;
  26.     game.light = game.fancyLight;
  27. }else{
  28.     lightSurface = fastLightSurface;
  29.     game.light = game.fastLight;
  30. }
  31. lightG2D = (Graphics2D)lightSurface.getGraphics();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement