Exemplo n.º 1
0
static void ErrorPopup(char *message)
{
   AG_Window *win;
   win = AG_WindowNew(0);
   if(win == NULL) {
        if(message == NULL) return;
        XM7_DebugLog(XM7_LOG_INFO, "Error: %s.", message);
        return;
   } else {
      AG_VBox *vb;
      AG_Textbox *tb;
        XM7_DebugLog(XM7_LOG_INFO, "Error: %s.", message);
        vb = AG_VBoxNew(AGWIDGET(win), AG_HBOX_HFILL);
        if(message != NULL) tb = AG_TextboxNew(vb, AG_TEXTBOX_MULTILINE, "%s", message);
        AG_ButtonNewFn(AGWIDGET(vb), 0, gettext("Close"), OnPushCancel, NULL);
        AG_WindowShow(win);
   }
   
}
Exemplo n.º 2
0
    void OptionsState::enter()
    {
        int screenWidth = graphicsEngine->getScreenWidth();
		int screenHeight = graphicsEngine->getScreenHeight();
		int halfScreenWidth = screenWidth / 2;
		int halfScreenHeight = screenHeight / 2;

        AG_Window *win = AG_WindowNew(AG_WINDOW_PLAIN|AG_WINDOW_DENYFOCUS);
		AG_WindowShow(win);
		AG_WindowMaximize(win);

		interfaceManager->addWindow(win);

		// create options window
		AG_Window *optionWindow = AG_WindowNewNamed(AG_WINDOW_NOBUTTONS, "OptionWindow");
		AG_WindowSetCaption(optionWindow, "Options");
		AG_WindowSetGeometry(optionWindow, halfScreenWidth - 85, halfScreenHeight - 85, 170, 170);

		// alignment
		AG_VBox *box = AG_VBoxNew(optionWindow, 0);

		// create list of resolutions
		Point pt;
		pt.x = 1024;
		pt.y = 768;
		mRes.push_back(pt);
		pt.x = 800;
		pt.y = 600;
		mRes.push_back(pt);
		pt.x = 1280;
		pt.y = 1024;
		mRes.push_back(pt);
		pt.x = 1440;
		pt.y = 900;
		mRes.push_back(pt);

		// add selection box for resolution
        selectionBox = AG_UComboNew(box, 0);
        AG_ExpandHoriz(selectionBox);
        AG_UComboSizeHint(selectionBox, "Resolution", mRes.size());

        // loop through all the resolutions
        for (unsigned int i = 0; i < mRes.size(); ++i)
        {
            std::stringstream str;
            str << mRes[i].x << " x " << mRes[i].y;
            AG_TlistAddPtr(selectionBox->list, NULL, str.str().c_str(), &mRes[i]);
        }

        AG_TlistSelect(selectionBox->list, AG_TlistFirstItem(selectionBox->list));
        AG_SetEvent(selectionBox, "ucombo-selected", selected_resolution, NULL);

        std::stringstream fs;
        fs << "Fullscreen: " << mFullscreen;
        logger->logDebug(fs.str());

		// add checkbox for fullscreen
        AG_CheckboxNewInt(box, 0, "Fullscreen", &mFullscreen);

        // add checkbox for hardware acceleration
        AG_CheckboxNewInt(box, 0, "OpenGL", &mOpenGL);

        // add radio for languages
        const char *languages[] = { "English", "Portugues", "Espa\xc3\xb1ol", NULL};
        AG_RadioNewInt(box, 0, languages, &mLangs);

        AG_HBox *hbox = AG_HBoxNew(box, 0);
		// add button to apply
		AG_ButtonNewFn(hbox, 0, "Apply", apply_options, "%p%p%p", &mOpenGL, &mFullscreen, &mLangs);

		// add button to cancel
        AG_ButtonNewFn(hbox, 0, "Cancel", cancel_options, 0);

        AG_WindowShow(optionWindow);
        interfaceManager->addWindow(optionWindow);
    }