You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

37 line
1.1 KiB

  1. /**
  2. * libcaca Java bindings for libcaca
  3. * Copyright (c) 2009 Adrien Grand <jpountz@dinauz.org>
  4. *
  5. * This library is free software. It comes without any warranty, to
  6. * the extent permitted by applicable law. You can redistribute it
  7. * and/or modify it under the terms of the Do What The Fuck You Want
  8. * To Public License, Version 2, as published by Sam Hocevar. See
  9. * http://sam.zoy.org/wtfpl/COPYING for more details.
  10. */
  11. import org.zoy.caca.Canvas;
  12. import org.zoy.caca.Color;
  13. import org.zoy.caca.Display;
  14. import org.zoy.caca.Event;
  15. public class TrueColor {
  16. public static void main(String[] args) {
  17. Canvas cv = new Canvas(32, 16);
  18. Display dp = new Display(cv);
  19. for (int y = 0; y < 16; y++) {
  20. for (int x = 0; x < 16; x++) {
  21. int bgcolor = 0xff00 | (y << 4) | x;
  22. int fgcolor = 0xf000 | ((15 - y) << 4) | ((15 - x) << 8);
  23. cv.setColor(new Color.Argb(bgcolor), new Color.Argb(fgcolor));
  24. cv.put(x*2, y, "CA");
  25. }
  26. }
  27. cv.setColor(Color.Ansi.WHITE, Color.Ansi.LIGHTBLUE);
  28. cv.put(2, 1, "truecolor libcaca");
  29. dp.refresh();
  30. dp.getEvent(Event.Type.KEY_PRESS, -1);
  31. }
  32. }