Esempio n. 1
0
// マウスのカーソル位置を指定
void AppEnv::mousePosition(const Vec2f& pos) {
  mouse_current_pos_ = pos;

  Vec2f window_pos = windowPosition(Vec2f(pos.x(), -pos.y()),
                                    current_window_size_, Vec2f(viewport_size_.x(), viewport_size_.y()));

  Vec2f mouse_pos = Vec2f(window_pos.x() + viewport_ofs_.x(), window_pos.y() + viewport_ofs_.y());
  
  glfwSetCursorPos(window_(), mouse_pos.x(), mouse_pos.y());
}
Esempio n. 2
0
void
UiSettings::loadSettings()
{
    QSettings s( "CS224", "snow" );

    windowPosition() = s.value( "windowPosition", QPoint(0,0) ).toPoint();
    windowSize() = s.value( "windowSize", QSize(1000,800) ).toSize();

    fillNumParticles() = s.value( "fillNumParticles", 512*128 ).toInt();
    fillResolution() = s.value( "fillResolution", 0.05f ).toFloat();
    fillDensity() = s.value( "fillDensity", 150.f ).toFloat();

    exportDensity() = s.value("exportDensity", false).toBool();
    exportVelocity() = s.value("exportVelocity", false).toBool();

    exportFPS() = s.value("exportFPS", 24).toInt();
    maxTime() = s.value("maxTime", 3).toFloat();

    gridPosition() = vec3( s.value("gridPositionX", 0.f).toFloat(),
                           s.value("gridPositionY", 0.f).toFloat(),
                           s.value("gridPositionZ", 0.f).toFloat() );


    gridDimensions() = glm::ivec3( s.value("gridDimensionX", 128).toInt(),
                                   s.value("gridDimensionY", 128).toInt(),
                                   s.value("gridDimensionZ", 128).toInt() );

    gridResolution() = s.value( "gridResolution", 0.05f ).toFloat();

    timeStep() = s.value( "timeStep", 1e-5 ).toFloat();
    implicit() = s.value( "implicit", true ).toBool();
    materialPreset() = s.value( "materialPreset", MAT_DEFAULT).toInt();

    showContainers() = s.value( "showContainers", true ).toBool();
    showContainersMode() = s.value( "showContainersMode", WIREFRAME ).toInt();
    showColliders() = s.value( "showColliders", true ).toBool();
    showCollidersMode() = s.value( "showCollidersMode", SOLID ).toInt();
    showGrid() = s.value( "showGrid", false ).toBool();
    showGridMode() = s.value( "showGridMode", MIN_FACE_CELLS ).toInt();
    showGridData() = s.value( "showGridData", false ).toBool();
    showGridDataMode() = s.value( "showGridDataMode", NODE_DENSITY ).toInt();
    showParticles() = s.value( "showParticles", true ).toBool();
    showParticlesMode() = s.value( "showParticlesMode", PARTICLE_MASS ).toInt();

    selectionColor() = glm::vec4( 0.302f, 0.773f, 0.839f, 1.f );
}
Esempio n. 3
0
void
UiSettings::saveSettings()
{
    QSettings s( "CS224", "snow" );

    s.setValue( "windowPosition", windowPosition() );
    s.setValue( "windowSize", windowSize() );

    s.setValue( "fillNumParticles", fillNumParticles() );
    s.setValue( "fillResolution", fillResolution() );
    s.setValue( "fillDensity", fillDensity() );

    s.setValue("exportDensity", exportDensity());
    s.setValue("exportVelocity",exportVelocity());
    s.setValue( "exportFPS", exportFPS());
    s.setValue( "maxTime", maxTime());

    s.setValue( "gridPositionX", gridPosition().x );
    s.setValue( "gridPositionY", gridPosition().y );
    s.setValue( "gridPositionZ", gridPosition().z );

    s.setValue( "gridDimensionX", gridDimensions().x );
    s.setValue( "gridDimensionY", gridDimensions().y );
    s.setValue( "gridDimensionZ", gridDimensions().z );

    s.setValue( "gridResolution", gridResolution() );

    s.setValue( "timeStep", timeStep() );
    s.setValue( "implicit", implicit() );
    s.setValue("materialPreset", materialPreset());

    s.setValue( "showContainers", showContainers() );
    s.setValue( "showContainersMode", showContainersMode() );
    s.setValue( "showColliders", showColliders() );
    s.setValue( "showCollidersMode", showCollidersMode() );
    s.setValue( "showGrid", showGrid() );
    s.setValue( "showGridMode", showGridMode() );
    s.setValue( "showGridData", showGridData() );
    s.setValue( "showGridDataMode", showGridDataMode() );
    s.setValue( "showParticles", showParticles() );
    s.setValue( "showParticlesMode", showParticlesMode() );
}
Esempio n. 4
0
void Application::CreateWindow()
{
  PositionSize windowPosition(0, 0, 0, 0);  // this will use full screen

  if( mCommandLineOptions->stageWidth > 0 && mCommandLineOptions->stageHeight > 0 )
  {
    // Command line options override environment options and full screen
    windowPosition = PositionSize( 0, 0, mCommandLineOptions->stageWidth, mCommandLineOptions->stageHeight );
  }
  else if( mEnvironmentOptions.GetWindowWidth() && mEnvironmentOptions.GetWindowHeight() )
  {
    // Environment options override full screen functionality if command line arguments not provided
    windowPosition = PositionSize( 0, 0, mEnvironmentOptions.GetWindowWidth(), mEnvironmentOptions.GetWindowHeight() );
  }

  const std::string& windowClassName = mEnvironmentOptions.GetWindowClassName();
  mWindow = Dali::Window::New( windowPosition, mName, windowClassName, mWindowMode == Dali::Application::TRANSPARENT );

  // Quit the application when the window is closed
  GetImplementation( mWindow ).DeleteRequestSignal().Connect( mSlotDelegate, &Application::Quit );
}
void GameCharaSelectMenu::renderPlayerInfo(kuto::Graphics2D& g, int index) const
{
	rpg2k::model::Project const& proj = field_.project();
	rpg2k::model::DataBase const& ldb = proj.getLDB();
	unsigned playerID = proj.getLSD().member(index);
	char temp[256] = "\0";
	// face
	kuto::Vector2 facePos(8.f + position_.x, index * 58.f + 8.f + position_.y);
	// TODO: field_.players()[index]->renderFace(g, facePos);
	// status
	const kuto::Color color(1.f, 1.f, 1.f, 1.f);
	kuto::Vector2 windowPosition(position_.x + 64.f, position_.y);
	rpg2k::model::Project::Character const& character = proj.character(playerID);
	const char* conditionStr = NULL;
	const std::vector<uint8_t>& badConditions = character.condition();
	unsigned cond = 0;
	std::vector<uint8_t>::const_iterator cond_it = badConditions.begin();
	while ( ( cond_it = std::find( cond_it, badConditions.end(), true ) ) != badConditions.end() ) {
		unsigned const nextCond = cond_it - badConditions.begin() + 1;
		if (ldb.condition()[nextCond][4].to<int>() > ldb.condition()[cond][4].to<int>()) {
			cond = nextCond;
		}
	}
	if(cond == 0) { conditionStr = ldb.vocabulary(126).toSystem().c_str(); }
	else { conditionStr = ldb.condition()[cond][1].to_string().toSystem().c_str(); }

	if (size_.x < 200.f) {	// short version
		kuto::Vector2 pos = windowPosition;
		pos.y += (rowHeight_ + lineSpace_) * index + 8.f + 2.f;
		g.drawText(character.name().c_str(), pos, color, fontSize_, kuto::Font::NORMAL);

		pos = windowPosition;
		pos.y += (rowHeight_ + lineSpace_) * index + 16.f + 8.f;
		g.drawText(ldb.vocabulary(128).toSystem().c_str(), pos, color, fontSize_, kuto::Font::NORMAL);
		pos.x += 12.f;
		sprintf(temp, "%2d", character.level());
		g.drawText(temp, pos, color, fontSize_, kuto::Font::NORMAL);
		pos.x += 48.f;
		g.drawText(ldb.vocabulary(129).toSystem().c_str(), pos, color, fontSize_, kuto::Font::NORMAL);
		pos.x += 12.f;
		sprintf(temp, "%3d/%3d", character.hp(), character.param(rpg2k::Param::HP) );
		g.drawText(temp, pos, color, fontSize_, kuto::Font::NORMAL);

		pos = windowPosition;
		pos.y += (rowHeight_ + lineSpace_) * index + 16.f * 2.f + 8.f;
		g.drawText(conditionStr, pos, color, fontSize_, kuto::Font::NORMAL);
		pos.x += 60.f;
		g.drawText(ldb.vocabulary(130).toSystem().c_str(), pos, color, fontSize_, kuto::Font::NORMAL);
		pos.x += 12.f;
		sprintf(temp, "%3d/%3d", character.mp(), character.param(rpg2k::Param::MP));
		g.drawText(temp, pos, color, fontSize_, kuto::Font::NORMAL);
	} else {
		kuto::Vector2 pos = windowPosition;
		pos.y += (rowHeight_ + lineSpace_) * index + 8.f + 2.f;
		g.drawText(character.name().c_str(), pos, color, fontSize_, kuto::Font::NORMAL);
		pos.x += 86.f;
		g.drawText(character.title().c_str(), pos, color, fontSize_, kuto::Font::NORMAL);

		pos = windowPosition;
		pos.y += (rowHeight_ + lineSpace_) * index + 16.f + 8.f;
		g.drawText(ldb.vocabulary(128).toSystem().c_str(), pos, color, fontSize_, kuto::Font::NORMAL);
		pos.x += 12.f;
		sprintf(temp, "%2d", character.level());
		g.drawText(temp, pos, color, fontSize_, kuto::Font::NORMAL);
		pos.x += 30.f;
		g.drawText(conditionStr, pos, color, fontSize_, kuto::Font::NORMAL);
		pos.x += 50.f;
		g.drawText(ldb.vocabulary(129).toSystem().c_str(), pos, color, fontSize_, kuto::Font::NORMAL);
		pos.x += 22.f;
		sprintf(temp, "%3d/%3d", character.hp(), character.param(rpg2k::Param::HP));
		g.drawText(temp, pos, color, fontSize_, kuto::Font::NORMAL);

		pos = windowPosition;
		pos.y += (rowHeight_ + lineSpace_) * index + 16.f * 2.f + 8.f;
		g.drawText(ldb.vocabulary(127).toSystem().c_str(), pos, color, fontSize_, kuto::Font::NORMAL);
		pos.x += 12.f;
		sprintf(temp, "%6d/%6d", character.levelExp(), character.nextLevelExp());
		g.drawText(temp, pos, color, fontSize_, kuto::Font::NORMAL);
		pos.x += 80.f;
		g.drawText(ldb.vocabulary(130).toSystem().c_str(), pos, color, fontSize_, kuto::Font::NORMAL);
		pos.x += 22.f;
		sprintf(temp, "%3d/%3d", character.mp(), character.param(rpg2k::Param::MP));
		g.drawText(temp, pos, color, fontSize_, kuto::Font::NORMAL);
	}
}
void Encounter::Draw()
{
    pBackgroundDarkeningImage->Draw(Vector2(0, 0), Color(backgroundOpacityAlphaValue / 255.0, 1.0, 1.0, 1.0));
    Case::GetInstance()->GetDialogCharacterManager()->DrawForState(&state);

    Vector2 windowPosition(0, 0);

    if (state.GetWindowMotionXEasingFunction() != NULL && state.GetWindowMotionYEasingFunction() != NULL)
    {
        windowPosition = Vector2(state.GetWindowMotionXEasingFunction()->GetCurrentValue(), state.GetWindowMotionYEasingFunction()->GetCurrentValue());
    }

    if (state.GetCurrentAnimation() != NULL)
    {
        state.GetCurrentAnimation()->Draw();
    }

    if (pEvidenceSelector->GetIsShowing())
    {
        pEvidenceSelector->Draw(dialogBackgroundYPosition);
    }
    else if (pCurrentConversation != NULL && pDialogBackgroundInEase->GetIsFinished())
    {
        pCurrentConversation->DrawBackground(windowPosition.GetX(), windowPosition.GetY() + dialogBackgroundYPosition);
    }

    if (state.GetIsInterjectionOngoing())
    {
        double interjectionBackgroundOpacity = 0;

        if (state.GetInterjectionDarkeningOpacityInEasingFunction()->GetIsStarted() && !state.GetInterjectionDarkeningOpacityOutEasingFunction()->GetIsStarted())
        {
            interjectionBackgroundOpacity = state.GetInterjectionDarkeningOpacityInEasingFunction()->GetCurrentValue();
        }
        else if (state.GetInterjectionDarkeningOpacityOutEasingFunction()->GetIsStarted() && !state.GetInterjectionDarkeningOpacityOutEasingFunction()->GetIsFinished())
        {
            interjectionBackgroundOpacity = state.GetInterjectionDarkeningOpacityOutEasingFunction()->GetCurrentValue();
        }

        pBackgroundDarkeningImage->Draw(Vector2(0, 0), Color(interjectionBackgroundOpacity / 255.0, 1.0, 1.0, 1.0));
        Case::GetInstance()->GetDialogCharacterManager()->DrawInterjectionForState(&state);
    }

    pCharacterNameTab->Draw(windowPosition.GetX(), windowPosition.GetY() + dialogBackgroundYPosition);

    if (pCurrentButtonArray == pMainMenuButtonArray && !pEvidenceSelector->GetIsShowing() && pCurrentConversation == NULL)
    {
        pExitTab->Draw(windowPosition.GetX(), windowPosition.GetY() + dialogBackgroundYPosition);
        pPresentEvidenceTab->Draw(windowPosition.GetX(), windowPosition.GetY() + dialogBackgroundYPosition);
    }

    pDialogBackgroundImage->Draw(Vector2(windowPosition.GetX(), windowPosition.GetY() + dialogBackgroundYPosition));

    if (!pEvidenceSelector->GetIsShowing())
    {
        if (pCurrentConversation != NULL && pDialogBackgroundInEase->GetIsFinished())
        {
            pCurrentConversation->Draw(windowPosition.GetX(), windowPosition.GetY() + dialogBackgroundYPosition);
        }
        else if (pCurrentButtonArray != NULL)
        {
            pCurrentButtonArray->Draw(windowPosition.GetX(), windowPosition.GetY() + dialogBackgroundYPosition);
        }
    }
}