void game_screen() { alt_up_char_buffer_clear(char_buffer); char str1[50], str2[30], str3[50]; sprintf(str1, "Player 1: $%d", dealer->players[0].total_money); alt_up_char_buffer_string(char_buffer, str1, 5, 5); sprintf(str1, "Player 2: $%d", dealer->players[1].total_money); alt_up_char_buffer_string(char_buffer, str1, 5, 10); Bitmap* flop_card0_bmp = load_bitmap(card_bitmap_name(dealer->cards_on_table[0])); Bitmap* flop_card1_bmp = load_bitmap(card_bitmap_name(dealer->cards_on_table[1])); Bitmap* flop_card2_bmp = load_bitmap(card_bitmap_name(dealer->cards_on_table[2])); Bitmap* turn_card_bmp = load_bitmap(card_bitmap_name(dealer->cards_on_table[3])); Bitmap* river_card_bmp = load_bitmap(card_bitmap_name(dealer->cards_on_table[4])); draw_bitmap(flop_card0_bmp, 25, 60); draw_bitmap(flop_card1_bmp, 55, 60); draw_bitmap(flop_card2_bmp, 85, 60); draw_bitmap(turn_card_bmp, 115, 60); draw_bitmap(river_card_bmp, 145, 60); sprintf(str3, "Pot: $%d", dealer->pot); alt_up_char_buffer_string(char_buffer, str3, 5, 50); sprintf(str3, "Current Bet: $%d", dealer->current_bet); alt_up_char_buffer_string(char_buffer, str3, 5, 51); draw_to_screen(); }
int render_test() { init_screen(-2, -2, 2, 2, 500, 500); float theta = M_PI / 3; struct timeval start, end; long mtime, secs, usecs; int i = 0; matrix edge = init_identity(4); eye.x = 0; eye.y = 5; eye.z = 10; draw_box(1, 1, 1, 1, 0, 0, &edge); //draw_sphere(-1, 0, 0, 1, &edge); SDL_Color s; s.r = 0; s.g = 0; s.b = 255; float total_frames = 0; gettimeofday(&start, NULL); while( i < 300 ) { //theta = theta + M_PI / 30; matrix transformer = init_identity( 4 ); //multiply_matrix_onto_self(rotation_matrix_x(theta), &transformer); //multiply_matrix_onto_self(rotation_matrix_z(theta), &transformer); //multiply_matrix_onto_self(rotation_matrix_y(theta), &transformer); double s[3]; s[0] =.4; s[1] =.4; s[2] =.4; multiply_matrix_onto_self(scale_matrix(s), &transformer); matrix to_render = multiply_matrix(transformer, *m); draw_to_screen(eye.x, eye.y, eye.z, &to_render, *(Uint32 *)&s); eye.x += .01; eye.y += .01; //printf("y: %f\n", eye.y); //eye.y -= .01; //printf("Or %f seconds\n", l); total_frames++; //printf("Frames per sec: %f\n", l); //1 / framerate = 1000 * millseconds //ez = ez + 1;*/ i++; } gettimeofday(&end, NULL); secs = end.tv_sec - start.tv_sec; usecs = end.tv_usec - start.tv_usec; mtime = ((secs) * 1000 + usecs/1000.0) + 0.5; //printf("Elapsed time: %ld millisecs\n", mtime); double l = (double) mtime / 1000; printf("Total frames: %f\n", total_frames); printf("Total time: %f\n", l); printf("Average fps: %f\n", total_frames / l); return 0; }
void screen_overview(ESContext *esContext) { #ifndef SDLGL ESMatrix modelview; UserData *userData = esContext->userData; #endif char tmp_str[1024]; uint8_t n = 0; #ifndef SDLGL esMatrixLoadIdentity(&modelview); esMatrixMultiply(&userData->mvpMatrix, &modelview, &userData->perspective); #endif reset_buttons(); int x = 0; int y = 0; for (n = 0; n < VIEW_MODE_LAST; n++) { if (x >= 4) { x = 0; y += 1; } #ifndef WINDOWS #ifndef ANDROID draw_to_buffer(); if (n == VIEW_MODE_HUD) { screen_hud(esContext); } else if (n == VIEW_MODE_TELEMETRY) { screen_telemetry(esContext); } else if (n == VIEW_MODE_MODEL) { screen_model(esContext); } else if (n == VIEW_MODE_RCFLOW) { screen_rcflow(esContext); } else if (n == VIEW_MODE_FMS) { screen_fms(esContext); } else if (n == VIEW_MODE_WPEDIT) { screen_wpedit(esContext); } else if (n == VIEW_MODE_MAP) { screen_map(esContext, lat, lon, zoom); } else if (n == VIEW_MODE_SYSTEM) { screen_system(esContext); #ifndef ANDROID } else if (n == VIEW_MODE_VIDEOLIST) { screen_videolist(esContext); #ifdef USE_TCL } else if (n == VIEW_MODE_TCL) { screen_tcl(esContext); #endif #endif } else if (n == VIEW_MODE_TRACKER) { screen_tracker(esContext); } else if (n == VIEW_MODE_FCMENU) { if (ModelData[ModelActive].teletype == TELETYPE_MULTIWII_21) { screen_mwi_menu(esContext); } else if (ModelData[ModelActive].teletype == TELETYPE_BASEFLIGHT) { screen_mwi_menu(esContext); } else if (ModelData[ModelActive].teletype == TELETYPE_GPS_NMEA) { screen_graph(esContext); } else if (ModelData[ModelActive].teletype == TELETYPE_OPENPILOT) { screen_openpilot(esContext); } else { screen_mavlink_menu(esContext); } } draw_to_screen(); draw_buffer_to_screen(-1.422 + x * 0.71, -0.99 + y * 0.66, -1.422 + x * 0.71 + 0.71, -0.99 + y * 0.66 + 0.66, 0.002, 1.0); sprintf(tmp_str, "%s", view_names[n]); if (setup.view_mode == n) { draw_text_button(esContext, tmp_str, setup.view_mode, tmp_str, FONT_GREEN, -1.422 + 0.35 + x * 0.71, -0.99 + y * 0.66, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, overview_set, (float)n); } else { draw_text_button(esContext, tmp_str, setup.view_mode, tmp_str, FONT_WHITE, -1.422 + 0.35 + x * 0.71, -0.99 + y * 0.66, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, overview_set, (float)n); } #else sprintf(tmp_str, "%s", view_names[n]); draw_text_button(esContext, tmp_str, setup.view_mode, tmp_str, FONT_WHITE, -1.422 + 0.35 + x * 0.71, -0.99 + y * 0.66 + 0.3, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, overview_set, (float)n); #endif #else sprintf(tmp_str, "%s", view_names[n]); draw_text_button(esContext, tmp_str, setup.view_mode, tmp_str, FONT_WHITE, -1.422 + 0.35 + x * 0.71, -0.99 + y * 0.66 + 0.3, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, overview_set, (float)n); #endif reset_buttons(); x++; } x = 0; y = 0; for (n = 0; n < VIEW_MODE_LAST; n++) { if (x >= 4) { x = 0; y += 1; } // draw_rect_f3(esContext, -1.3 + x * 0.5, -0.8 + y * 0.4, 0.002, -1.3 + x * 0.5 + 0.5, -0.8 + y * 0.4 + 0.4, 0.002, 255, 255, 255, 255); // set_button(view_names[n], setup.view_mode, -1.3 + x * 0.5, -0.8 + y * 0.4, -1.3 + x * 0.5 + 0.5, -0.8 + y * 0.4 + 0.4, overview_set, (float)n, 0); draw_rect_f3(esContext, -1.422 + x * 0.71, -0.99 + y * 0.66, 0.002, -1.422 + x * 0.71 + 0.71, -0.99 + y * 0.66 + 0.66, 0.002, 255, 255, 255, 255); set_button(view_names[n], setup.view_mode, -1.422 + x * 0.71, -0.99 + y * 0.66, -1.422 + x * 0.71 + 0.71, -0.99 + y * 0.66 + 0.66, overview_set, (float)n, 0); x++; } draw_text_button(esContext, "Options", setup.view_mode, "Options", FONT_PINK, 1.05, 0.55 + -2 * 0.1, 0.002, 0.08, ALIGN_CENTER, ALIGN_TOP, overview_set, (float)0); n = 0; if (setup.speak == 1) { draw_text_button(esContext, "SPEAK", setup.view_mode, "SPEAK", FONT_GREEN, 1.05, 0.45 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0); } else { draw_text_button(esContext, "SPEAK", setup.view_mode, "SPEAK", FONT_WHITE, 1.05, 0.45 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0); } if (logmode == 1) { draw_text_button(esContext, "LOGGING", setup.view_mode, "LOGGING", FONT_GREEN, 1.05, 0.45 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0); } else { draw_text_button(esContext, "LOGGING", setup.view_mode, "LOGGING", FONT_WHITE, 1.05, 0.45 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0); } #ifndef OSX if (logplay == 1) { draw_text_button(esContext, "LOGPLAYER", setup.view_mode, "LOGPLAYER", FONT_GREEN, 1.05, 0.45 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0); } else { draw_text_button(esContext, "LOGPLAYER", setup.view_mode, "LOGPLAYER", FONT_WHITE, 1.05, 0.45 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0); } #endif if (clientmode != 1 && setup.webport != 0) { if (webserv_is_running() == 1) { draw_text_button(esContext, "WEBSERV", setup.view_mode, "stop Webserver", FONT_GREEN, 1.05, 0.45 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0); } else { draw_text_button(esContext, "WEBSERV", setup.view_mode, "start Webserver", FONT_WHITE, 1.05, 0.45 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0); } } draw_text_button(esContext, "EXIT", setup.view_mode, "EXIT", FONT_GREEN, 1.05, 0.45 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0); }