/**
 * Initializes all the elements in the Controls screen.
 * @param game Pointer to the core game.
 */
OptionsControlsState::OptionsControlsState(Game *game) : State(game), _selected(-1), _selKey(0)
{
	_countGeneral = 4;
	_countGeo = 20;
	_countBattle = 32;

	// Create objects
	_window = new Window(this, 320, 200, 0, 0, POPUP_BOTH);
	_btnOk = new TextButton(148, 16, 8, 176);
	_btnCancel = new TextButton(148, 16, 164, 176);
	_txtTitle = new Text(310, 16, 5, 8);
	_lstControls = new TextList(288, 136, 8, 30);

	add(_window);
	add(_btnOk);
	add(_btnCancel);
	add(_txtTitle);
	add(_lstControls);

	// Set up objects
	_window->setColor(Palette::blockOffset(8)+5);
	_window->setBackground(game->getResourcePack()->getSurface("BACK01.SCR"));

	_btnOk->setColor(Palette::blockOffset(8)+5);
	_btnOk->setText(_game->getLanguage()->getString("STR_OK"));
	_btnOk->onMouseClick((ActionHandler)&OptionsControlsState::btnOkClick);
	_btnOk->onKeyboardPress((ActionHandler)&OptionsControlsState::btnOkClick, (SDLKey)Options::getInt("keyOk"));

	_btnCancel->setColor(Palette::blockOffset(8)+5);
	_btnCancel->setText(_game->getLanguage()->getString("STR_CANCEL_UC"));
	_btnCancel->onMouseClick((ActionHandler)&OptionsControlsState::btnCancelClick);
	_btnCancel->onKeyboardPress((ActionHandler)&OptionsControlsState::btnCancelClick, (SDLKey)Options::getInt("keyCancel"));

	_txtTitle->setColor(Palette::blockOffset(15)-1);
	_txtTitle->setBig();
	_txtTitle->setAlign(ALIGN_CENTER);
	_txtTitle->setText(_game->getLanguage()->getString("STR_CONTROLS"));

	_lstControls->setColor(Palette::blockOffset(8)+10);
	_lstControls->setArrowColor(Palette::blockOffset(8)+5);
	_lstControls->setColumns(2, 168, 120);
	_lstControls->setSelectable(true);
	_lstControls->setBackground(_window);
	_lstControls->setMargin(8);
	_lstControls->onMouseClick((ActionHandler)&OptionsControlsState::lstControlsClick, 0);
	_lstControls->onKeyboardPress((ActionHandler)&OptionsControlsState::lstControlsKeyPress);
	_lstControls->focus();

	_lstControls->addRow(2, _game->getLanguage()->getString("STR_GENERAL").c_str(), L"");
	_lstControls->setCellColor(0, 0, Palette::blockOffset(15)-1);
	addControls(_controlsGeneral, _countGeneral);
	_lstControls->addRow(2, L"", L"");
	_lstControls->addRow(2, _game->getLanguage()->getString("STR_GEOSCAPE").c_str(), L"");
	_lstControls->setCellColor(_countGeneral + 2, 0, Palette::blockOffset(15)-1);
	addControls(_controlsGeo, _countGeo);
	_lstControls->addRow(2, L"", L"");
	_lstControls->addRow(2, _game->getLanguage()->getString("STR_BATTLESCAPE").c_str(), L"");
	_lstControls->setCellColor(_countGeneral + 2 + _countGeo + 2, 0, Palette::blockOffset(15)-1);
	addControls(_controlsBattle, _countBattle);
}
void OptionsControlsState::init()
{
	OptionsBaseState::init();
	_lstControls->addRow(2, tr("STR_GENERAL").c_str(), L"");
	_lstControls->setCellColor(0, 0, _colorGroup);
	addControls(_controlsGeneral);
	_lstControls->addRow(2, L"", L"");
	_lstControls->addRow(2, tr("STR_GEOSCAPE").c_str(), L"");
	_lstControls->setCellColor(_controlsGeneral.size() + 2, 0, _colorGroup);
	addControls(_controlsGeo);
	_lstControls->addRow(2, L"", L"");
	_lstControls->addRow(2, tr("STR_BATTLESCAPE").c_str(), L"");
	_lstControls->setCellColor(_controlsGeneral.size() + 2 + _controlsGeo.size() + 2, 0, _colorGroup);
	addControls(_controlsBattle);
}
Example #3
0
MyMFCC::MyMFCC(mrs_string name) :
    MarSystem("MyMFCC", name),
    m_filterCount(0),
    m_melOffsets(0),
    m_melCoeff(0),
    m_plan(0),
    m_dctIn(0),
    m_dctOut(0),
    m_win(0),
    m_sr(0)
{
    addControls();
}
void SliceViewer::Create()
{
double range[2];
if(mColorTable==NULL)
{

mVolume->GetScalarRange(range);

mColorTable=vtkLookupTable::New();
mColorTable->SetAlpha(1.0);
mColorTable->SetNumberOfColors(256);
mColorTable->SetRange(range);
mColorTable->Build();


int i;
double c;
for (i=0; i<256; i++) 
{
c=(double)i/255.0;	
mColorTable->SetTableValue(i,c,c,c);
}


}

//mLabelImage=new LabelImage();
//mLabelImage->CreateImage(mVolume);
//mLabelImage->test();
//mLabelImage->CreateColorTable();
//mLabelImage->mImage->GetScalarRange(range);
//mLabelImage->mColorTable->SetRange(range);
//std::cout<<"min="<<range[0]<<" max="<<range[1]<<std::endl;


createPlaneWidget();
createPlaneWidget3();
createPlaneWidget2();

if(mVolume->GetNumberOfScalarComponents()==3)
{
mLum=vtkImageLuminance2::New();
mLum->SetInput(mVolume);
mLum->SetCoef(mCoef);
mLum->Update();

}

//OnMouseMove *mouseMove =new OnMouseMove(this);
//mView->GetInteractor()->AddObserver(vtkCommand::MouseMoveEvent,mouseMove);
//mView->GetInteractor()->AddObserver(vtkCommand::LeftButtonPressEvent,mouseMove);
//mView->GetInteractor()->AddObserver(vtkCommand::RightButtonPressEvent,mouseMove);



setupCamera();

updateText();
addText();
mRenderer->ResetCamera();
mView->GetRenderWindow()->Render();
addControls();
}
Example #5
0
LinearTrend::LinearTrend(mrs_string name) :
    MarSystem("LinearTrend", name)
{
    addControls();
}