ripemd160: `ripemd160_init()` is redunant now
[iv.d.git] / kgitest / xmain_kgi.d
blob383d443c67acd0cef423d1aadf1d18b5ec4f4839
1 /* coded by Ketmar // Invisible Vector <ketmar@ketmar.no-ip.org>
2 * Understanding is not required. Only obedience.
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, version 3 of the License ONLY.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 module xmain_fed /*is aliced*/;
18 import std.random : uniform;
20 import iv.alice;
21 import iv.glkgi;
24 void main (string[] args) {
25 conProcessArgs!true(args);
27 //kgiInit(640, 480, "KGI Test", scale2x);
28 kgiInit();
29 //scope(exit) kgiDeinit();
31 kgiSetDefaultCursor();
32 kgiShowCursor();
34 void buildScreen () {
35 cls(0);
36 drawCircle(kgiWidth/2, kgiHeight/2, 100, rgbcol(255, 255, 255));
37 foreach (immutable _; 0.. 10) {
38 drawCircle(uniform(0, kgiWidth), uniform(0, kgiHeight), uniform!"[]"(10, 50), rgbcol(255, 255, 255));
42 kgiMotionEvents = true;
43 for (;;) {
44 auto ev = kgiGetEvent();
45 if (ev.isClose) break;
46 if (ev.isKey && ev.k.pressed && ev.k.key == Key.Escape) break;
47 if (ev.isKey && ev.k.pressed && ev.k.key == Key.R) { buildScreen(); continue; }
48 if (ev.isKey && ev.k.pressed && ev.k.key == Key.C) { drawCircle(uniform(0, kgiWidth), uniform(0, kgiHeight), uniform!"[]"(10, 50), rgbcol(255, 255, 255)); continue; }
49 if (ev.isKey && ev.k.pressed) {
50 import std.random : uniform;
51 drawStr(uniform!"[]"(0, kgiWidth), uniform!"[]"(0, kgiHeight), "Boo!", rgbcol(255, 127, 0));
53 if (ev.isMouse && ev.m.type == MouseEventType.buttonPressed && ev.m.button == MouseButton.left) {
54 fillCircle(ev.m.x, ev.m.y, 4, rgbcol(255, 255, 0, 127));
56 if (ev.isMouse && ev.m.type == MouseEventType.buttonPressed && ev.m.button == MouseButton.right) {
57 floodFillEx(ev.m.x, ev.m.y,
58 // isBorder
59 (int x, int y) {
60 return (getPixel(x, y) == rgbcol(255, 255, 255));
62 // patColor
63 (int x, int y) {
64 return rgbcol(255, 127, 0, 127);
68 if (ev.isMouse && ev.m.type == MouseEventType.motion && ev.m.modifierState&ModifierState.leftButtonDown) {
69 fillCircle(ev.m.x, ev.m.y, 4, rgbcol(255, 255, 255, 127));
71 //conwriteln(ev.type);