本文整理汇总了C++中ToggleButton::get_pushed方法的典型用法代码示例。如果您正苦于以下问题:C++ ToggleButton::get_pushed方法的具体用法?C++ ToggleButton::get_pushed怎么用?C++ ToggleButton::get_pushed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ToggleButton
的用法示例。
在下文中一共展示了ToggleButton::get_pushed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw_sample
void Prog::draw_sample()
{
const int i = source_list.get_cur_value();
const int j = dest_list.get_cur_value();
ALLEGRO_BITMAP *bitmap1;
ALLEGRO_BITMAP *bitmap2;
bool use_memory = use_memory_button.get_pushed();
bool enable_timing = enable_timing_button.get_pushed();
if (use_memory)
al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP);
else
al_set_new_bitmap_flags(ALLEGRO_VIDEO_BITMAP);
al_set_new_bitmap_format(formats[i].format);
bitmap1 = al_load_bitmap("data/allegro.pcx");
if (!bitmap1) {
printf("Could not load image, bitmap format = %d\n", formats[i].format);
}
al_set_new_bitmap_format(formats[j].format);
bitmap2 = al_create_bitmap(320, 200);
if (!bitmap2) {
printf("Could not create bitmap, format = %d\n", formats[j].format);
}
al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO);
if (bitmap1 && bitmap2) {
ALLEGRO_BITMAP *target = al_get_target_bitmap();
al_set_target_bitmap(bitmap2);
if (enable_timing) {
double t0, t1;
char str[256];
int frames = 0;
t0 = al_get_time();
printf("Timing...\n");
do {
al_draw_bitmap(bitmap1, 0, 0, 0);
frames++;
t1 = al_get_time();
} while (t1 - t0 < 0.25);
printf(" ...done.\n");
sprintf(str, "%.0f FPS", (double)frames / (t1 - t0));
time_label.set_text(str);
}
else {
al_draw_bitmap(bitmap1, 0, 0, 0);
time_label.set_text("");
}
al_set_target_bitmap(target);
al_draw_bitmap(bitmap2, 0, 0, 0);
}
else {
al_draw_line(0, 0, 320, 200, al_map_rgb_f(1, 0, 0), 0);
al_draw_line(0, 200, 320, 0, al_map_rgb_f(1, 0, 0), 0);
}
std::string s = get_format_name(bitmap1);
s += " -> ";
s += get_format_name(bitmap2);
true_formats.set_text(s);
al_destroy_bitmap(bitmap1);
al_destroy_bitmap(bitmap2);
}