这篇教程C++ textout_ex函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中textout_ex函数的典型用法代码示例。如果您正苦于以下问题:C++ textout_ex函数的具体用法?C++ textout_ex怎么用?C++ textout_ex使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了textout_ex函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: mainvoid main(){ char radius[50]; srand(time(NULL)); allegro_init(); install_keyboard(); set_color_depth(32); set_gfx_mode( GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0); line(screen, 320 , 0, 320, 480, makecol(255,255,0 )); line(screen, 0 , 240, 640, 240, makecol(255,255,0 )); circle (screen, 320,240,300, makecol(0,0,255)); circle (screen, 320,240,200, makecol(0,0,255)); circle (screen, 320,240,100, makecol(0,0,255)); textout_ex(screen, font, "Probabilistic Machine by Tuyama",50,10, makecol(255,0,0), -1); while( !key[KEY_ESC]){ moveCircle(); raddius = sqrt((double)((x-320)*(x-320)+(y-240)*(y-240))); textout_ex(screen, font, "radius: ", 30, 30, makecol(255,0,0), -1); if (t%100==0) { rectfill(screen, 90, 25, 150, 40, makecol(0, 0, 0)); textout_ex(screen, font, itoa(raddius, radius, 10), 100, 30, makecol(255,0,0), -1); } t+=1; } }
开发者ID:ftuyama,项目名称:RPG-Game,代码行数:30,
示例2: declare_winnervoid declare_winner(){ if(count1==5) { textout_ex( screen, font, "Player 1 Wins!", 280, 150, makecol( 255, 0, 0), makecol( 0, 0, 0)); rest(2000); count1=0; count2=0; ball_x=320; ball_y=240; p1_x = 20; p1_y = 210; p2_x = 620; p2_y = 210; } else if(count2==5) { textout_ex( screen, font, "Player 2 Wins!", 280, 150, makecol( 255, 0, 0), makecol( 0, 0, 0)); rest(2000); count1=0; count2=0; ball_x=320; ball_y=240; p1_x = 20; p1_y = 210; p2_x = 620; p2_y = 210; }}
开发者ID:sanchit234,项目名称:GamePack,代码行数:29,
示例3: muestra_mensajevoid muestra_mensaje (const TipoMensaje msg) { printf("Muestro el mensaje -> %s/n",msg); textout_ex( screen, font, " ", 500,550 , makecol( 255, 0, 0), makecol(0, 0, 0)); textout_ex( screen, font, msg, 500,550 , makecol( 255, 255, 0), makecol(0, 0, 0));}
开发者ID:jacedo,项目名称:logo,代码行数:7,
示例4: draw_menuvoid draw_menu(BITMAP *scrbuffer, DATAFILE *main_data, struct menuinfo menu, int row, int col){// function paints a given menu onto the given bitmap char count; color_map = &trans_table;//clear(scrbuffer); blit(main_data[TITLE_PAGE].dat, scrbuffer, 0, 0, 0, 0, SCREEN_W, SCREEN_H);//draw_trans_sprite(scrbuffer, main_data[TITLE_PAGE].dat, 0, 0); if (menu.fontsize == 2) { for (count = 0; count <= menu.num_of_options-1; count++) textout_ex(scrbuffer, main_data[FONTSMALL].dat, menu.option[count], col, row+count*32, GREY+15, -1); // draw a highlight/cursor draw_sprite(scrbuffer, main_data[CURSOR].dat, col-32, row+menu.highlight*32+4); } else if (menu.fontsize == 1) { for (count = 0; count <= menu.num_of_options-1; count++) textout_ex(scrbuffer, font, menu.option[count], col, row+count*16, GREY+15, -1); // draw a highlight/cursor draw_sprite(scrbuffer, main_data[CURSOR].dat, col-32, row+menu.highlight*16); }}
开发者ID:puyo,项目名称:dogfight,代码行数:29,
示例5: dialog_textoutstatic void dialog_textout(char *string, int x, int y, int color){ textout_ex(screen,fnt_andrus_4,string,x+1, y,makecol(0,0,0),-1); textout_ex(screen,fnt_andrus_4,string,x, y+1,makecol(0,0,0),-1); textout_ex(screen,fnt_andrus_4,string,x+1, y+1,makecol(0,0,0),-1); textout_ex(screen,fnt_andrus_4,string,x, y,color,-1);}
开发者ID:wziard,项目名称:miner,代码行数:7,
示例6: playerdraw_thread//this thread updates sprite 0void* playerdraw_thread(void* data){ //get this thread id int my_thread_id = *((int*)data); //thread's main loop while(!GAMEOVER) { //lock the mutex to protect variables if (pthread_mutex_lock(&threadsafe)) textout_ex(buffer,font,"ERROR: thread mutex was locked",0,0,WHITE,0); if(SHOWHEALTH==true) { textprintf_ex(buffer,font,owl->x, owl->y-20,makecol(255,0,0),-1,"%d",owl->health); } //call the owl draw function owl->drawframe(buffer); //unlock the mutex if (pthread_mutex_unlock(&threadsafe)) textout_ex(buffer,font,"ERROR: thread mutex unlock error",0,0,WHITE,0); } // terminate the thread pthread_exit(NULL); return NULL;}
开发者ID:shawnclardonronaldneilscorliss,项目名称:Flightless,代码行数:32,
示例7: draw_palettevoid draw_palette() { int count = 0; //loop counts int count2 = 0; //[note: as relevant names as could be bothered to make] int count3 = 0; int count4 = 0; int columns = 15; //columns,rows, needed to output all colors in default palette int rows = 15; int startx = 10; //x,y position of color output on screen int starty = 10; int tempy = 10; int color = 0; //starting color to output int pixels = 20; //pixels^2 = size of each square acquire_screen(); for(count4 = 0; count4 <= rows; count4++){ //deals with each row of palette output for(count = 0; count <= columns; count++) { //deals with each column of pallete output starty = tempy; for(count3 = 0; count3 <= pixels; count3++) { //outputs pixels for each sqr row for (count2 = 0; count2 <= pixels; count2++) { //for pixels per sample (square) if (color < 256) { putpixel(screen, startx+count2, starty, color); } } starty++; } starty = tempy; //resets starty to correct row value color++; //increments current palette color startx+=pixels; //increments column, plus relevant no. pixels } startx = 10; //resets column start to ten pixels from left tempy+=pixels; //increments row, plus relevant no. pixels } /*Prints the relevant palette name below main output on screen.*/ if (p==0) { textout_ex(screen, font, "desktop palette", 10, 340, 8, -1); textout_ex(screen, font, "default palette", 10, 340, 13, -1); } else { if (p==1) { textout_ex(screen, font, "default palette", 10, 340, 8, -1); textout_ex(screen, font, "desktop palette", 10, 340, 3, -1); } } release_screen(); }
开发者ID:ross-spencer,项目名称:allegro-palette-viewer,代码行数:59,
示例8: showWinvoid showWin(){ if(x<=5) textout_ex( screen, font, "Player 2 Wins!", 160, 120, makecol( 255, 0, 0), makecol( 0, 255, 0)); if(x>=385) textout_ex( screen, font, "Player 1 Wins!", 160, 120, makecol( 255, 0, 0), makecol( 0, 255, 0)); dir = rand() % 4 + 1;}
开发者ID:jarmac0509,项目名称:ping-pong,代码行数:8,
示例9: render/* draw everything */void render(BITMAP *bmp){ char buf[80]; MATRIX_f roller, camera; int x, y, w, h; float xfront, yfront, zfront; float xup, yup, zup; /* clear the background */ clear(bmp); set_projection_viewport(0, 0, SCREEN_W, SCREEN_H); /* calculate the in-front vector */ xfront = sin(heading) * cos(pitch); yfront = sin(pitch); zfront = cos(heading) * cos(pitch); /* rotate the up vector around the in-front vector by the roll angle */ get_vector_rotation_matrix_f(&roller, xfront, yfront, zfront, roll*128.0/M_PI); apply_matrix_f(&roller, 0, -1, 0, &xup, &yup, &zup); /* build the camera matrix */ get_camera_matrix_f(&camera, xpos, ypos, zpos, /* camera position */ xfront, yfront, zfront, /* in-front vector */ xup, yup, zup, /* up vector */ fov, /* field of view */ aspect); /* aspect ratio */ /* draw the grid of squares */ for (x=0; x<GRID_SIZE; x++) for (y=0; y<GRID_SIZE; y++) draw_square(bmp, &camera, x * TILE_SIZE, y * TILE_SIZE); /* overlay some text */ set_clip_rect(bmp, 0, 0, bmp->w, bmp->h); sprintf(buf, "Field of view: %d (f/F changes)", fov); textout_ex(bmp, font, buf, 0, 16, 255, -1); sprintf(buf, "Aspect ratio: %.2f (a/A changes)", aspect); textout_ex(bmp, font, buf, 0, 24, 255, -1); sprintf(buf, "X position: %.2f (x/X changes)", xpos); textout_ex(bmp, font, buf, 0, 32, 255, -1); sprintf(buf, "Y position: %.2f (y/Y changes)", ypos); textout_ex(bmp, font, buf, 0, 40, 255, -1); sprintf(buf, "Z position: %.2f (z/Z changes)", zpos); textout_ex(bmp, font, buf, 0, 48, 255, -1); sprintf(buf, "Heading: %.2f deg (left/right changes)", DEG(heading)); textout_ex(bmp, font, buf, 0, 56, 255, -1); sprintf(buf, "Pitch: %.2f deg (pgup/pgdn changes)", DEG(pitch)); textout_ex(bmp, font, buf, 0, 64, 255, -1); sprintf(buf, "Roll: %.2f deg (r/R changes)", DEG(roll)); textout_ex(bmp, font, buf, 0, 72, 255, -1); sprintf(buf, "Front vector: %.2f, %.2f, %.2f", xfront, yfront, zfront); textout_ex(bmp, font, buf, 0, 80, 255, -1); sprintf(buf, "Up vector: %.2f, %.2f, %.2f", xup, yup, zup); textout_ex(bmp, font, buf, 0, 88, 255, -1);}
开发者ID:puyo,项目名称:tankdemo,代码行数:59,
示例10: rectfillvoid Editor::draw(){ // Background rectfill(buffer, 0, 0, SCREEN_W, SCREEN_H, makecol(255,255,255)); if( saving){ //Create gui textprintf_centre_ex(buffer,font,640,310, makecol(0,0,0),-1,"Save Map Name"); //Input rectangle rectfill(buffer, 400, 408, 892, 452, makecol(0,0,0)); rectfill(buffer, 402, 410, 890, 450, makecol(255,255,255)); // Output the string to the screen textout_ex(buffer, font, edittext.c_str(), 410, 410, makecol(0,0,0), -1); // Draw the caret vline(buffer, text_length(font, edittext.c_str()) + 410 - text_length(font, ".txt") , 412, 448, makecol(0,0,0)); } else if( opening){ //Create gui textprintf_centre_ex(buffer,font,640,310, makecol(0,0,0),-1,"Open Map Name"); //Input rectangle rectfill(buffer, 400, 408, 892, 452, makecol(0,0,0)); rectfill(buffer, 402, 410, 890, 450, makecol(255,255,255)); // Output the string to the screen textout_ex(buffer, font, edittext.c_str(), 410, 410, makecol(0,0,0), -1); // Draw the caret vline(buffer, text_length(font, edittext.c_str()) + 410 - text_length(font, ".txt") , 412, 448, makecol(0,0,0)); } else{ // Draw tiles tile_map -> draw_map( buffer); exampleTile -> draw_tile( buffer, 0, 0, 0); // Map info textprintf_ex(buffer,font,0,80,makecol(255,255,255),makecol(0,0,0),"height-%i width-%i", tile_map -> height, tile_map -> width); if(layer == 1){ textprintf_ex(buffer,font,0,130,makecol(255,255,255),makecol(0,0,0),"Editing Mode: Foreground"); } else if(layer == 0){ textprintf_ex(buffer,font,0,130,makecol(255,255,255),makecol(0,0,0),"Editing Mode: Background"); } // Cursor circlefill(buffer, mouse_x , mouse_y , 10, makecol(0,0,0)); circlefill(buffer, mouse_x , mouse_y, 8, makecol(255,255,255)); } // Draw buffer stretch_sprite( screen, buffer, 0, 0, SCREEN_W, SCREEN_H);}
开发者ID:alegemaate,项目名称:TileEngine,代码行数:55,
示例11: checkWinvoid checkWin(){ if ( ball_x < p1_x){ textout_ex( screen, font, "Player 2 Wins!", 320, 240, makecol( 255, 0, 0), makecol( 0, 0, 0)); startNew(); } else if ( ball_x > p2_x){ textout_ex( screen, font, "Player 1 Wins!", 320, 240, makecol( 255, 0, 0), makecol( 0, 0, 0)); startNew(); } }
开发者ID:mirgee,项目名称:exercises,代码行数:11,
示例12: init_screen_mapvoid init_screen_map(screen_t* my_screen){ my_screen->map.x = 0; my_screen->map.y = 0; my_screen->map.w = MAP_W; my_screen->map.h = MAP_H; my_screen->map.background = create_bitmap(my_screen->map.w, my_screen->map.h); clear_to_color(my_screen->map.background, makecol(0,0,0)); textout_centre_ex(my_screen->map.background, font, "--- CAR RACE ----", 400, 200, makecol(204, 0 , 0), makecol(255, 255, 0)); textout_centre_ex(my_screen->map.background, font, "select your map and go!", 400, 208, makecol(204, 0 , 0), makecol(255, 255, 0)); textout_ex(my_screen->map.background, font, "City Map", 336, 250, makecol(255, 255, 255), makecol(204, 0 , 0)); textout_ex(my_screen->map.background, font, "Race Truck", 336, 258, makecol(255, 255, 255), -1);}
开发者ID:andrecap,项目名称:car-race,代码行数:12,
示例13: draw_textvoid draw_text(BITMAP *bmp, int x, int y, int color, const char *format, ...){ char buf[512]; va_list ap; va_start(ap, format); uvszprintf(buf, sizeof(buf), format, ap); va_end(ap); textout_ex(bmp, gamefont, buf, x, y+1, blend_color(color, makecol(0, 0, 0), 0.5), -1); textout_ex(bmp, gamefont, buf, x, y, color, -1);}
开发者ID:dacap,项目名称:defenderofnothing,代码行数:12,
示例14: draw_activation/* draw the identifier of the task activated */void draw_activation (int numTActive, int idT, int prio, bool verbose){ char str_prio[3]; char str_id[3]; int x; snprintf(str_id,3, "T%d", idT+1); snprintf(str_prio,3, "%d", prio); x = XMIN + ( (strlen("ACTIVATION SEQUENCE = ") + 1) * PIXEL_CHAR ) + ( 3 * numTActive ) * PIXEL_CHAR; pthread_mutex_lock(&mxa); textout_ex(screen, font, str_id, x, BASE1 + 10, FGC, 0); if (verbose) textout_ex(screen, font, str_prio, x, BASE1 + 20, FGC, 0); pthread_mutex_unlock(&mxa);}
开发者ID:glipari,项目名称:ptask,代码行数:15,
示例15: announceWinnervoid announceWinner() { //announces the winner if( turn == 1){ textout_ex( screen, font, "X Wins!!!!", 300, 240, makecol( 255, 0, 0), makecol( 0, 0, 0)); }else { textout_ex( screen, font, "Y Wins!!!!", 300, 240, makecol( 255, 0, 0), makecol( 0, 0, 0));}void checkWin(){ //checks for a winner }void drawXO(){ //draws in the X and O}void moveBox(){ //takes input}int main(){ //now we actually build it allegro_init(); install_keyboard(); set_color_depth(16); set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0); xSprite = load_bitmap("x.bmp", NULL); oSprite = load_bitmap("o.bmp", NULL); setupBoard(); while(!key[KEY_ESC]){ moveBox(); } destroy_bitmap(xSprite); destroy_bitmap(oSprite); return 0;}
开发者ID:zubairah,项目名称:Cpp-Tutorials,代码行数:49,
示例16: text// @TODO rename to draw_allegro?void c_wallet::draw (BITMAP *frame, int color, t_pos x, t_pos y) const { for (const auto ¤cy: m_currency) { std::string text(currency.first + " " + std::to_string(currency.second)); textout_ex(frame, font, text.c_str(), x, y, color, 255); y -= 10; }}
开发者ID:MichalTigu,项目名称:antinet,代码行数:8,
示例17: Avoid c_osi2_switch::draw_packet(c_drawtarget &drawtarget, c_layer &layer_any) { double draw_step = 1./static_cast<double>(g_max_anim_frame); const auto & gui = * drawtarget.m_gui; auto layer = dynamic_cast<c_layer_allegro &>(layer_any); BITMAP *frame = layer.m_frame; c_osi2_switch &tmp_osi2_switch = m_world.find_object_by_uuid_as_switch(m_draw_outbox.front().first); const int this_vx = gui.view_x(m_x), this_vy = gui.view_y(m_y); const int next_vx = gui.view_x(tmp_osi2_switch.m_x), next_vy = gui.view_y(tmp_osi2_switch.m_y); t_geo_point A(this_vx,this_vy); t_geo_point B(next_vx,next_vy); t_geo_point between = c_geometry::point_on_line_between_part(A,B,m_draw_outbox.front().second); //_dbg1("DEBUG<<<<: " << between.x << " " << between.y); //_dbg1("Layer_allegro nr: " << layer.m_layer_nr); draw_trans_sprite(frame, c_bitmaps::get_instance().m_package_green, between.x - c_bitmaps::get_instance().m_package_green->w / 2, between.y - c_bitmaps::get_instance().m_package_green->h / 2); std::string send_percent = std::to_string(static_cast<int>(100*m_draw_outbox.front().second)) + "%"; textout_ex(frame, font, send_percent.c_str(), between.x+15, between.y, makecol(0,15,25), -1); if(m_draw_outbox.front().second < 1. && !m_world.get_is_pause()) { m_draw_outbox.front().second += draw_step; } else { m_draw_outbox.pop(); }}
开发者ID:antinet,项目名称:antinet,代码行数:25,
|