Example #1
0
void cSensorAnalyzer::SetConfiguration(const QString& filename)
{
    std::string stdString = filename.toStdString();
    const tChar* string = stdString.c_str();
    cFilename path = GetPropertyStr("Directory for Sensorpresets");
    path.Append("/");
    path.Append(string);
    LoadConfigurationData(path);
    m_pWidget->SetSensorPresets(m_sensorPresets);
}
Example #2
0
bool Init()
{
    if (LoadConfigurationData(applicationConfig, styleConfig) == false)
        return false;

    al_init();

    if (applicationConfig.bfullscreen == true)
    {
        al_set_new_display_flags(ALLEGRO_FULLSCREEN);
    }
    al_set_app_name(applicationConfig.strAppName.c_str());
    al_set_new_display_option(ALLEGRO_VSYNC, 1, ALLEGRO_REQUIRE);
    display = al_create_display(applicationConfig.iDispW, applicationConfig.iDispH);

    al_install_keyboard();
    al_install_mouse();
    al_init_primitives_addon();
    al_init_image_addon();
    al_init_font_addon();
    al_init_ttf_addon();

    timer = al_create_timer(applicationConfig.dFps);
    queue = al_create_event_queue();
    textFont = al_load_ttf_font(styleConfig.strFontPath.c_str(), styleConfig.iFontSize, NULL);

    if ((display == nullptr) || (timer == nullptr) || (queue == nullptr) || (textFont == nullptr))
    {
        std::cout << "ERROR: Either the display, timer, queue or font failed to initialize!" << std::endl
            << "0x" << display << " 0x" << timer << " 0x" << queue << " 0x" << textFont << std::endl;
        return false;
    }

    al_register_event_source(queue, al_get_keyboard_event_source());
    al_register_event_source(queue, al_get_mouse_event_source());
    al_register_event_source(queue, al_get_display_event_source(display));
    al_register_event_source(queue, al_get_timer_event_source(timer));

    return true;
}