Exemplo n.º 1
0
void level(void){// レベルの表記
  if(a==1) drawstr(win, 5, 485, 18, 0.0, "LV1");// 初期レベル1
  if(a==2) drawstr(win, 5, 485, 18, 0.0, "LV2");
  if(a==3) drawstr(win, 5, 485, 18, 0.0, "LV3");
  if(a==4) drawstr(win, 5, 485, 18, 0.0, "LV4");
  if(a==5) drawstr(win, 5, 485, 18, 0.0, "LV5");// 最高レベル5
}
Exemplo n.º 2
0
    void drawPredicates(SkCanvas* canvas, const SkPoint pts[]) {
        SkRegion rgn;
        build_base_rgn(&rgn);

        drawstr(canvas, "Intersects", pts[0], rgn.intersects(fRect));
        drawstr(canvas, "Contains", pts[1], rgn.contains(fRect));
    }
Exemplo n.º 3
0
int main()
{
    time_t time_now ;
    int win ;
    char d0[8],d1[8],d2[8],d3[8], t0[16] ;

    gsetinitialattributes(ENABLE,DOCK_APPLICATION) ;
    win = gopen(56,56) ;
    layer(win,0,1) ;
    while(1){
	time(&time_now) ;
	sscanf(ctime(&time_now),"%s %s %s %s %s\n",d0,d1,d2,t0,d3) ;
	gclr(win) ;
	newrgbcolor(win,0xff,0xff,0xff) ;
	drawstr(win,4,1, 8 ,0,"%s %s %s",d0,d1,d2) ;
	drawstr(win,4,46, 10 ,0,"%s",t0) ;
	gputimage(win,0,10,Ppmimage,PPM_WIDTH,PPM_HEIGHT,0) ;
	newrgbcolor(win,0x40,0x40,0x40) ;
	moveto(win,0,0) ;
	lineto(win,0,55) ;
	lineto(win,55,55) ;
	newrgbcolor(win,0xe7,0xe7,0xe7) ;
	lineto(win,55,0) ;
	lineto(win,0,0) ;
	copylayer(win,1,0) ;
	msleep(200) ;
    }
    gcloseall() ;
    return(0) ;
}
Exemplo n.º 4
0
void content()
{
	extern bool SphereInFrustum (float,float,float,float);

	glClear (GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);

	// extract frustum parameter of current camera
	extern void ExtractFrustum();
	ExtractFrustum();

	int nshow = 0;
	for (int i = 0; i < NSPHERES; i++) {
		if (! cull || SphereInFrustum (pos[i][0], pos[i][1],pos[i][2], radius[i])) {
			++nshow;
			glPushMatrix();
				glTranslatef (pos[i][0], pos[i][1], pos[i][2]);
				glutSolidSphere (radius[i], 120,120); 
			glPopMatrix();
		}
	}


	BEGIN_2D_OVERLAY (10,10);
	glDisable(GL_LIGHTING);
	glColor3f (1,1,0);
	if (cull) 	
		drawstr (1,1, "cull [%d|%d]", NSPHERES-nshow, NSPHERES);
	else
		drawstr (1,1, "no cull");
	END_2D_OVERLAY();

	content_count++;
	glutSwapBuffers();
}
Exemplo n.º 5
0
void LEVEL4(void){//レベル4に出る半分を埋め尽くす円
  if(a==4){//半分を埋め尽くす円
    newpen(win, 4);//色は青
    fillcirc(win, harf_x, harf_y, 200.0, 200.0);
    if(harf_x == 400){//右側の場合の当たり判定	   
      if( (200+5)*(200+5) >
	  (x-400)*(x-400)+(25-harf_y)*(25-harf_y) ){
	gclr(win);
	newpen(win, 1);
	drawstr(win, 150, 250, 24, 0.0, "GAMEOVER");
	msleep(time*30);
	exit(0);	 
      }
    }
    if(harf_x == 0){//左側の場合の当たり判定
      if( (200+5)*(200+5) >
	  (x-0)*(x-0)+(25-harf_y)*(25-harf_y) ){
	gclr(win);
	newpen(win, 1);
	drawstr(win, 150, 250, 24, 0.0, "GAMEOVER");
	msleep(time*30);
	exit(0);
      }
    }
    harf_y-=5;//落下速度
  }
}
Exemplo n.º 6
0
static void draw_group_settings(int x, int y, int UNUSED(width), int UNUSED(height)) {
    setcolor(COLOR_MAIN_TEXT);
    setfont(FONT_SELF_NAME);

    drawstr(x + SCALE(10), y + MAIN_TOP + SCALE(10), GROUP_TOPIC);
    drawstr(x + SCALE(10), y + MAIN_TOP + SCALE(70), GROUP_NOTIFICATIONS);
}
Exemplo n.º 7
0
static const char *draw_text_justified(char *line, rect r, int line_height,
				       int underline, const char *s)
{
    char *j, *k;
    int w, xw, nl, sc, sw, space_width;
    point p;
    int width, height;
    font f;

    space_width = strwidth(current->fnt, " ");
    f = current->fnt;

    for(p=pt(r.x,r.y); (p.y<=r.y+r.height) && (s); p.y+=line_height)
    {
	s = get_next_line(line, r.width, s);

	p.x = r.x;

	for(j=line; (*j!='\0') && isspace(*j); j++)
	    p.x += space_width;
	for (sc=0, k=j; *k!='\0'; k++)
	    if (isspace(*k))
		sc++;
	for (nl=0, --k; (k>=j) && isspace(*k); k--) {
	    if (*k == '\n')
		nl++;
	    *k = '\0';
	    sc--;
	}

	if ((sc==0) || nl || (! s)) {
	    drawstr(p, j);
	    width = strwidth(f, j);
	}
	else {
	    w = strwidth(f, j);
	    sw = space_width + (r.x+r.width-p.x-w)/sc;
	    xw = (r.x+r.width-p.x-w)%sc;

	    for(j=strtok(j," "); j; j=strtok(NULL," "))
	    {
		drawstr(p, j);
		p.x += sw + strwidth(f, j);
		if (xw) {
		    p.x++;
		    xw--;
		}
	    }
	    width = r.width;
	}
	if (underline) {
	    height = p.y+getheight(f)-getdescent(f)+2;
	    drawline(pt(p.x+1, height), pt(p.x+width-1, height));
	}
    }

    return s;
}
Exemplo n.º 8
0
void draw_2p_menu_decor(int pl, int x, int y)
{
	x++;
	drawstr("\\l\\x", 0, x, y-1);
	y += 2;
	setcurs(x-1, y);
	putch(pl+'0');
	drawstr("P\\x\\2m", 0, x, y);
}
Exemplo n.º 9
0
void setup()
{
  GD.begin();
  GD.uncompress(RAM_CHR, cp437_chr);
  GD.uncompress(RAM_PAL, cp437_pal);
  drawstr(atxy(0, 0), "Hello");
  drawstr(atxy(10, 2), "This is the cp437 font");
  for (byte i = 0; i < 14; i++) {
    drawstr(atxy(i, 4 + i), " *Gameduino* ");
  }
}
Exemplo n.º 10
0
void
cell_draw(cell* cell)
{
    glColor3ub(0, 255, 128);
    if (selection == cell->id) {
        glColor3ub(255, 255, 0);
        drawstr(10, 240, cell->info);
        glColor3ub(255, 0, 0);
    }
    
    drawstr(cell->x, cell->y, cell->format, cell->value);
}
Exemplo n.º 11
0
void
main_display(void)
{
    glClearColor(0.8, 0.8, 0.8, 0.0);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glColor3ub(0, 0, 0);
    setfont("helvetica", 12);
    drawstr(GAP, GAP-5, "World-space view");
    drawstr(GAP+sub_width+GAP, GAP-5, "Screen-space view");
    drawstr(GAP, GAP+sub_height+GAP-5, "Command manipulation window");
    glutSwapBuffers();
}
Exemplo n.º 12
0
void helper()
{
	BEGIN_2D_OVERLAY (ww, wh);
	setfont("9x15", 80);
	
	drawstr(10, 10, "o/O = Show origin.");
	drawstr(10, 30, "r/R = Reset camera position.");
	drawstr(10, 50, "+/- = Change the color in positive/negative halves.");
	drawstr(10, 70, "x/X = Coordinate selection (X or Y).");
	drawstr(10, 90, "c/C = Change the model.");

	END_2D_OVERLAY();
}
Exemplo n.º 13
0
void fail(char *msg){
  u8 i=0;
  
  LED_RED=LOW;
  SSN = LOW;
  erasescreen();
  drawstr(1,2,"FATAL ERROR:");
  drawstr(2,2,msg);
  SSN = HIGH;
  for(i=0;i<5;i++)
    sleepMillis(1000);
  //reset();
}
Exemplo n.º 14
0
Arquivo: ui.c Projeto: notadecent/uTox
static void drawadd_content(int x, int y, int width, int height)
{
    setcolor(C_TITLE);
    setfont(FONT_TEXT);
    drawstr(LIST_RIGHT + SCALE * 5, y + SCALE * 5, "Tox ID");

    drawstr(LIST_RIGHT + SCALE * 5, y + SCALE * 29, "Message");

    if(addfriend_status) {
        setfont(FONT_MISC);
        setcolor(C_RED);
        drawtext(LIST_RIGHT + SCALE * 5, y + SCALE * 83, addstatus[addfriend_status - 1].str, addstatus[addfriend_status - 1].length);
    }
}
Exemplo n.º 15
0
void
world_display(void)
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    
    glColor3ub(255, 255, 255);
    setfont("helvetica", 18);
    
    if (mode == GL_LINEAR) {
        drawstr(100, 80, "end - z");
        drawstr(30, 95, "f   = ");
        drawstr(90, 110, "end - start");
        glBegin(GL_LINE_STRIP);
        glVertex2i(85, 90);
        glVertex2i(185, 90);
        glEnd();
    } else {
        drawstr(90, 80, "- (density * z)");
        drawstr(30, 95, "f   =   e");
        if (mode == GL_EXP2)
            drawstr(208, 68, "2");
    }
    
    setfont("helvetica", 12);
    drawstr(20, 180, "z is the distance in eye coordinates");
    drawstr(20, 195, "from origin to fragment being fogged.");
    
    glutSwapBuffers();
}
Exemplo n.º 16
0
static void hint(void)
{
	BEGIN_2D_OVERLAY (gw, gh);
	
	glPushAttrib (GL_ENABLE_BIT);
	glDisable (GL_LIGHTING);
	glColor3f (0.88, 0.02, 0.89);
	setfont ("9x15",0);
	drawstr (10,gh-20, "r : switch raytrace");
	drawstr (10,gh-40, "t : show the trace");
	drawstr (10,gh-80, "Press '1' or '2' to change mode ");
	drawstr (10,gh-100, "a : AUTO ON/OFF    MODE %d", mode);
	if( _auto ) 
	{
		drawstr (10,gh-60, "+ : SPEED++ / - : SPEED--");
		glColor3f (1, 0.02, 0.02); 
		drawstr (10, gh-120, "AUTO : ON / SPEED = %.3f", omega);
	}
	else
	{
		drawstr (10,gh-60, "+ : clockwise  - : counter clockwise");
		glColor3f (.5, 0.5, 0.5); 
		drawstr (10, gh-120, "AUTO : OFF");
	}
	glPopAttrib();

	END_2D_OVERLAY();
}
Exemplo n.º 17
0
Arquivo: ui.c Projeto: draziw-/uTox
/* Draw add a friend window */
static void drawadd(int UNUSED(x), int UNUSED(y), int UNUSED(w), int height)
{
    setcolor(C_TITLE);
    setfont(FONT_SELF_NAME);
    drawstr(LIST_RIGHT + SCALE * 5, SCALE * 10, ADDFRIENDS);

    setcolor(C_TITLE);
    setfont(FONT_TEXT);
    drawstr(LIST_RIGHT + SCALE * 5, LIST_Y + SCALE * 5, TOXID);

    drawstr(LIST_RIGHT + SCALE * 5, LIST_Y + SCALE * 29, MESSAGE);

    if(addfriend_status) {
        setfont(FONT_MISC);
        setcolor(C_RED);

        STRING *str;
        switch(addfriend_status) {
        case ADDF_SENT:
            str = SPTR(REQ_SENT); break;
        case ADDF_DISCOVER:
            str = SPTR(REQ_RESOLVE); break;
        case ADDF_BADNAME:
            str = SPTR(REQ_INVALID_ID); break;
        case ADDF_NONAME:
            str = SPTR(REQ_EMPTY_ID); break;
        case ADDF_TOOLONG: //if message length is too long.
            str = SPTR(REQ_LONG_MSG); break;
        case ADDF_NOMESSAGE: //if no message (message length must be >= 1 byte).
            str = SPTR(REQ_NO_MSG); break;
        case ADDF_OWNKEY: //if user's own key.
            str = SPTR(REQ_SELF_ID); break;
        case ADDF_ALREADYSENT: //if friend request already sent or already a friend.
            str = SPTR(REQ_ALREADY_FRIENDS); break;
        case ADDF_BADCHECKSUM: //if bad checksum in address.
            str = SPTR(REQ_BAD_CHECKSUM); break;
        case ADDF_SETNEWNOSPAM: //if the friend was already there but the nospam was different.
            str = SPTR(REQ_BAD_NOSPAM); break;
        case ADDF_NOMEM: //if increasing the friend list size fails.
            str = SPTR(REQ_NO_MEMORY); break;
        case ADDF_UNKNOWN: //for unknown error.
        case ADDF_NONE: //this case must never be rendered, but if it does, assume it's an error
        default:
            str = SPTR(REQ_UNKNOWN); break;
        }

        drawtextmultiline(LIST_RIGHT + SCALE * 5, utox_window_width - BM_SBUTTON_WIDTH - 5 * SCALE, LIST_Y + SCALE * 83, 0, height, font_small_lineheight, str->str, str->length, 0xFFFF, 0, 1);
    }
}
Exemplo n.º 18
0
void
cell_draw(cell* cell)
{
    glColor3ub(0, 255, 128);
    if (selection == cell->id) {
        glColor3ub(255, 255, 0);
        drawstr(10, 525, cell->info);
        glColor3ub(255, 0, 0);
    }

    if (cell->id == 21 && cell->value > 90.0) /* treat cutoff specially */
        drawstr(cell->x, cell->y, cell->format, 180.0);
    else
        drawstr(cell->x, cell->y, cell->format, cell->value);
}
Exemplo n.º 19
0
Arquivo: ui.c Projeto: notadecent/uTox
static void drawsettings_content(int x, int y, int w, int height)
{
    setcolor(C_TITLE);
    setfont(FONT_TEXT);
    drawstr(LIST_RIGHT + SCALE * 5, y + SCALE * 5, "Name");

    drawstr(LIST_RIGHT + SCALE * 5, y + SCALE * 29, "Status Message");

    drawtextrange(LIST_RIGHT + SCALE * 5, width - SCALE * 5, y + SCALE * 64, self.id, sizeof(self.id));

    setfont(FONT_SELF_NAME);

    drawstr(LIST_RIGHT + SCALE * 5, y + SCALE * 54, "Tox ID");

}
Exemplo n.º 20
0
static void remake_tree(int win, double order, double rt, double ra,
			double rnd, int bgcolor_r, int bgcolor_g,
			int bgcolor_b)
{
  Cdbl z2 = 0 + 0.9 * L / (1 - pow(rt, order + 1)) * I;
  Cdbl z1 = 0;
  int i;
  /* 背景色専用レイヤ */
  layer(win, 0, 2);
  for (i = 0; i < L; i++) {
    newrgbcolor(win, bgcolor_r + 128.0 * i / L,
		bgcolor_g + 128.0 * i / L, bgcolor_b + 128.0 * i / L);
    drawline(win, -L / 2, i, L / 2 - 1, i);
  }
  /* treeのマスク専用レイヤ */
  layer(win, 0, 4);
  gsetbgcolor(win, "#ffffff");
  gclr(win);
  newcolor(win, "#000000");
  btree(win, z1, z2, order, rt, ra, rnd);
  /* treeの専用レイヤ */
  layer(win, 0, 3);
  gsetbgcolor(win, "#003300");
  gclr(win);
  newgcfunction(win, GXandInverted);
  gputarea(win, -L / 2, 0, win, 4, -L / 2, 0, L / 2 - 1, L - 1);
  newgcfunction(win, GXcopy);
  newcolor(win, "white");
  drawstr(win, L / 2 - 180, 4, 14, 0, "Background Color: "
	  "#%02x%02x%02x", bgcolor_r, bgcolor_g, bgcolor_b);
}
Exemplo n.º 21
0
Arquivo: bar.c Projeto: jjehanne/SR02
void *b_fonc (void * arg) {

	int is, numero, i,j, m1;

	numero = (int)arg;

	m1 = 20;

	i = m1;

	printf("numero= %d, i=%d \n",numero,i);

	drawstr (30, 125, "_0_", 3);

	drawrec (100,100,100+m1*10,30);

	for (j=1;j<=m1;j++) {

		printf("num %d j=%d\n",numero,j);
		fillrec (100,102,100+j*10,26,"yellow");
		usleep(70000);
		
	}

	flushdis ();

	return ( (void *)(numero+100) );
}
Exemplo n.º 22
0
static const char *draw_text_left(char *line, rect r, int line_height,
				  int underline, const char *s)
{
    char *k;
    point p;
    int width, height;
    font f;

    f = current->fnt;

    for(p=pt(r.x,r.y); (p.y<=r.y+r.height) && (s); p.y+=line_height)
    {
	s = get_next_line(line, r.width, s);

	for (k=line; *k!='\0'; k++)
	    continue;
	for (--k; (k>=line) && isspace(*k); k--)
	    *k = '\0';

	drawstr(p, line);

	if (underline) {
	    width = strwidth(f, line);
	    height = p.y+getheight(f)-getdescent(f)+2;
	    drawline(pt(p.x+1, height), pt(p.x+width-1, height));
	}
    }

    return s;
}
Exemplo n.º 23
0
int main()
{
    int win ;
    time_t time_now ;
    char d0[8],d1[8],d2[8],d3[8], t0[16] ;

    /* open a graphic window */
    win = gopen(FONTSIZE*24/2+4,FONTSIZE+4) ;
    /* set name of window */
    winname(win,"Simple Clock") ;
    /* configure layer */
    layer(win,0,1) ;
    /* display time... */
    while(1){
        time(&time_now) ;
        sscanf(ctime(&time_now),"%s %s %s %s %s",d0,d1,d2,t0,d3) ;
	gclr(win) ;
	drawstr(win,2,2,FONTSIZE,0,"%s %s %s %s %s",d0,d1,d2,t0,d3) ;
	copylayer(win,1,0) ;
	msleep(200) ;
    }
    /* close a graphic window */
    gclose(win) ;

    return(0) ;
}
Exemplo n.º 24
0
void content()
{
	glClear (GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);
	grid();

	glPushMatrix();
	glTranslated (point[0], point[1],point[2]);
	glRotatef (angle, 0,1,0);

	glTranslatef (0,1,0);
	glScalef (2/scale, 2/scale, 2/scale);
	glTranslatef (-center[0],-center[1],-center[2]);
	loopover = MD2MInterpolate (yoshi);
	glPopMatrix();


	// teapots
	for (int i = 0; i < nteapots; i++) {
		teapots[i].show();
	}

	BEGIN_2D_OVERLAY (10,10);
	glDisable (GL_TEXTURE_2D);
	glColor3f (1,1,0);
	char display[20];
	sprintf (display, "Score: %d", total_score);
	drawstr (1,1, display);
	END_2D_OVERLAY();

	glutSwapBuffers();
}
Exemplo n.º 25
0
/* initialize the IO subsystems for the appropriate dongles */
static void io_init(void)
{
#ifdef IMME
    
 #ifdef IMMEDONGLE   // CC1110 on IMME pink dongle
    // IM-ME Dongle.  It's a CC1110, so no USB stuffs.  Still, a bit of stuff to init for talking 
    // to it's own Cypress USB chip
    P0SEL |= (BIT5 | BIT3);     // Select SCK and MOSI as SPI
    P0DIR |= BIT4 | BIT6;       // SSEL and LED as output
    P0 &= ~(BIT4 | BIT2);       // Drive SSEL and MISO low

    P1IF = 0;                   // clear P1 interrupt flag
    IEN2 |= IEN2_P1IE;          // enable P1 interrupt
    P1IEN |= BIT1;              // enable interrupt for P1.1

    P1DIR |= BIT0;              // P1.0 as output, attention line to cypress
    P1 &= ~BIT0;                // not ready to receive
 #else              // full blown IMME with screen and keyboard
    
    //Disable WDT
    IEN2&=~IEN2_WDTIE;
    IEN0&=~EA;
	setIOPorts();
	configureSPI();
	LCDReset();
  
    //Startup display.
    setDisplayStart(0);
    SSN = LOW;
    setNormalReverse(0);
    erasescreen();
    drawstr(0,0, "IMME SNIFF v0.1");
    SSN = HIGH;

    //immeLCDInitScreen();
    //sleepMillis(100);
  
 #endif 
#else       // CC1111
 #ifdef DONSDONGLES
    // CC1111 USB Dongle
    // turn on LED and BUTTON
    P1DIR |= 3;
    // Activate BUTTON - Do we need this?
    //CC1111EM_BUTTON = 1;

 #else
    // CC1111 USB (ala Chronos watch dongle), we just need LED
    P1DIR |= 3;

 #endif      // CC1111

 #ifndef VIRTUAL_COM
    // Turn off LED
    LED = 0;
 #endif

#endif // conditional
}
Exemplo n.º 26
0
void timecount(void){//タイムの表記
  if(count % 10 == 0){
    p++;
  }
  sprintf(k, "%d", p);
  newpen(win, 1);
  drawstr(win, 6, 468, 18, 0.0, k);
}
Exemplo n.º 27
0
void overlay()
{	
	glUseProgram(0);
	glPushAttrib(GL_ENABLE_BIT);
	glDisable(GL_LIGHTING);
	glDisable(GL_TEXTURE_2D);
	BEGIN_2D_OVERLAY (gw, gh);
	
	if(USE_GREY_FILTER) {
		glColor3f(1, 0, 0);
		drawstr(10, gh - 20, "GREY_FILTER = ON");
	}
	else {
		glColor3f(1, 1, 0);
		drawstr(10, gh - 20, "GREY_FILTER = OFF");
	}

	if(USE_MOSAIC_FILTER) {
		glColor3f(1, 0, 0);
		drawstr(10, gh - 50, "MOSAIC_FILTER = ON");
	}
	else {
		glColor3f(1, 1, 0);
		drawstr(10, gh - 50, "MOSAIC_FILTER = OFF");
	}

	glColor3f(1, 1, 0);
	drawstr(10, 10, "Press c/C to enable/disable program to use grey filter.");
	drawstr(10, 40, "Press m/M to enable/disable program to use mosaic filter.");
	drawstr(10, 70, "Press Space to enable/disable AL to animate.");
	END_2D_OVERLAY();
	glPopAttrib();
}
Exemplo n.º 28
0
void info()
{
	glPushAttrib(GL_ENABLE_BIT);
	glDisable(GL_TEXTURE_2D);
	glDisable(GL_LIGHTING);

	BEGIN_2D_OVERLAY (gw, gh);
	glColor3f(0, 1, 0);
	drawstr(10, 10, "Press b/B to use or not to use bump mapping.");
	if (NOBUMP) 
		drawstr(10, 40, "NO BUMP");
	else {
		glColor3f(0.5, 0, 0);
		drawstr(10, 40, "BUMP");
	}
	END_2D_OVERLAY();
	glPopAttrib();
}
Exemplo n.º 29
0
void drawGameText() {
  glColor3f(1.0,1.0,1.0);
  drawstr((rightbound - leftbound) * 1.0/4.0, 5.0, 0.05, "SCORE %d",   score);
  drawstr((rightbound - leftbound) * 2.0/4.0, 5.0, 0.05, "LEVEL %d",   level.speed+1);
  drawstr((rightbound - leftbound) * 3.0/4.0, 5.0, 0.05, "LIVES x %d", lives);

  if (paused | gameover) {
    COORDINATE vertcenter = lowerbound/2;
    COORDINATE horzcenter = rightbound/2;

    glColor3f(0,0,0);
    glRectf(horzcenter-30, vertcenter-5, horzcenter+30, vertcenter+5);
    glColor3f(1,1,1);
    if (paused)
      drawstr(horzcenter-10, vertcenter+1, 0.05, "PAUSE");
    else if (gameover)
      drawstr(horzcenter-20, vertcenter+1, 0.05, "GAME OVER");
  }
}
Exemplo n.º 30
0
int gprintf(const char *fmt, ...)
{
    static point p = {0,0};
    int count;
    int line_height;
    char *s, *t;
    va_list argptr;
    char str[256];

    va_start(argptr, fmt);
    count = vsprintf(str, fmt, argptr);

    initapp(0,0);
    if (! current->fnt)
	current->fnt = SystemFont;
    line_height = getheight(current->fnt);

    for (s=t=str; *s!='\0'; t++) {
	if (current->p.y != p.y) {
	    /* typewriter ping! */
	    p = current->p;
	}
	if (*t == '\n') {
	    /* print everything from s to t and move point down */
	    *t = '\0';
	    drawstr(p, s);
	    current->p.y += line_height;
	    /* go past the substring just printed */
	    s = t+1;
	}
	else if (*t == '\0') {
	    /* print final string without newline */
	    p.x += drawstr(p, s);
	    /* go to end of string, signal termination */
	    s = t;
	}
    }

    va_end(argptr);

    return count;
}