| 1 |
/** |
| 2 |
* libcaca Java bindings for libcaca |
| 3 |
* Copyright (c) 2009 Adrien Grand <[email protected]> |
| 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://www.wtfpl.net/ for more details. |
| 10 |
*/ |
| 11 |
|
| 12 |
import org.zoy.caca.Canvas; |
| 13 |
import org.zoy.caca.Color; |
| 14 |
import org.zoy.caca.Display; |
| 15 |
import org.zoy.caca.Event; |
| 16 |
|
| 17 |
public class TrueColor { |
| 18 |
|
| 19 |
public static void main(String[] args) { |
| 20 |
Canvas cv = new Canvas(32, 16); |
| 21 |
Display dp = new Display(cv); |
| 22 |
for (int y = 0; y < 16; y++) { |
| 23 |
for (int x = 0; x < 16; x++) { |
| 24 |
int bgcolor = 0xff00 | (y << 4) | x; |
| 25 |
int fgcolor = 0xf000 | ((15 - y) << 4) | ((15 - x) << 8); |
| 26 |
cv.setColor(new Color.Argb(bgcolor), new Color.Argb(fgcolor)); |
| 27 |
cv.put(x*2, y, "CA"); |
| 28 |
} |
| 29 |
} |
| 30 |
cv.setColor(Color.Ansi.WHITE, Color.Ansi.LIGHTBLUE); |
| 31 |
cv.put(2, 1, "truecolor libcaca"); |
| 32 |
dp.refresh(); |
| 33 |
dp.getEvent(Event.Type.KEY_PRESS, -1); |
| 34 |
} |
| 35 |
|
| 36 |
} |