4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 class TestWindow : public BC_Window
29 TestWindow() : BC_Window("test", 0, 0, 640, 480) {}
34 struct timeval start_time;
35 struct timeval last_time;
41 static void init_status(status_t *status)
43 gettimeofday(&status->start_time, 0);
44 gettimeofday(&status->last_time, 0);
48 static void update_status(status_t *status)
50 struct timeval new_time;
51 gettimeofday(&new_time, 0);
52 if(new_time.tv_sec - status->last_time.tv_sec > 1)
54 fprintf(stderr, "%lld frames. %lld frames/sec \r",
56 (int64_t)status->frames /
57 (int64_t)(new_time.tv_sec - status->start_time.tv_sec));
59 status->last_time = new_time;
63 static void stop_status()
65 fprintf(stderr, "\n\n");
70 int main(int argc, char *argv[])
75 // int result = window.accel_available(BC_YUV422);
76 // printf("accel_available == %d\n", result);
78 BC_Bitmap *bitmap1 = window.new_bitmap(640, 480, BC_BGR8888);
83 window.draw_bitmap(bitmap1, 1);
85 update_status(&status);