|
|
1.1 ! root 1: #include <CC/jerq.h> ! 2: #include "pot.pub" ! 3: ! 4: Globepot *g; ! 5: Bmappot *b; ! 6: Rulepot *hr, *vr; ! 7: ! 8: main() ! 9: { ! 10: Rectangle r = Drect; ! 11: ! 12: request(MOUSE); ! 13: initdisplay(); ! 14: ! 15: while(wait(MOUSE)) ! 16: { ! 17: if(moved()) ! 18: { ! 19: reshapepot(r, Drect); ! 20: r = Drect; ! 21: } ! 22: if(button1()) ! 23: { ! 24: hitpot(1); ! 25: if(b->val) g->setval(hr->val, vr->val); ! 26: /* hitpot has already redrawn */ ! 27: } ! 28: else if(button3() && confirm(3)) ! 29: exit(0); ! 30: } ! 31: } ! 32: ! 33: Texture32 bup = { ! 34: #include "up.icon" ! 35: }, bdown = { ! 36: #include "down.icon" ! 37: }, a1 = { ! 38: #include "b1.icon" ! 39: }, a2 = { ! 40: #include "b2.icon" ! 41: }, a3 = { ! 42: #include "b3.icon" ! 43: }, a4 = { ! 44: #include "b4.icon" ! 45: }; ! 46: ! 47: Bitmap * ! 48: bt(Texture32 *t) ! 49: { ! 50: Bitmap *b = balloc(Rect(0, 0, 32, 32)); ! 51: ! 52: texture32(b, b->rect, t, F_OR); ! 53: return(b); ! 54: } ! 55: ! 56: initdisplay() ! 57: { ! 58: Rectangle r; ! 59: Bmappot *bb; ! 60: ! 61: wait(MOUSE); ! 62: string(&defont, "h rule", &display, Drect.o, F_STORE); ! 63: r = getrect(3); ! 64: hr = new Rulepot(r, P_HORIZ|P_TICKS, 360, Point(130, -17), ! 65: Point(50, -17), "Distance"); ! 66: string(&defont, "v rule", &display, Drect.o, F_STORE); ! 67: r = getrect(3); ! 68: vr = new Rulepot(r, P_TICKS, 360, Point(80, -17), ! 69: Point(0, -17), "Distance"); ! 70: string(&defont, "button 1", &display, Drect.o, F_STORE); ! 71: r = getrect(3); ! 72: b = new Bmappot(r, 0, Point(-50, 8), "Gas"); ! 73: b->item(Point(40, 0), "ON", bt(&bup)); ! 74: b->item(Point(40, 0), "OFF", bt(&bdown)); ! 75: string(&defont, "button 2", &display, Drect.o, F_STORE); ! 76: r = getrect(3); ! 77: bb = new Bmappot(r, P_CIRC, Point(-50, 8), "Snork"); ! 78: bb->item(Point(20, -20), "UP", bt(&a1)); ! 79: bb->item(Point(20, 20), "DOWN", bt(&a2)); ! 80: bb->item(Point(-75, 20), "RIGHT", bt(&a3)); ! 81: bb->item(Point(-60, -20), "LEFT", bt(&a4)); ! 82: string(&defont, "globe ", &display, Drect.o, F_STORE); ! 83: r = getrect(3); ! 84: g = new Globepot(r, 0, 45, 45, Pt(120, -20), Pt(0, -20), "where am i"); ! 85: drawpot(); ! 86: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.