//DISPLAY FUNCTION FOR INITIALIZING (DRAWING) THE INPUT AND OUTPUT AREAS void initial() { glClear(GL_COLOR_BUFFER_BIT); setFont(GLUT_BITMAP_HELVETICA_18); glColor3f(0.0,0.0,0.0); drawstring(20,230,"Input Area"); drawstring(20,470,"Output Area"); glColor3f(0.0,0.0,0.0); glLineWidth(3.0); glBegin(GL_LINES); glVertex2f(10,10); glVertex2f(10,490); glVertex2f(10,490); glVertex2f(490,490); glVertex2f(490,490); glVertex2f(490,10); glVertex2f(490,10); glVertex2f(10,10); glVertex2f(10,250); glVertex2f(490,250); glEnd(); glFlush(); }
void title() // to draw the starting screen { glClear(GL_COLOR_BUFFER_BIT); setFont(GLUT_BITMAP_HELVETICA_18); glColor3f(1.0,1.0,1.0); drawstring(55.0,435.0,1.0," \"Graphical Implementation Of System User Interface\""); glColor3f(1.0,1.0,1.0); drawstring(210.0,365.0,1.0,"SUBMITTED BY"); glColor3f(1.0,1.0,0.0); drawstring(150.0,340.0,1.0," ABHIJITH M 1BY11CS001"); glColor3f(1.0,1.0,0.0); drawstring(150.0,300.0,1.0," N S ANUP BHARADWAJ 1BY11CS039"); glColor3f(1.0,1.0,1.0); drawstring(195.0,240.0,1.0,"UNDER THE GUIDANCE OF"); glColor3f(1.0,1.0,0.0); drawstring(140.0,200.0,1.0," Mr. Muneshwara M S Ms. Ambika G N "); setFont(GLUT_BITMAP_HELVETICA_12); glColor3f(1.0,0.0,1.0); drawstring(130.0,180.0,1.0," Assistant Professor Assistant Professor"); glColor3f(1.0,0.0,1.0); drawstring(130.0,160.0,1.0," Dept. of CSE Dept. of CSE"); glColor3f(1.0,0.0,1.0); drawstring(140.0,140.0,1.0," BMSIT BMSIT"); draw_key_int(); glFlush(); }
void text(void) // to draw the text in menu screen { setFont(GLUT_BITMAP_HELVETICA_18); glColor3f(1.0,1.0,1.0); drawstring(200.0,355.0,1.0," GRAPHICAL SYSTEM"); glColor3f(1.0,1.0,1.0); drawstring(235.0,250.0,1.0," Loading..."); glColor3f(1.0,1.0,1.0); drawstring(360.0,80.0,1.0," Press P to proceed"); glFlush(); }
void top_menu(int option) { int x,y; switch(option) { case 1: read(); glutPostRedisplay(); break; case 2: drawline(); glutPostRedisplay(); break; case 3: for(int i=1; i<=n; i++) { glClear(GL_COLOR_BUFFER_BIT); initial(); for(int r=1;r<=n;r++) { x=a[r]; y=b[r]; glPointSize(40); if(r==src) glColor3f(0.7f, 0.4f, 0.0f); else glColor3f(0.5f, 0.5f, 0.8f); glBegin(GL_POINTS); glVertex2f(x,y); glEnd(); glColor3f(0.0,1.0,0.0); s1=itoa(r,s,10); drawstring(x-5,y-5,s1); setFont(GLUT_BITMAP_HELVETICA_18); glColor3f(0.0,0.0,0.0); drawstring(130,470,"For source"); glFlush(); } drawline(); s1=itoa(i,s,10); setFont(GLUT_BITMAP_HELVETICA_18); glColor3f(0.0,0.0,0.0); drawstring(230,470,s1); glutPostRedisplay(); shortestpath(i); delay(); } break; case 4: exit(0); } }
void display() { int width=glutGet(GLUT_WINDOW_WIDTH); int height=glutGet(GLUT_WINDOW_HEIGHT); glClear(GL_COLOR_BUFFER_BIT); glColor3f(0.8,1,0); square(-9.5,-9.5,19); glColor3f(0,1,0); square(-7,-6,13); glColor3f(1,0,0); drawstring(-7,4,"DR.AMBEDKAR INSTITUTE OF TECHNOLOGY"); drawstring(-3,3,"Welcome"); cube(); glutSwapBuffers(); }
//DRAW THE EDGES void drawline() { int j,k,x1,x2,y1,y2; for(j=1;j<=n;j++) { for(k=1;k<=n;k++) { if(cost[j][k]!=999 && j<k) { x1=a[j]; y1=b[j]; x2=a[k]; y2=b[k]; glColor3f(0.0,0.5,0.0); glLineWidth(3); glBegin(GL_LINES); glVertex2i(x1-7,y1+10); glVertex2i(x2-7,y2+10); glEnd(); s1=itoa(cost[j][k],s,10); drawstring((x1+x2-16)/2,(y1+y2+22)/2,s1); glFlush(); } if(cost[j][k]!=cost[k][j] && cost[j][k]!=999 && j>k) { x1=a[j]; y1=b[j]; x2=a[k]; y2=b[k]; glColor3f(1.0,0.5,0.0); glBegin(GL_LINES); glVertex2i(x1+10,y1+18); glVertex2i(x2+10,y2+18); glEnd(); s1=itoa(cost[j][k],s,10); drawstring((x1+x2+20)/2,(y1+y2+36)/2,s1); glFlush(); } } } }
void clearrow(int r) { char space[cmax]; int i; for (i = 0; i < cmax - 1; i++) space[i] = ' '; space[i] = '\0'; drawstring(space, r, 0); }
void draw_key_int(void) // text for keyboard interaction { glColor3f(0.0,0.0,0.0); glBegin(GL_POLYGON); glVertex2f(0,0); glVertex2f(0,135); glVertex2f(500,135); glVertex2f(500,0); glEnd(); glFlush(); glColor3f(0.0f,1.0f,1.0f); setFont(GLUT_BITMAP_HELVETICA_18); drawstring(360.0,100.0,1.0,"DO U WISH TO CONTINUE?"); glColor3f(0.0f,1.0f,1.0f); drawstring(360.0,80.0,1.0,"PRESS Y/N"); glFlush(); }
static void memory(int start) { struct vmtotal vmt; struct bcachestats bcs; size_t size; int mib[3]; char buf[64]; mib[0] = CTL_VM; mib[1] = VM_METER; size = sizeof(vmt); if (sysctl(mib, 2, &vmt, &size, NULL, 0) < 0) return; mib[0] = CTL_VFS; mib[1] = VFS_GENERIC; mib[2] = VFS_BCACHESTAT; size = sizeof(bcs); if (sysctl(mib, 3, &bcs, &size, NULL, 0) < 0) return; sprintf(buf, "Mem: %d%s/%d%s Free: %d%s Cache: %lld%s", scale(vmt.t_arm), unit(vmt.t_arm), scale(vmt.t_rm), unit(vmt.t_rm), scale(vmt.t_free), unit(vmt.t_free), scale(bcs.numbufpages), unit(bcs.numbufpages)); drawstring(buf, start, 0); }
void MyDrawString(/*short dir,*/ short h, short v, char *s,Boolean framed,short selectMode) { Rect r; if(sharedPrinting)selectMode = POINTDRAWFLAG; if(strlen(s) >0) { GetTextOffsets(/*dir,*/s,&h,&v); GetStringRect(s,h,v,&r); if(selectMode == BADPOINTDRAWFLAG)selectMode = POINTDRAWFLAG; if(selectMode == POINTDRAWFLAG) { EraseRect(&r); MyMoveTo(h,v); drawstring(s); } if(framed) { if(selectMode != POINTDRAWFLAG) { PenMode(patXor);PaintRect(&r); } PenMode(patCopy); MyFrameRect(&r); } } }
void drawscore() { char temp[6]; char c; temp[2] = '/'; temp[5] = 0; if (found < 10) temp[0] = ' '; else if (found < 20) temp[0] = '1'; else if (found < 30) temp[0] = '2'; else temp[0] = '3'; c = found; while (c >= 10) c -= 10; temp[1] = '0' + c; if (total < 10) temp[3] = ' '; else if (total < 20) temp[3] = '1'; else if (total < 30) temp[3] = '2'; else temp[3] = '3'; c = total; while (c >= 10) c -= 10; temp[4] = '0' + c; drawstring(temp, 32-5, 168); }
//DRAW THE NODES (SQUARES) void drawSquare(int x, int y) { if(i<=n) { y = 500-y; //Convert from screen coordinates glPointSize(40); if(i==src) glColor3f(0.7f, 0.4f, 0.0f); else glColor3f(0.5f, 0.5f, 0.8f); glBegin(GL_POINTS); glVertex2f(x , y); glEnd(); a[i]=x; b[i]=y; glColor3f(0.0f, 1.0f, 0.0f); s1=itoa(i,s,10); drawstring(x-5,y-5,s1); glFlush(); } i=i+1; }
void text(void) // to draw the text in menu screen { setFont(GLUT_BITMAP_HELVETICA_18); glColor3f(1.0,1.0,1.0); drawstring(95.0,455.0,1.0,"* * * * * * * * * GSM CALL SETUP PROCEDURE * * * * * * * * *"); glColor3f(1.0,1.0,1.0); drawstring(210.0,405.0,1.0,"First Use"); glColor3f(1.0,1.0,1.0); drawstring(200.0,350.0,1.0," Initiate Local Call"); glColor3f(1.0,1.0,1.0); drawstring(210.0,295.0,1.0,"Initaite STD call"); glColor3f(1.0,1.0,1.0); drawstring(200.0,240.0,1.0,"Some String"); glColor3f(1.0,1.0,1.0); drawstring(215.0,185.0,1.0,"Some String"); glColor3f(1.0,1.0,1.0); drawstring(225.0,130.0,1.0," EXIT"); glFlush(); }
void howsearchworks() //after clicking Google Search { glClear(GL_COLOR_BUFFER_BIT); setFont(GLUT_BITMAP_TIMES_ROMAN_24); glColor3f(1,1,1); drawstring(190,300,1.0,"HOW SEARCH WORKS"); setFont(GLUT_BITMAP_HELVETICA_18); glColor3f(1,1,1); drawstring(195,270,1.0,"From Algorithms to Answers."); setFont(GLUT_BITMAP_HELVETICA_12); glColor3f(0.60,0.40,0.70); drawstring(300,150,1.0,"Press 1 to Continue."); glFlush(); }
void do_key(char key) { short i, j; while (ANYKEY()) { readkeyboard(); do_halt(); } if (minefield[key]) { // boom drawstring("Oops, you appear to have stepped", 0, 176); drawstring("on a rotten egg and died. ", 0, 184); for (j = 0; j < 20; j++) { playfx(1); for (i = 0; i < 32*21; i++) { if (xorshift8() > 220) *((char*)0x4000+192*32+i) = xorshift8() & 7; } for (i = 0; i < 51; i++) xorshift8(); do_halt(); } reset_game(); } else { drawval(key, count_mines(key)); if (minefound[key] == 0) { minefound[key] = 1; found++; if (found == total) { framecounter = 0; drawstring("Congratulations!! You did it! ", 0, 176); drawstring("Step on a mine for a new game. ", 0, 184); } } playfx(0); } }
//DISPLAY FUNCTION FOR TITLE PAGE void title() { glLineWidth(3.0); glColor3f(1.0,1.0,1.0); glBegin(GL_LINE_LOOP); glVertex2f(10,10); glVertex2f(10,490); glVertex2f(490,490); glVertex2f(490,10); glEnd(); setFont(GLUT_BITMAP_HELVETICA_18); glColor3f(1.0,1.0,1.0); drawstring(100,440,"Topic: Bellman Ford Algorithm"); glColor3f(1.0,1.0,1.0); drawstring(100,400,"Submitted by"); glColor3f(1.0,0.0,0.0); drawstring(100,360,"Abhishek Megotia"); glColor3f(1.0,0.0,0.0); drawstring(100,320,"VI CSE A"); glColor3f(1.0,0.0,0.0); drawstring(100,280,"1BG11CS003"); glColor3f(1.0,1.0,1.0); drawstring(100,100,"Right click in My Window for options"); glFlush(); }
static void datetime(void) { char buf[40]; tick = time(NULL); if (tick % 2) strftime(buf, sizeof(buf), "%A %d.%m.%Y %H:%M", localtime(&tick)); else strftime(buf, sizeof(buf), "%A %d.%m.%Y %H.%M", localtime(&tick)); drawstring(buf, BARWIDTH - 5, 1); }
void M17Draw (DialogPtr dialog, Rect *r, long item) { char s[256]; TCATSMover *mover; TextFontSize(kFontIDGeneva,LISTTEXTSIZE); sharedMoverList->GetListItem((Ptr)&mover, item); strcpy(s, mover->className); drawstring(s); TextFontSize(0,12); }
void DrawLat(long latVal, Rect r, WorldRect view, short precision, Boolean label) { short /*x1, x2, y, */ w; Point x_y1, x_y2; WorldPoint wp; Boolean offQuickDrawPlane; char roundLat, roundLong, longString[20], latString[20]; if (latVal > 90000010 || latVal < -90000000) return; //view.loLong = _min(view.loLong, 180000000); view.loLong = _min(view.loLong, 360000000); //view.loLong = _max(view.loLong, -180000000); view.loLong = _max(view.loLong, -360000000); //x1 = SameDifferenceX(view.loLong); x_y1 = GetQuickDrawPt(view.loLong,latVal,&r,&offQuickDrawPlane); //view.hiLong = _min(view.hiLong, 180000000); view.hiLong = _min(view.hiLong, 360000000); //view.hiLong = _max(view.hiLong, -180000000); view.hiLong = _max(view.hiLong, -360000000); //x2 = SameDifferenceX(view.hiLong); x_y2 = GetQuickDrawPt(view.hiLong,latVal,&r,&offQuickDrawPlane); //y = (r.bottom + r.top) - SameDifferenceY(latVal); //if (y > (r.bottom - 30)) return; // don't let low lat line write over long values if (x_y1.v > (r.bottom - 30)) return; // don't let low lat line write over long values wp.pLong = 0; wp.pLat = latVal; WorldPointToStrings2(wp, latString, &roundLat, longString, &roundLong); SimplifyLLString(latString, precision, roundLat); w = label ? stringwidth(latString) : 0; RGBForeColor(&colors[LIGHTGRAY]); // SetPenPat(label ? BLACK : GRAY); //MyMoveTo(x1, y); MyMoveTo(x_y1.h, x_y1.v); // MyMoveTo(x1 + w + 10, y); //MyLineTo(x2, y); MyLineTo(x_y2.h, x_y2.v); if (label) { RGBForeColor(&colors[BLACK]); // MyMoveTo(x1 + 5, y + 3); //MyMoveTo(x1 + 1, y); MyMoveTo(x_y1.h + 1, x_y1.v); drawstring(latString); } }
static void showfile(int start) { FILE *f; char *p; size_t len; f = fopen("/tmp/status.txt", "r"); p = fgetln(f, &len); if (!p || !len) return; p[len - 1] = '\0'; drawstring(p, start, 0); fclose(f); }
void title() // to draw the starting screen { glClear(GL_COLOR_BUFFER_BIT); setFont(GLUT_BITMAP_HELVETICA_18); glColor3f(1.0,1.0,1.0); drawstring(20.0,435.0,1.0,"* * G R A P H I C A L I L L U S T R A T I O N OF GSM CALL SETUP * *"); glColor3f(1.0,1.0,1.0); drawstring(210.0,365.0,1.0,"SUBMITTED BY"); glColor3f(0.0,1.0,1.0); drawstring(180.0,340.0,1.0," Nitesh A Jain 1BY10CS047"); glColor3f(0.0,1.0,1.0); drawstring(180.0,320.0,1.0," Parthasarathy M Alwar 1BY10CS049"); glColor3f(1.0,1.0,1.0); drawstring(190.0,260.0,1.0,"UNDER THE GUIDANCE OF"); glColor3f(0.0,1.0,1.0); drawstring(70.0,230.0,1.0," Guide "); setFont(GLUT_BITMAP_HELVETICA_12); glColor3f(0.0,1.0,1.0); drawstring(190.0,230.0,1.0," Guide Degrees ."); glColor3f(0.0,1.0,1.0); drawstring(70.0,215.0,1.0," Lecturer, Dept. of CS&E"); glColor3f(0.0,1.0,1.0); drawstring(70.0,200.0,1.0," BMSIT"); glFlush(); }
static void procs(int start) { unsigned int nprocs; size_t size; int mib[2]; char buf[32]; mib[0] = CTL_KERN; mib[1] = KERN_NPROCS; size = sizeof(nprocs); if (sysctl(mib, 2, &nprocs, &size, NULL, 0) < 0) return; sprintf(buf, "Procs: %d", nprocs); drawstring(buf, start, 0); }
void DrawLong(long longVal, Rect r, WorldRect view, short precision, Boolean label) { short /*x, y1, y2, */ w; Point x_y1,x_y2; WorldPoint wp; Boolean offQuickDrawPlane; char roundLat, roundLong, longString[20], latString[20]; //if (longVal > 180000010 || longVal < -180000000) return; //if (longVal > 360000010 || longVal < -180000000) return; if (longVal > 360000010 || longVal < -360000000) return; //x = SameDifferenceX(longVal); view.loLat = _min(view.loLat, 90000000); view.loLat = _max(view.loLat, -90000000); //y1 = (r.bottom + r.top) - SameDifferenceY(view.loLat); x_y1 = GetQuickDrawPt(longVal,view.loLat,&r,&offQuickDrawPlane); view.hiLat = _min(view.hiLat, 90000000); view.hiLat = _max(view.hiLat, -90000000); //y2 = (r.bottom + r.top) - SameDifferenceY(view.hiLat); x_y2 = GetQuickDrawPt(longVal,view.hiLat,&r,&offQuickDrawPlane); // RGBForeColor(&colors[label ? BLACK : LIGHTGRAY]); RGBForeColor(&colors[LIGHTGRAY]); // SetPenPat(label ? BLACK : GRAY); // MyMoveTo(x, y1 - 20); //MyMoveTo(x, y1); // bottom edge of view //MyLineTo(x, y2 - 1); // top edge of view MyMoveTo(x_y1.h, x_y1.v); // bottom edge of view MyLineTo(x_y2.h, x_y2.v - 1); // top edge of view if (label) { RGBForeColor(&colors[BLACK]); wp.pLong = longVal; wp.pLat = 0; WorldPointToStrings2(wp, latString, &roundLat, longString, &roundLong); SimplifyLLString(longString, precision, roundLong); w = stringwidth(longString); //MyMoveTo(x - (w / 2), y1 - 1); MyMoveTo(x_y1.h - (w / 2), x_y1.v - 1); drawstring(longString); } }
static void loadaverage(int start) { struct loadavg load; size_t size; int mib[2]; char buf[32]; mib[0] = CTL_VM; mib[1] = VM_LOADAVG; size = sizeof(load); if (sysctl(mib, 2, &load, &size, NULL, 0) < 0) return; sprintf(buf, "Load: %.2f %.2f %.2f", (double) load.ldavg[0] / load.fscale, (double) load.ldavg[1] / load.fscale, (double) load.ldavg[2] / load.fscale); drawstring(buf, start, 0); }
static void cpubar(int start) { int i, len, title; long sum, diff, cpunow[CPUSTATES], cpudiff[CPUSTATES]; int mib[] = { CTL_KERN, KERN_CPTIME }; size_t size = sizeof(cpunow); title = drawstring("CPU: ", start, 0); if (sysctl(mib, 2, &cpunow, &size, NULL, 0) < 0) return; if (!cpulast[0]) { for (i=0, sum=0; i<CPUSTATES; i++) cpulast[i] = cpunow[i]; return; } for (i=0, sum=0; i<CPUSTATES; i++) { if (cpunow[i] < cpulast[i]) diff = LONG_MAX - cpulast[i] + cpunow[i]; else diff = cpunow[i] - cpulast[i]; sum += diff; cpudiff[i] = diff; cpulast[i] = cpunow[i]; } for (i=0; i<MAXVAL-1; i++) busy[i] = busy[i+1]; busy[MAXVAL-1] = 100 - (int)((100 * cpudiff[CP_IDLE]) / sum); XftDrawRect(xftd, &black, start + title, 0, MAXVAL, BARHEIGHT); for (i=0; i<MAXVAL; i++) { len = (int)((BARHEIGHT - 2) * busy[i] / 100); XftDrawRect(xftd, &green, start + title + i, BARHEIGHT - 1 - len, 1, len); } }
void DrawObjectsList2(WindowRef w, RECTPTR r, long n) // called once for each item in VList to draw nth line { char s[256]; short right, style = normal; Point p; ListItem item = model->GetNthListItem(n, 0, &style, s); if (item.owner == 0) return; GetPen(&p); PenNormal(); right = DrawBullet(item, r, FALSE, 0); MyMoveTo(right + 4, p.v - OBJECTLINEOFFSET); // set text-face according to style requested TextFontSizeFace(kFontIDGeneva,LISTTEXTSIZE,style); drawstring(s); DrawBullet(item, r, TRUE, 0); TextFontSizeFace(kFontIDGeneva,LISTTEXTSIZE,normal); }
void howsearchworks1() // 60 Trillion { glClear(GL_COLOR_BUFFER_BIT); glColor3f(0.3,0.6,0.1); glBegin(GL_QUADS); glVertex2f(0,500); glVertex2f(250,500); glVertex2f(250,250); glVertex2f(0,250); glEnd(); glFlush(); setFont(GLUT_BITMAP_HELVETICA_12); glColor3f(0,0,0); drawstring(45,420,1.0,"SEARCH STARTS WITH THE WEB. IT'S MADE UP OF OVER"); setFont(GLUT_BITMAP_TIMES_ROMAN_24); glColor3f(1,0,0); drawstring(100,380,1.0,"60"); setFont(GLUT_BITMAP_TIMES_ROMAN_24); glColor3f(1,0,0); drawstring(85,360,1.0,"TRILLION"); setFont(GLUT_BITMAP_HELVETICA_18); glColor3f(1,1,0); drawstring(80,330,1.0,"Individual Pages"); setFont(GLUT_BITMAP_9_BY_15); glColor3f(1,1,0); drawstring(65,320,1.0,"And its constantly growing."); setFont(GLUT_BITMAP_HELVETICA_12); glColor3f(0.60,0.40,0.70); drawstring(200,300,1.0,"Press 2 to Continue."); glFlush(); }
void main() { // unsigned char i; y8 = 1; reset_game(); /* for (i = 0; i < 40; i++) if (minefield[i] == 0) drawval(i, count_mines(i)); */ while(1) { drawscore(); readkeyboard(); if (KEYDOWN(1)) do_key(0); if (KEYDOWN(2)) do_key(1); if (KEYDOWN(3)) do_key(2); if (KEYDOWN(4)) do_key(3); if (KEYDOWN(5)) do_key(4); if (KEYDOWN(6)) do_key(5); if (KEYDOWN(7)) do_key(6); if (KEYDOWN(8)) do_key(7); if (KEYDOWN(9)) do_key(8); if (KEYDOWN(0)) do_key(9); if (KEYDOWN(Q)) do_key(10); if (KEYDOWN(W)) do_key(11); if (KEYDOWN(E)) do_key(12); if (KEYDOWN(R)) do_key(13); if (KEYDOWN(T)) do_key(14); if (KEYDOWN(Y)) do_key(15); if (KEYDOWN(U)) do_key(16); if (KEYDOWN(I)) do_key(17); if (KEYDOWN(O)) do_key(18); if (KEYDOWN(P)) do_key(19); if (KEYDOWN(A)) do_key(20); if (KEYDOWN(S)) do_key(21); if (KEYDOWN(D)) do_key(22); if (KEYDOWN(F)) do_key(23); if (KEYDOWN(G)) do_key(24); if (KEYDOWN(H)) do_key(25); if (KEYDOWN(J)) do_key(26); if (KEYDOWN(K)) do_key(27); if (KEYDOWN(L)) do_key(28); if (KEYDOWN(ENTER)) do_key(29); if (KEYDOWN(SHIFT)) do_key(30); if (KEYDOWN(Z)) do_key(31); if (KEYDOWN(X)) do_key(32); if (KEYDOWN(C)) do_key(33); if (KEYDOWN(V)) do_key(34); if (KEYDOWN(B)) do_key(35); if (KEYDOWN(N)) do_key(36); if (KEYDOWN(M)) do_key(37); if (KEYDOWN(SYM)) do_key(38); if (KEYDOWN(SPACE)) do_key(39); framecounter++; do_halt(); if (framecounter > 500) { framecounter = 0; // 12345678901234567890123456789012 switch (infoloop) { case 0: drawstring("Welcome to \"Rotten Egg Mines\" ", 0, 176); drawstring("By Jari Komppa http://iki.fi/sol", 0, 184); break; case 1: drawstring("How to play: ", 0, 176); drawstring("Press keys to find mines. ", 0, 184); break; case 2: case 4: case 6: case 8: drawstring(". . . . . . . . . . . . . . . . ", 0, 176); drawstring(" . . . . . . . . . . . . . . . .", 0, 184); break; case 3: drawstring("Sound effects played via ", 0, 176); drawstring("BeepFX by Shiru ", 0, 184); break; case 5: drawstring("Art made by using the ", 0, 176); drawstring("Image Spectrumizer ", 0, 184); break; case 7: drawstring("Sources can be found at ", 0, 176); drawstring("github.com/jarikomppa/speccy ", 0, 184); break; case 12: drawstring(" [ . . . . . . . . . . .] ", 0, 176); drawstring(" [. . . . . . . . . . . ] ", 0, 184); break; case 13: drawstring(" [ . . . . . . .] ", 0, 176); drawstring(" [. . . . . . . ] ", 0, 184); break; case 14: drawstring(" [ . . .] ", 0, 176); drawstring(" [. . . ] ", 0, 184); break; case 15: drawstring(" ", 0, 176); drawstring(" ", 0, 184); break; } infoloop++; if (infoloop == 16) infoloop = 0; } } }
void VectDraw(DialogPtr d, Rect *rectPtr, long itemNumber) { #pragma unused (rectPtr) Point p; short h,v; RGBColor rgb; Rect rgbrect; char numstr[30],numstr2[30]; double x = (*gEditContourLevels)[itemNumber]; float colorLevel; long numLevels = GetNumDoubleHdlItems(gEditContourLevels); SetRGBColor(&rgb,0,0,0); TextFont(kFontIDGeneva); TextSize(LISTTEXTSIZE); rgbrect=GetDialogItemBox(d,CONT_LISTID); h=(rgbrect.left); GetPen(&p); v=p.v; MySetRect(&rgbrect,h+4,v-9,h+14,v+1); // set unique color for each value, not on linear scale colorLevel = float(itemNumber)/float(numLevels-1); //rgb = GetRGBColor(colorLevel); #ifdef IBM rgb = GetRGBColor(colorLevel); #else rgb = GetRGBColor(1.-colorLevel); #endif //rgb = GetRGBColor(0.8-colorLevel); RGBForeColor(&rgb); PaintRect(&rgbrect); MyFrameRect(&rgbrect); MyMoveTo(h+30,v+1); RGBForeColor(&colors[BLACK]); if (itemNumber<numLevels-1) { MyNumToStr(x,numstr); MyNumToStr((*gEditContourLevels)[itemNumber+1],numstr2); strcat(numstr," - "); strcat(numstr,numstr2); } else { strcpy(numstr,"> "); MyNumToStr(x,numstr2); strcat(numstr,numstr2); } if (gContourType==0) { strcat(numstr," mg/L"); } else { MyNumToStr(x,numstr); strcat(numstr," m"); } //drawstring(MyNumToStr(x,numstr)); drawstring(numstr); return; }
void emulate(void) { char buf[BUFS+1]; int i; int n; int c; int operand[10]; int noperand; int savex, savey, saveattr, saveisgraphics; int isgraphics; int g0set, g1set; int dch; isgraphics = 0; g0set = 'B'; /* US ASCII */ g1set = 'B'; /* US ASCII */ savex = savey = 0; yscrmin = 0; yscrmax = ymax; saveattr = 0; saveisgraphics = 0; /* set initial tab stops to DEC-standard 8-column spacing */ for(c=0; (c+=8)<nelem(tabcol);) tabcol[c] = 1; for (;;) { if (y > ymax) { x = 0; newline(); } buf[0] = get_next_char(); buf[1] = '\0'; switch(buf[0]) { case '\000': case '\001': case '\002': case '\003': case '\004': case '\005': case '\006': goto Default; case '\007': /* bell */ ringbell(); break; case '\010': /* backspace */ if (x > 0) --x; break; case '\011': /* tab to next tab stop; if none, to right margin */ for(c=x+1; c<nelem(tabcol) && !tabcol[c]; c++) ; if(c < nelem(tabcol)) x = c; else x = xmax; break; case '\012': /* linefeed */ case '\013': case '\014': newline(); if (ttystate[cs->raw].nlcr) x = 0; break; case '\015': /* carriage return */ x = 0; if (ttystate[cs->raw].crnl) newline(); break; case '\016': /* SO: invoke G1 char set */ isgraphics = (isdigit(g1set)); break; case '\017': /* SI: invoke G0 char set */ isgraphics = (isdigit(g0set)); break; case '\020': /* DLE */ case '\021': /* DC1 */ case '\022': /* XON */ case '\023': /* DC3 */ case '\024': /* XOFF */ case '\025': /* NAK */ case '\026': /* SYN */ case '\027': /* ETB */ case '\030': /* CAN: cancel escape sequence, display checkerboard (not implemented) */ case '\031': /* EM */ case '\032': /* SUB: same as CAN */ goto Default; ; /* ESC, \033, is handled below */ case '\034': /* FS */ case '\035': /* GS */ case '\036': /* RS */ case '\037': /* US */ break; case '\177': /* delete: ignored */ break; case '\033': switch(dch = get_next_char()){ /* * 1 - graphic processor option on (no-op; not installed) */ case '1': break; /* * 2 - graphic processor option off (no-op; not installed) */ case '2': break; /* * 7 - save cursor position. */ case '7': //print("save\n"); savex = x; savey = y; saveattr = attr; saveisgraphics = isgraphics; break; /* * 8 - restore cursor position. */ case '8': //print("restore\n"); x = savex; y = savey; attr = saveattr; isgraphics = saveisgraphics; break; /* * c - Reset terminal. */ case 'c': print("resetterminal\n"); cursoron = 1; ttystate[cs->raw].nlcr = 0; break; /* * D - active position down a line, scroll if at bottom margin. * (Original VT100 had a bug: tracked new-line/line-feed mode.) */ case 'D': if(++y > yscrmax) { y = yscrmax; scroll(yscrmin+1, yscrmax+1, yscrmin, yscrmax); } break; /* * E - active position to start of next line, scroll if at bottom margin. */ case 'E': x = 0; if(++y > yscrmax) { y = yscrmax; scroll(yscrmin+1, yscrmax+1, yscrmin, yscrmax); } break; /* * H - set tab stop at current column. * (This is cursor home in VT52 mode (not implemented).) */ case 'H': if(x < nelem(tabcol)) tabcol[x] = 1; break; /* * M - active position up a line, scroll if at top margin.. */ case 'M': if(--y < yscrmin) { y = yscrmin; scroll(yscrmin, yscrmax, yscrmin+1, yscrmin); } break; /* * Z - identification. the terminal * emulator will return the response * code for a generic VT100. */ case 'Z': Ident: sendnchars2(7, "\033[?1;2c"); /* VT100 with AVO option */ // sendnchars2(5, "\033[?6c"); /* VT102 (insert/delete-char, etc.) */ break; /* * < - enter ANSI mode */ case '<': break; /* * > - set numeric keypad mode on (not implemented) */ case '>': break; /* * = - set numeric keypad mode off (not implemented) */ case '=': break; /* * # - Takes a one-digit argument */ case '#': switch(get_next_char()){ case '3': /* Top half of double-height line */ case '4': /* Bottom half of double-height line */ case '5': /* Single-width single-height line */ case '6': /* Double-width line */ case '7': /* Screen print */ case '8': /* Fill screen with E's */ break; } break; /* * ( - switch G0 character set */ case '(': g0set = get_next_char(); break; /* * - switch G1 character set */ case ')': g1set = get_next_char(); break; /* * Received left bracket. */ case '[': /* * A semi-colon or ? delimits arguments. */ memset(operand, 0, sizeof(operand)); operand[0] = number(buf, &i); noperand = 1; while(buf[0] == ';' || buf[0] == '?'){ if(noperand < nelem(operand)){ noperand++; operand[noperand-1] = number(buf, nil); } else number(buf, nil); } /* * do escape2 stuff */ switch(dch = buf[0]){ /* * c - same as ESC Z: what are you? */ case 'c': goto Ident; /* * g - various tabstop manipulation */ case 'g': switch(operand[0]){ case 0: /* clear tab at current column */ if(x < nelem(tabcol)) tabcol[x] = 0; break; case 3: /* clear all tabs */ memset(tabcol, 0, sizeof tabcol); break; } break; /* * l - clear various options. */ case 'l': if(noperand == 1){ switch(operand[0]){ case 20: /* set line feed mode */ ttystate[cs->raw].nlcr = 1; break; case 30: /* screen invisible (? not supported through VT220) */ break; } }else while(--noperand > 0){ switch(operand[noperand]){ case 1: /* set cursor keys to send ANSI functions: ESC [ A..D */ break; case 2: /* set VT52 mode (not implemented) */ break; case 3: /* set 80 columns */ setdim(-1, 80); break; case 4: /* set jump scrolling */ break; case 5: /* set normal video on screen */ break; case 6: /* set origin to absolute */ originrelative = 0; x = y = 0; break; case 7: /* reset auto-wrap mode */ wraparound = 0; break; case 8: /* reset auto-repeat mode */ break; case 9: /* reset interlacing mode */ break; case 25: /* text cursor off (VT220) */ cursoron = 0; break; } } break; /* * s - some dec private stuff. actually [ ? num s, but we can't detect it. */ case 's': break; /* * h - set various options. */ case 'h': if(noperand == 1){ switch(operand[0]){ default: break; case 20: /* set newline mode */ ttystate[cs->raw].nlcr = 0; break; case 30: /* screen visible (? not supported through VT220) */ break; } }else while(--noperand > 0){ switch(operand[noperand]){ default: break; case 1: /* set cursor keys to send application function: ESC O A..D */ break; case 2: /* set ANSI */ break; case 3: /* set 132 columns */ setdim(-1, 132); break; case 4: /* set smooth scrolling */ break; case 5: /* set screen to reverse video (not implemented) */ break; case 6: /* set origin to relative */ originrelative = 1; x = 0; y = yscrmin; break; case 7: /* set auto-wrap mode */ wraparound = 1; break; case 8: /* set auto-repeat mode */ break; case 9: /* set interlacing mode */ break; case 25: /* text cursor on (VT220) */ cursoron = 1; break; } } break; /* * m - change character attrs. */ case 'm': setattr(noperand, operand); break; /* * n - request various reports */ case 'n': switch(operand[0]){ case 5: /* status */ sendnchars2(4, "\033[0n"); /* terminal ok */ break; case 6: /* cursor position */ sendnchars2(sprint(buf, "\033[%d;%dR", originrelative ? y+1 - yscrmin : y+1, x+1), buf); break; } break; /* * q - turn on list of LEDs; turn off others. */ case 'q': break; /* * r - change scrolling region. operand[0] is * min scrolling region and operand[1] is max * scrolling region. */ case 'r': yscrmin = 0; yscrmax = ymax; switch(noperand){ case 2: yscrmax = operand[1]-1; if(yscrmax > ymax) yscrmax = ymax; case 1: yscrmin = operand[0]-1; if(yscrmin < 0) yscrmin = 0; } x = 0; y = yscrmin; break; /* * x - report terminal parameters */ case 'x': sendnchars2(20, "\033[3;1;1;120;120;1;0x"); break; /* * y - invoke confidence test */ case 'y': break; /* * A - cursor up. */ case 'e': case 'A': fixops(operand); y -= operand[0]; if(y < yscrmin) y = yscrmin; olines -= operand[0]; if(olines < 0) olines = 0; break; /* * B - cursor down */ case 'B': fixops(operand); y += operand[0]; if(y > yscrmax) y=yscrmax; break; /* * C - cursor right */ case 'a': case 'C': fixops(operand); x += operand[0]; /* * VT-100-UG says not to go past the * right margin. */ if(x > xmax) x = xmax; break; /* * D - cursor left */ case 'D': fixops(operand); x -= operand[0]; if(x < 0) x = 0; break; /* * G - cursor to column */ case '\'': case 'G': fixops(operand); x = operand[0] - 1; if(x > xmax) x = xmax; break; /* * H and f - cursor motion. operand[0] is row and * operand[1] is column, origin 1. */ case 'H': case 'f': fixops(operand+1); x = operand[1] - 1; if(x > xmax) x = xmax; /* fallthrough */ /* * d - cursor to line n (xterm) */ case 'd': fixops(operand); y = operand[0] - 1; if(originrelative){ y += yscrmin; if(y > yscrmax) y = yscrmax; }else{ if(y > ymax) y = ymax; } break; /* * J - clear some or all of the display. */ case 'J': switch (operand[0]) { /* * operand 2: whole screen. */ case 2: clear(Rpt(pt(0, 0), pt(xmax+1, ymax+1))); break; /* * operand 1: start of screen to active position, inclusive. */ case 1: clear(Rpt(pt(0, 0), pt(xmax+1, y))); clear(Rpt(pt(0, y), pt(x+1, y+1))); break; /* * Default: active position to end of screen, inclusive. */ default: clear(Rpt(pt(x, y), pt(xmax+1, y+1))); clear(Rpt(pt(0, y+1), pt(xmax+1, ymax+1))); break; } break; /* * K - clear some or all of the line. */ case 'K': switch (operand[0]) { /* * operand 2: whole line. */ case 2: clear(Rpt(pt(0, y), pt(xmax+1, y+1))); break; /* * operand 1: start of line to active position, inclusive. */ case 1: clear(Rpt(pt(0, y), pt(x+1, y+1))); break; /* * Default: active position to end of line, inclusive. */ default: clear(Rpt(pt(x, y), pt(xmax+1, y+1))); break; } break; /* * P - delete character(s) from right of cursor (xterm) */ case 'P': fixops(operand); i = x + operand[0]; draw(screen, Rpt(pt(x, y), pt(xmax+1, y+1)), screen, nil, pt(i, y)); clear(Rpt(pt(xmax-operand[0], y), pt(xmax+1, y+1))); break; /* * @ - insert blank(s) to right of cursor (xterm) */ case '@': fixops(operand); i = x + operand[0]; draw(screen, Rpt(pt(i, y), pt(xmax+1, y+1)), screen, nil, pt(x, y)); clear(Rpt(pt(x, y), pt(i, y+1))); break; /* * X - erase character(s) at cursor and to the right (xterm) */ case 'X': fixops(operand); i = x + operand[0]; clear(Rpt(pt(x, y), pt(i, y+1))); break; /* * L - insert a line at cursor position (VT102 and later) */ case 'L': fixops(operand); for(i = 0; i < operand[0]; ++i) scroll(y, yscrmax, y+1, y); break; /* * M - delete a line at cursor position (VT102 and later) */ case 'M': fixops(operand); for(i = 0; i < operand[0]; ++i) scroll(y+1, yscrmax+1, y, yscrmax); break; /* * S,T - scroll up/down (xterm) */ case 'T': fixops(operand); for(i = 0; i < operand[0]; ++i) scroll(yscrmin, yscrmax, yscrmin+1, yscrmin); break; case 'S': fixops(operand); for(i = 0; i < operand[0]; ++i) scroll(yscrmin+1, yscrmax+1, yscrmin, yscrmin); break; case '=': /* ? not supported through VT220 */ number(buf, nil); switch(buf[0]) { case 'h': case 'l': break; } break; /* * Anything else we ignore for now... */ default: print("unknown escape2 '%c' (0x%x)\n", dch, dch); break; } break; /* * Collapse multiple '\033' to one. */ case '\033': peekc = '\033'; break; /* set title */ case ']': /* it's actually <esc> ] num ; title <bel> */ { int ch, fd; number(buf, nil); i = 0; while((ch = get_next_char()) != '\a') if(i < sizeof buf) buf[i++] = ch; fd = open("/dev/label", OWRITE); write(fd, buf, i); close(fd); } break; /* * Ignore other commands. */ default: print("unknown command '%c' (0x%x)\n", dch, dch); break; } break; default: /* ordinary char */ Default: if(isgraphics && gmap[(uint8_t) buf[0]]) buf[0] = gmap[(uint8_t) buf[0]]; /* line wrap */ if (x > xmax){ if(wraparound){ x = 0; newline(); }else{ continue; } } n = 1; c = 0; while (!cs->raw && host_avail() && x+n<=xmax && n<BUFS && (c = get_next_char())>=' ' && c<'\177') { buf[n++] = c; c = 0; } buf[n] = 0; // clear(Rpt(pt(x,y), pt(x+n, y+1))); drawstring(pt(x, y), buf, attr); x += n; peekc = c; break; } } }