GameSettings::GameSettings()
        : AbstractWindow("gamesettings.xml", WIT_MOUSE_INPUT)
    {
        // Register sound driver components
        std::list<SoundDriver*> soundDriverList = SoundManager::getSingleton().getDriverList();

        for (std::list<SoundDriver*>::iterator it = soundDriverList.begin();
             it != soundDriverList.end(); it++)
        {
            if ((*it)->isDriverPlugin())
            {
                //registerSoundDriverConfig((*it)->getConfigComponent());
            }
        }

        // Connect actions to callbacks
        getWindow()->subscribeEvent(CEGUI::FrameWindow::EventCloseClicked,
                                    boost::bind(&GameSettings::onCancel, this));

        mVideoRenderer = getCombobox("GameOptionsWindow/Video/Renderer");
        mVideoResolution = getCombobox("GameOptionsWindow/Video/Resolution");
        mVideoFullscreen = getCheckbox("GameOptionsWindow/Video/Fullscreen");
        
        mVideoColorDepth32 = getRadioButton("GameOptionsWindow/Video/ColorDepth/32");
        mVideoColorDepth32->setUserData(new Ogre::String("32"));
        mVideoColorDepth32->setGroupID(1);
        mVideoColorDepth16 = getRadioButton("GameOptionsWindow/Video/ColorDepth/16");
        mVideoColorDepth16->setUserData(new Ogre::String("16"));
        mVideoColorDepth16->setGroupID(1);
        
        mVideoFsaa0 = getRadioButton("GameOptionsWindow/Video/FSAA/Off");
        mVideoFsaa0->setUserData(new Ogre::String("0"));
        mVideoFsaa0->setGroupID(2);
        mVideoFsaa2 = getRadioButton("GameOptionsWindow/Video/FSAA/2x");
        mVideoFsaa2->setUserData(new Ogre::String("2"));
        mVideoFsaa2->setGroupID(2);
        mVideoFsaa4 = getRadioButton("GameOptionsWindow/Video/FSAA/4x");
        mVideoFsaa4->setUserData(new Ogre::String("4"));
        mVideoFsaa4->setGroupID(2);
        mVideoFsaa8 = getRadioButton("GameOptionsWindow/Video/FSAA/8x");
        mVideoFsaa8->setUserData(new Ogre::String("8"));
        mVideoFsaa8->setGroupID(2);
        
        mVideoRttModeFBO = getRadioButton("GameOptionsWindow/Video/RTT/FBO");
        mVideoRttModeFBO->setUserData(new Ogre::String("FBO"));
        mVideoRttModeFBO->setGroupID(3);
        mVideoRttModePBuffer = getRadioButton("GameOptionsWindow/Video/RTT/PBuffer");
        mVideoRttModePBuffer->setUserData(new Ogre::String("PBuffer"));
        mVideoRttModePBuffer->setGroupID(3);
        mVideoRttModeCopy = getRadioButton("GameOptionsWindow/Video/RTT/Copy");
        mVideoRttModeCopy->setUserData(new Ogre::String("Copy"));
        mVideoRttModeCopy->setGroupID(3);
        
        centerWindow();
        setVisible(false);
        update();
    }
Esempio n. 2
0
//---------------------------------------------------------------------------
BOOL CALLBACK PdfProc(HWND hWnd, UINT msg, WPARAM wP, LPARAM)
{
	struct PageSize {
		int w, h;
		TCHAR *s;
	};
	static const PageSize P[]=
	{{595, 842, _T("A4")}, {421, 595, _T("A5")}, {842, 1190, _T("A3")}};
	static const int L[]={1, 2, 3, 4, 6, 9, 12};
	int i;
	HWND combo;
	Toption *to;
	TCHAR buf[4];

	switch(msg){
		case WM_INITDIALOG:
			setDlgTexts(hWnd, 26);
			SetDlgItemInt(hWnd, 160, pdfObject.count, FALSE);
			SetDlgItemInt(hWnd, 163, pdfObject.pageWidth, FALSE);
			SetDlgItemInt(hWnd, 164, pdfObject.pageHeight, FALSE);
			combo= GetDlgItem(hWnd, 162);
			for(i=0; i<sizeA(P); i++){
				const PageSize *p = &P[i];
				SendMessage(combo, CB_ADDSTRING, 0, (LPARAM)p->s);
				if(pdfObject.pageWidth==p->w && pdfObject.pageHeight==p->h){
					SendMessage(combo, CB_SETCURSEL, i, 0);
				}
			}
			combo= GetDlgItem(hWnd, 161);
			for(i=0; i<sizeA(L); i++){
				_stprintf(buf, _T("%d"), L[i]);
				SendMessage(combo, CB_ADDSTRING, 0, (LPARAM)buf);
			}
			initGameTypeCombo(hWnd);
			SetDlgItemInt(hWnd, 161, pdfObject.countPerPage, FALSE);
			SetDlgItemInt(hWnd, 168, pdfObject.border, FALSE);
			SetDlgItemInt(hWnd, 169, pdfObject.spacing, FALSE);
			CheckRadioButton(hWnd, 350, 352, 350+symbol0);
			for(to=optionA; to<endA(optionA); to++){
				CheckDlgButton(hWnd, to->dialog, *to->value ? BST_CHECKED : BST_UNCHECKED);
			}
			SetDlgItemInt(hWnd, 165, level, FALSE);
			SetDlgItemText(hWnd, 166, pdfObject.fn);
			return TRUE;

		case WM_COMMAND:
			wP=LOWORD(wP);
			if(wP==IDOK){
				pdfObject.count = 2 * GetDlgItemInt(hWnd, 160, 0, FALSE);
				//page properties
				pdfObject.pageWidth = GetDlgItemInt(hWnd, 163, 0, FALSE);
				pdfObject.pageHeight = GetDlgItemInt(hWnd, 164, 0, FALSE);
				pdfObject.countPerPage = GetDlgItemInt(hWnd, 161, 0, FALSE);
				pdfObject.border = GetDlgItemInt(hWnd, 168, 0, FALSE);
				pdfObject.spacing = GetDlgItemInt(hWnd, 169, 0, FALSE);
				//game options
				for(to=optionA; to<endA(optionA); to++){
					*to->value= IsDlgButtonChecked(hWnd, to->dialog);
				}
				level= GetDlgItemInt(hWnd, 165, 0, FALSE);
				symbol0= getRadioButton(hWnd, 350, 352);
				gameType=getGameType(hWnd);

				GetDlgItemText(hWnd, 166, pdfObject.fn, sizeA(pdfObject.fn));
				EnableWindow(GetDlgItem(hWnd, IDOK), FALSE);
				pdfObject.print(hWnd);
				EndDialog(hWnd, wP);
			}
			if(wP==IDCANCEL) EndDialog(hWnd, wP);
			if(wP==162){
				i=SendDlgItemMessage(hWnd, 162, CB_GETCURSEL, 0, 0);
				if(i>=0 && i<sizeA(P)){
					SetDlgItemInt(hWnd, 163, P[i].w, FALSE);
					SetDlgItemInt(hWnd, 164, P[i].h, FALSE);
				}
			}
			if(wP==167){
				if(saveFileDlg(&pdfOfn, hWnd, 0)){
					SetDlgItemText(hWnd, 166, pdfObject.fn);
				}
			}
			break;
	}
	return FALSE;
}