Пример #1
0
void initmodules(const string basedir)
{
	log4me_init(LOG_EMU_NONE);
#ifdef WIN32
	string redirect = pathcombc(strdups(basedir), "output.txt");
	log4me_redirectoutput(CSTR(redirect));
	strfree(redirect);
#endif

    LIBXML_TEST_VERSION;

    clock_init();

    // initialize SDL video
    if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK)<0) {
        log4me_error(LOG_EMU_SDL, "Unable to init SDL: %s\n", SDL_GetError());
        exit(EXIT_FAILURE);
    }
    // make sure SDL cleans up before exit
    pushexit(SDL_Quit);

    video_init();
    input_init();

    seticon(getcurrentwindow());
}
Пример #2
0
void st_general_setup(void)
{
  /* Seed random number generator: */

  srand(SDL_GetTicks());

  /* Set icon image: */

  seticon();

  /* Unicode needed for input handling: */

  SDL_EnableUNICODE(1);

  /* Load global images: */

#ifndef RES320X240
  white_text  = new Text(datadir + "/images/status/letters-white.png", TEXT_TEXT, 16,18);
#else
  white_text  = new Text(datadir + "/images/status/letters-white-small.png", TEXT_TEXT, 8,9);
  fadeout();
#endif


#ifndef RES320X240
  black_text  = new Text(datadir + "/images/status/letters-black.png", TEXT_TEXT, 16,18);
#else
  black_text  = new Text(datadir + "/images/status/letters-black-small.png", TEXT_TEXT, 8,9);
#endif
#ifndef RES320X240
  gold_text   = new Text(datadir + "/images/status/letters-gold.png", TEXT_TEXT, 16,18);
#else
  gold_text   = new Text(datadir + "/images/status/letters-gold-small.png", TEXT_TEXT, 8,9);
#endif
  silver_text = new Text(datadir + "/images/status/letters-silver.png", TEXT_TEXT, 16,18);
#ifndef RES320X240
  blue_text   = new Text(datadir + "/images/status/letters-blue.png", TEXT_TEXT, 16,18);
#else
  blue_text   = new Text(datadir + "/images/status/letters-blue-small.png", TEXT_TEXT, 8,9);
#endif
  red_text    = new Text(datadir + "/images/status/letters-red.png", TEXT_TEXT, 16,18);
  green_text  = new Text(datadir + "/images/status/letters-green.png", TEXT_TEXT, 16,18);
  //white_text  = new Text(datadir + "/images/status/letters-white.png", TEXT_TEXT, 16,18);
  white_small_text = new Text(datadir + "/images/status/letters-white-small.png", TEXT_TEXT, 8,9);
  white_big_text   = new Text(datadir + "/images/status/letters-white-big.png", TEXT_TEXT, 20,22);
  yellow_nums = new Text(datadir + "/images/status/numbers.png", TEXT_NUM, 32,32);

  /* Load GUI/menu images: */
  checkbox = new Surface(datadir + "/images/status/checkbox.png", USE_ALPHA);
  checkbox_checked = new Surface(datadir + "/images/status/checkbox-checked.png", USE_ALPHA);
  back = new Surface(datadir + "/images/status/back.png", USE_ALPHA);
  arrow_left = new Surface(datadir + "/images/icons/left.png", USE_ALPHA);
  arrow_right = new Surface(datadir + "/images/icons/right.png", USE_ALPHA);

  /* Load the mouse-cursor */
  mouse_cursor = new MouseCursor( datadir + "/images/status/mousecursor.png",1);
  MouseCursor::set_current(mouse_cursor);
  
}
FuzzyFunctionTrapezoidal::FuzzyFunctionTrapezoidal(QObject *parent) :
    FuzzyFunction(parent)
{
    for (register int i = 0; i < parametersCount() ; i++)
        m_parameterList[i] = -1;

    QStringList iconlist = FuzzyFunction::availableIcons;
    seticon(iconlist.at(3));
}
Пример #4
0
/***************************
	GraphicsInit: Initializes the graphic system
****************************/
void GraphicsInit(void)
{
  const SDL_VideoInfo* video_info = SDL_GetVideoInfo();
  Uint32 surface_mode = 0;

  DEBUGCODE
  { fprintf(stderr, "Entering GraphicsInit()\n"); };

  //Set application's icon:
  seticon();
  //Set caption:
  SDL_WM_SetCaption("Tux Typing", "TuxType");

  if (video_info->hw_available)
  {
    surface_mode = SDL_HWSURFACE;
    LOG("HW mode\n");
  }
  else
  {
    surface_mode = SDL_SWSURFACE;
    LOG("SW mode\n");
  }

  // Determine the current resolution: this will be used as the
  // fullscreen resolution, if the user wants fullscreen.
  DEBUGCODE
  {
    fprintf(stderr, "Current resolution: w %d, h %d.\n", 
            video_info->current_w, video_info->current_h);
  }

  /* For fullscreen, we try to use current resolution from OS: */
  
  fs_res_x = video_info->current_w;
  fs_res_y = video_info->current_h;

  if (settings.fullscreen == 1)
  {
    screen = SDL_SetVideoMode(fs_res_x, fs_res_y, BPP, SDL_FULLSCREEN | surface_mode);
    if (screen == NULL)
    {
      fprintf(stderr,
            "\nWarning: I could not open the display in fullscreen mode.\n"
            "The Simple DirectMedia error that occured was:\n"
            "%s\n\n", SDL_GetError());
      settings.fullscreen = 0;
    }
  }

  /* Either fullscreen not requested, or couldn't get fullscreen in SDL: */
  if (settings.fullscreen == 0)
  {
    screen = SDL_SetVideoMode(RES_X, RES_Y, BPP, surface_mode);
  }

  /* Failed to get a usable screen - must bail out! */
  if (screen == NULL)
  {
    fprintf(stderr,
          "\nError: I could not open the display.\n"
          "The Simple DirectMedia error that occured was:\n"
          "%s\n\n", SDL_GetError());
    exit(2);
  }

  InitBlitQueue();



  DEBUGCODE 
  {
    video_info = SDL_GetVideoInfo();
    fprintf(stderr, "-SDL VidMode successfully set to %ix%ix%i\n",
            video_info->current_w,
            video_info->current_h,
            video_info->vfmt->BitsPerPixel);
  }

	LOG( "GraphicsInit():END\n" );
}
Пример #5
0
int CWinSelect1Icon::drawwin()
{
	seticon(m_wpos, &m_cur, &m_dpos, m_list, m_cp, m_cols);
	return true;
}
Пример #6
0
void initialize_SDL(void)
{
    //NOTE - SDL_Init() and friends now in InitT4KCommon()

    // Audio parameters
    int frequency, channels, n_timesopened;
    Uint16 format;

    /* Init common library */
    if(!InitT4KCommon(debug_status))
    {
        fprintf(stderr, "InitT4KCommon() failed - exiting.\n");
        cleanup_on_error();
        exit(1);
    }

    /* Init SDL Video: */
    screen = NULL;


    /* Init SDL Audio: */
    Opts_SetSoundHWAvailable(0);  // By default no sound HW
#ifndef NOSOUND
    if (Opts_GetGlobalOpt(USE_SOUND))
    {
        if (Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, AUDIO_S16SYS, 2, 2048) < 0)
        {
            fprintf(stderr,
                    "\nWarning: I could not set up audio for 44100 Hz "
                    "16-bit stereo.\n"
                    "The Simple DirectMedia error that occured was:\n"
                    "%s\n\n", SDL_GetError());

        }
        n_timesopened = Mix_QuerySpec(&frequency,&format,&channels);
        if (n_timesopened > 0)
            Opts_SetSoundHWAvailable(1);
        else
            frequency = format = channels = 0; //more helpful than garbage
        DEBUGMSG(debug_setup, "Sound mixer: frequency = %d, "
                "format = %x, "
                "channels = %d, "
                "n_timesopened = %d\n",
                frequency,format,channels,n_timesopened);
    }
#endif
    /* If couldn't set up sound, deselect sound options: */
    if(!Opts_SoundHWAvailable())
    {
        DEBUGMSG(debug_setup, "Sound setup failed - deselecting sound options\n");        
        Opts_SetGlobalOpt(USE_SOUND, 0);
        Opts_SetGlobalOpt(MENU_SOUND, 0);
        Opts_SetGlobalOpt(MENU_MUSIC, 0);
    }



    {
        const SDL_VideoInfo *videoInfo;
        Uint32 surfaceMode;
        videoInfo = SDL_GetVideoInfo();
        if (videoInfo->hw_available)
        {
            surfaceMode = SDL_HWSURFACE;
            DEBUGMSG(debug_setup, "HW mode\n");
        }
        else
        {
            surfaceMode = SDL_SWSURFACE;
            DEBUGMSG(debug_setup, "SW mode\n");
        }

        // Determine the current resolution: this will be used as the
        // fullscreen resolution, if the user wants fullscreen.
        DEBUGMSG(debug_setup, "Current resolution: w %d, h %d.\n",videoInfo->current_w,videoInfo->current_h);
        if (Opts_GetGlobalOpt(FULLSCREEN) && Opts_CustomRes()) {
          fs_res_x = Opts_WindowWidth();
          fs_res_y = Opts_WindowHeight();
          DEBUGMSG(debug_setup, "Full screen mode custom resolution: w %d, h %d.\n",fs_res_x,fs_res_y);
        } else {
          fs_res_x = videoInfo->current_w;
          fs_res_y = videoInfo->current_h;
        }

        if (Opts_GetGlobalOpt(FULLSCREEN))
        {
            screen = SDL_SetVideoMode(fs_res_x, fs_res_y, PIXEL_BITS, SDL_FULLSCREEN | surfaceMode);
            if (screen == NULL)
            {
                fprintf(stderr,
                        "\nWarning: I could not open the display in fullscreen mode.\n"
                        "The Simple DirectMedia error that occured was:\n"
                        "%s\n\n", SDL_GetError());
                Opts_SetGlobalOpt(FULLSCREEN, 0);
            }
        }

        if (!Opts_GetGlobalOpt(FULLSCREEN))
        {
            screen = SDL_SetVideoMode(Opts_WindowWidth(), Opts_WindowHeight(), PIXEL_BITS, surfaceMode);
        }

        if (screen == NULL)
        {
            fprintf(stderr,
                    "\nError: I could not open the display.\n"
                    "The Simple DirectMedia error that occured was:\n"
                    "%s\n\n", SDL_GetError());
            cleanup_on_error();
            exit(1);
        }

        seticon();

        SDL_WM_SetCaption("Tux, of Math Command", "TuxMath");


    }
}