Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

test2.C

Go to the documentation of this file.
00001 #include "guicast.h"
00002 #include "vframe.h"
00003 #include <sys/time.h>
00004 
00005 class TestWindow : public BC_Window
00006 {
00007 public:
00008         TestWindow() : BC_Window("test", 
00009                                 0,
00010                                 0,
00011                                 640, 
00012                                 480)
00013         {
00014         }
00015 };
00016 
00017 
00018 
00019 
00020 typedef struct
00021 {
00022         struct timeval start_time;
00023         struct timeval last_time;
00024         int64_t frames;
00025 } status_t;
00026 
00027 
00028 
00029 static void init_status(status_t *status)
00030 {
00031         gettimeofday(&status->start_time, 0);
00032         gettimeofday(&status->last_time, 0);
00033         status->frames = 0;
00034 }
00035 
00036 static void update_status(status_t *status)
00037 {
00038         struct timeval new_time;
00039         gettimeofday(&new_time, 0);
00040         if(new_time.tv_sec - status->last_time.tv_sec > 1)
00041         {
00042                 fprintf(stderr, "%lld frames.  %lld frames/sec      \r", 
00043                         status->frames,
00044                         (int64_t)status->frames / 
00045                         (int64_t)(new_time.tv_sec - status->start_time.tv_sec));
00046                 fflush(stdout);
00047                 status->last_time = new_time;
00048         };
00049 }
00050 
00051 static void stop_status()
00052 {
00053         fprintf(stderr, "\n\n");
00054 }
00055 
00056 
00057 
00058 int main(int argc, char *argv[])
00059 {
00060         TestWindow window;
00061         status_t status;
00062         
00063 //      int result = window.accel_available(BC_YUV422);
00064 //      printf("accel_available == %d\n", result);
00065         window.start_video();
00066         BC_Bitmap *bitmap1 = window.new_bitmap(640, 480, BC_BGR8888);
00067         
00068         init_status(&status);
00069         while(1)
00070         {
00071                 window.draw_bitmap(bitmap1, 1);
00072                 window.flash();
00073                 update_status(&status);
00074                 status.frames++;
00075         }
00076 };

Generated on Sun Jan 8 13:26:35 2006 for Guicast-svn by  doxygen 1.4.4