Exemplo n.º 1
0
int WM_Exec(void) {
  int r = 0;
  while (WM_Exec1()) {
    r = 1;                  /* We have done something */
  }
  return r;
}
/*******************************************************************
*
*       _ShowHiResPixels

  This is frame-function for the callback. It creates the window
  and handles the rotation of polygons and colors.
*/
static void _ShowHiResPixels(void) {
    WM_HWIN hWindow;
    const GUI_FONT *font_old;
    float pi, step, angle;
    int i, tm;
    pi = 3.1415926f;
    step = pi / 180;
    GUI_SetBkColor(GUI_BLACK);
    GUI_Clear();
    GUI_SetColor(GUI_WHITE);
    GUI_SetTextAlign(GUI_TA_HCENTER);
    font_old = GUI_SetFont(&GUI_Font24_ASCII);
    GUI_DispStringAt("AA_HiResPixels - Sample", 160, 5);
    GUI_SetFont(font_old);
    GUI_SetColor(GUI_RED);
    GUI_DispStringHCenterAt("not\nantialised", 65, 100);
    GUI_SetColor(GUI_GREEN);
    GUI_DispStringHCenterAt("antialised", 160, 100);
    GUI_SetColor(GUI_BLUE);
    GUI_DispStringHCenterAt("antialised\nwith high\nresolution", 255, 100);
    hWindow = WM_CreateWindow(35, 140, 250, 60, WM_CF_SHOW | WM_CF_MEMDEV, &_cbWindow, 0);
    WM_SelectWindow(hWindow);
    GUI_AA_SetFactor(AA_FACTOR);
    while (1) {
        for (i=0, angle=0; i<360; i++) {
            tm = GUI_GetTime();
            angle += step;
            GUI_RotatePolygon(_aPolygonHiRes, _aPolygonHiRes_src, POLY_POINTS, angle);
            GUI_RotatePolygon(_aPolygon, _aPolygon_src, POLY_POINTS, angle);
            _CalcColor();
            WM_InvalidateWindow(hWindow);
            while (((GUI_GetTime()-tm) < 50) || (WM_Exec1() != 0));
        }
    }
    WM_DeleteWindow(hWindow);
}