コード例 #1
0
ファイル: ztcterm.c プロジェクト: Distrotech/ucblogo
void ztc_set_penc(FIXNUM c) {
    draw_turtle();
    pen_color = c;
    turtle_color = hw_color(c) % fg.nsimulcolor;
    if (current_write_mode == FG_MODE_XOR)
	turtle_color = hw_color(pen_color)^bg_color;
    msm_hidecursor();
    draw_turtle();
    msm_showcursor();
}
コード例 #2
0
ファイル: ztcterm.c プロジェクト: Distrotech/ucblogo
void ztc_set_bg(FIXNUM c) {
    back_ground = c;
    bg_color = hw_color(c);
    msm_hidecursor();
    if (!refresh_p) ibm_clear_screen();
    if (turtle_shown && !refresh_p) draw_turtle();
    redraw_graphics();
    msm_showcursor();
}
コード例 #3
0
ファイル: Player.cpp プロジェクト: alonsoguillenv/turtle
int Player::take_turn()
{
    srand(time(0)*rand());
    bool finished = false;
    while( !finished )
    {
        srand(time(0)*rand());
        fflush(stdin);
        std::cout << "\nEs el turno de " << name << ". Presione Enter para lanzar el dado." << std::endl;
        getchar();
        //std::cout << "\n----" << name << " ha ganado " << this->won_games << " juegos ----" ;
        int value = 0;
        value = 1 + rand()%6;
        std::cout << "\n" << name << " obtuvo " << value <<" con el dado";
        player_time += 1;

        if( value == player_turtle.body[player_turtle.index] && player_turtle.index < player_turtle.get_size() )
        {
            player_turtle.index += 1;
        }
        else
        {
            if( player_turtle.index >= player_turtle.get_size() )
            {
                won_games+= 1;
                finished = true;
            }
            else
            {
                finished = true;

            }
        }
        draw_turtle();
    }
    player_turns += 1;
    return player_turtle.index;
}
コード例 #4
0
ファイル: ztcterm.c プロジェクト: Distrotech/ucblogo
void gr_mode(void) {
    int errorcode;

    if (!in_graphics_mode) {
	msm_hidecursor();
	x_coord = x_margin;
	y_coord = y_margin;
	errorcode = fg_init();
	if (have_been_in_graphics_mode) {
	    in_graphics_mode = TRUE;
	    if (turtle_shown && !refresh_p) draw_turtle();
	    redraw_graphics();
	}
	else {
	    if (errorcode == 0)
		err_logo(BAD_GRAPH_INIT, NIL);
	    else {
		in_graphics_mode = have_been_in_graphics_mode = TRUE;
		if (can_do_color = (fg.nsimulcolor > 16 /* != fg.ncolormap */ )) {
			rgb_init();
			dull = fg.nsimulcolor-1;
			bright = 7;
		} else {
			turtle_color = FG_HIGHLIGHT;
			dull = FG_WHITE;
			bright = FG_HIGHLIGHT;
		}
		bg_color = FG_BLACK;
		ztc_set_penc(7);
		if (ztc_textcolor == FG_WHITE) ztc_textcolor = dull;
		back_ground = 0;
		ztc_box[FG_X1] = ztc_textbox[FG_X1]
			       = text_scroll_box[FG_X1]
			       = text_last_line_box[FG_X1]
			       = clear_box[FG_X1]
			       = fg.displaybox[FG_X1];
		ztc_textbox[FG_Y1] = fg.displaybox[FG_Y1];
		ztc_box[FG_X2] = ztc_textbox[FG_X2]
			       = text_scroll_box[FG_X2]
			       = text_last_line_box[FG_X2]
			       = clear_box[FG_X2]
			       = MaxX = fg.displaybox[FG_X2];
		ztc_box[FG_Y2] = MaxY
			       = clear_box[FG_Y2]
			       = fg.displaybox[FG_Y2];
		y_scale = (double)fg.pixelx/(double)fg.pixely;
		{
		    FILE *fp = fopen("scrunch.dat","r");
		    if (fp != NULL) {
		    	scrunching = TRUE;
			if (filelength(fileno(fp)) > 0) {
			    fread(&x_scale, sizeof(FLONUM), 1, fp);
			    fread(&y_scale, sizeof(FLONUM), 1, fp);
			}
			fclose(fp);
		    }
		}
		if (MaxY == 479)
		    texth = 16;
		else
		    texth = (MaxY+1)/25;
		ztc_box[FG_Y1] = 4*texth+1;
		clear_box[FG_Y1] = 4*texth;
		ibm_screen_bottom = MaxY - (ztc_box[FG_Y1]);
		ztc_textbox[FG_Y2] = 4*texth-1;
		text_scroll_box[FG_Y2] = 3*texth-1;
		text_scroll_box[FG_Y1] = 0;
		text_last_line_box[FG_Y2] = texth-1;
		lclearscreen(NIL);
		lcleartext(NIL);
		in_splitscreen = TRUE;
	   }
	}
	msm_showcursor();
    }
}
コード例 #5
0
ファイル: patch-graphics.c プロジェクト: Rod-O/pkgsrc
 NODE *lshowturtle(NODE *args) {
-    prepare_to_draw;
+    prepare_to_draw2(UNBOUND);
     if (!turtle_shown) {
 	turtle_shown = TRUE;
 	draw_turtle();
@@ -545,7 +545,7 @@ NODE *lshowturtle(NODE *args) {
 }
 
 NODE *lhideturtle(NODE *args) {
-    prepare_to_draw;
+    prepare_to_draw2(UNBOUND);
     if (turtle_shown) {
 	draw_turtle();
 	turtle_shown = FALSE;
@@ -874,7 +874,7 @@ NODE *llabel(NODE *arg) {
     *print_stringptr = '\0';
 	
     if (NOT_THROWING) {
-	prepare_to_draw;
+	prepare_to_draw2(UNBOUND);
 	draw_turtle();
 	theLength = strlen(textbuf);
 #ifdef mac
@@ -983,7 +983,7 @@ NODE *lsetpencolor(NODE *arg) {
     NODE *val = pos_int_arg(arg);
 
     if (NOT_THROWING) {
-	prepare_to_draw;
+	prepare_to_draw2(UNBOUND);
 	set_pen_color(getint(val));
 	save_color();
 	done_drawing;
@@ -995,7 +995,7 @@ NODE *lsetbackground(NODE *arg) {
     NODE *val = pos_int_arg(arg);
 
     if (NOT_THROWING) {
-	prepare_to_draw;
+	prepare_to_draw2(UNBOUND);
 	set_back_ground(getint(val));
 	done_drawing;
     }
@@ -1008,7 +1008,7 @@ NODE *lsetpalette(NODE *args) {
 	int slotnum = (int)getint(slot);
 
 	if (NOT_THROWING && (slotnum > 7)) {
-		prepare_to_draw;
+		prepare_to_draw2(UNBOUND);
 		set_palette(slotnum,
 			    (unsigned int)getint(car(arg)),
 			    (unsigned int)getint(cadr(arg)),
@@ -1057,7 +1057,7 @@ NODE *lsetpensize(NODE *args) {
     NODE *arg = pos_int_vector_arg(args);
 
     if (NOT_THROWING) {
-	prepare_to_draw;
+	prepare_to_draw2(UNBOUND);
 	set_pen_width((int)getint(car(arg)));
 	set_pen_height((int)getint(cadr(arg)));
 	save_size();
@@ -1074,7 +1074,7 @@ NODE *lsetpenpattern(NODE *args) {    
 	arg = err_logo(BAD_DATA, arg);
 	
     if (NOT_THROWING) {
-	prepare_to_draw;
+	prepare_to_draw2(UNBOUND);
 	set_list_pen_pattern(arg);
 	save_pattern();
 	done_drawing;
@@ -1090,7 +1090,7 @@ NODE *lsetscrunch(NODE *args) {
     ynode = numeric_arg(cdr(args));
 
     if (NOT_THROWING) {
-	prepare_to_draw;
+	prepare_to_draw2(UNBOUND);
 	draw_turtle();
 	x_scale = (nodetype(xnode) == FLOATT) ? getfloat(xnode) :
 			       (FLONUM)getint(xnode);
@@ -1227,7 +1227,7 @@ NODE *larc(NODE *arg) {
 	else
 	    radius = getfloat(val2);
 
-	prepare_to_draw;
+	prepare_to_draw2(UNBOUND);
 	draw_turtle();
 
 	/* save and force turtle state */
@@ -1582,7 +1582,7 @@ NODE *lloadpict(NODE *args) {
     lopenread(args);
 #endif
     if (NOT_THROWING) {
-	prepare_to_draw;
+	prepare_to_draw2(UNBOUND);
 	fp = (FILE *)file_list->n_obj;
 	restore_palette(fp);
 	fread(&record_index, sizeof(FIXNUM), 1, fp);