bool FullColorBrushTool::onPropertyChanged(string propertyName)
{
	m_minThick = m_thickness.getValue().first;
	m_maxThick = m_thickness.getValue().second;
	if (propertyName == "Hardness:" || propertyName == "Thickness") {
		m_brushPad = ToolUtils::getBrushPad(m_thickness.getValue().second, m_hardness.getValue() * 0.01);
		TRectD rect(m_brushPos - TPointD(m_maxThick + 2, m_maxThick + 2),
					m_brushPos + TPointD(m_maxThick + 2, m_maxThick + 2));
		invalidate(rect);
	}
	/*if(propertyName == "Hardness:" || propertyName == "Opacity:")
    setWorkAndBackupImages();*/
	FullcolorBrushMinSize = m_minThick;
	FullcolorBrushMaxSize = m_maxThick;
	FullcolorPressureSensibility = m_pressure.getValue();
	FullcolorBrushHardness = m_hardness.getValue();
	FullcolorMinOpacity = m_opacity.getValue().first;
	FullcolorMaxOpacity = m_opacity.getValue().second;

	if (propertyName == "Preset:") {
		loadPreset();
		getApplication()->getCurrentTool()->notifyToolChanged();
		return true;
	}

	if (m_preset.getValue() != CUSTOM_WSTR) {
		m_preset.setValue(CUSTOM_WSTR);
		getApplication()->getCurrentTool()->notifyToolChanged();
	}

	return true;
}
예제 #2
0
	void CSLevel::createGUIBaseWindow()
	{
		destroyGUIBaseWindow();

		// create the base gui element
		m_GUIBaseWindow = new CSGUI_Window(getApplication()->getDesktop(), getGui(), getApplication()->getDesktop(),getId(),L"CSLevel",rect<s32>(0,0,1024,768),CS_VISIBLE|CS_BORDER|CS_CAPTION|CS_TRANSPARENT,CSGUI_Layout(layoutStyle::REST),0);
		getApplication()->getDesktop()->addCSChild(m_GUIBaseWindow);
	}
예제 #3
0
void ParticleComponent::setTexture(std::string const& id)
{
	if (getApplication().hasResource(id))
	{
		if (getApplication().isResourceLoaded(id))
		{
			ParticleComponent::setTexture(getApplication().getResource<Texture>(id));
		}
	}
}
예제 #4
0
/**
 * The main entry point. We pass arguments onto GLUT.
 */
int main(int argc, char** argv)
{
    // Set up GLUT and the timers
    glutInit(&argc, argv);
    TimingData::init();

    // Create the application and its window
    app = getApplication();
    createWindow(app->getTitle());

    // Set up the appropriate handler functions
    glutReshapeFunc(reshape);
    glutKeyboardFunc(keyboard);
    glutDisplayFunc(display);
    glutIdleFunc(update);
    glutMouseFunc(mouse);
    glutMotionFunc(motion);

    // Run the application
    app->initGraphics();
    glutMainLoop();

    // Clean up the application
    app->deinit();
    delete app;
    TimingData::deinit();
    return 0;
}
예제 #5
0
//------------------------------------------------------------------------------
void
Albany::MechanicsProblem::
constructDirichletEvaluators(const Albany::MeshSpecsStruct& meshSpecs)
{

  // Construct Dirichlet evaluators for all nodesets and names
  std::vector<std::string> dirichletNames(neq);
  int index = 0;
  if (have_mech_eq_) {
    dirichletNames[index++] = "X";
    if (num_dims_ > 1) dirichletNames[index++] = "Y";
    if (num_dims_ > 2) dirichletNames[index++] = "Z";
  }

  if (have_temperature_eq_) dirichletNames[index++] = "T";
  if (have_pore_pressure_eq_) dirichletNames[index++] = "P";
  if (have_transport_eq_) dirichletNames[index++] = "C";
  if (have_hydrostress_eq_) dirichletNames[index++] = "TAU";
  if (have_damage_eq_) dirichletNames[index++] = "D";
  if (have_stab_pressure_eq_) dirichletNames[index++] = "SP";

  // Pass on the Application as well that is needed for
  // the coupled Schwarz BC. It is just ignored otherwise.
  Teuchos::RCP<Albany::Application> const &
  application = getApplication();

  this->params->set<Teuchos::RCP<Albany::Application>>(
      "Application", application);

  Albany::BCUtils<Albany::DirichletTraits> dirUtils;
  dfm = dirUtils.constructBCEvaluators(meshSpecs.nsNames, dirichletNames,
      this->params, this->paramLib);

}
예제 #6
0
bool StylePickerTool::startOrganizePalette() {
  /* Check if the organizing operation is available */
  TXshLevel *level = getApplication()->getCurrentLevel()->getLevel();
  if (!level) {
    DVGui::error(tr("No current level."));
    return false;
  }
  if (level->getType() != PLI_XSHLEVEL && level->getType() != TZP_XSHLEVEL &&
      level->getType() != PLT_XSHLEVEL) {
    DVGui::error(tr("Current level has no available palette."));
    return false;
  }
  /* palette should have more than one page to organize */
  TPalette *pal = NULL;
  if (level->getType() == PLT_XSHLEVEL)
    pal = level->getPaletteLevel()->getPalette();
  else
    pal = level->getSimpleLevel()->getPalette();
  if (!pal || pal->getPageCount() < 2) {
    DVGui::error(
        tr("Palette must have more than one palette to be organized."));
    return false;
  }

  m_paletteToBeOrganized = pal;

  std::cout << "Start Organize Palette" << std::endl;

  return true;
}
예제 #7
0
bool MasterConfig::run( co::Object* frameData )
{
    LBASSERT( _objects );
    if( frameData )
        LBCHECK( _objects->register_( frameData, OBJECTTYPE_FRAMEDATA ));
    _objects->setFrameData( frameData );

    seq::Application* const app = getApplication();
    while( isRunning( ))
    {
        startFrame();
        if( getError( ))
            LBWARN << "Error during frame start: " << getError() << std::endl;
        finishFrame();

        while( !needRedraw( )) // wait for an event requiring redraw
        {
            if( app->hasCommands( )) // execute non-critical pending commands
            {
                app->processCommand();
                handleEvents(); // non-blocking
            }
            else  // no pending commands, block on user event
            {
                const eq::EventCommand& event = getNextEvent();
                if( !handleEvent( event ))
                    LBVERB << "Unhandled " << event << std::endl;
            }
        }
        handleEvents(); // process all pending events
    }
    finishAllFrames();
    return true;
}
예제 #8
0
void StylePickerTool::mouseMove(const TPointD &pos, const TMouseEvent &e) {
  if (!m_passivePick.getValue()) return;
  /*--- PassiveにStyleを拾う機能 ---*/
  PaletteController *controller =
      TTool::getApplication()->getPaletteController();

  TImageP image    = getImage(false);
  TToonzImageP ti  = image;
  TVectorImageP vi = image;
  TXshSimpleLevel *level =
      getApplication()->getCurrentLevel()->getSimpleLevel();
  if ((!ti && !vi) || !level || !m_viewer->getGeometry().contains(pos)) {
    controller->notifyStylePassivePicked(-1, -1, -1);
    return;
  }

  int subsampling = level->getImageSubsampling(getCurrentFid());
  StylePicker picker(image);
  TPointD pickPos(TScale(1.0 / subsampling) * pos + TPointD(-0.5, -0.5));
  int inkStyleId =
      picker.pickStyleId(pickPos, getPixelSize() * getPixelSize(), 1);
  int paintStyleId =
      picker.pickStyleId(pickPos, getPixelSize() * getPixelSize(), 0);
  int tone = picker.pickTone(pickPos);
  controller->notifyStylePassivePicked(inkStyleId, paintStyleId, tone);
}
예제 #9
0
void Projectile::update() {
	x += xDir * speed;
	y += yDir * speed;
	if(abs(xDir) > 0) {
		pixelsTravellable -= (int)(abs(xDir) * speed);
	} else if(abs(yDir) > 0) {
		pixelsTravellable -= (int)(abs(yDir) * speed);
	} else {
		pixelsTravellable--;
	}

	for(int index = 0; index < 2; index++) {
		if(currentRotation > rotation) {
			currentRotation -= 5;
		} else if(currentRotation < rotation) {
			currentRotation += 5;
		}
	}

	RotateSprite(texture, currentRotation);
	MoveSprite(texture, x, y);

	if(pixelsTravellable <= 0) {
		getApplication()->removeDrawable(this);
		return;
	}
}
void FullColorBrushTool::onEnter()
{
	TImageP img = getImage(false);
	TRasterImageP ri(img);
	if (ri) {
		m_minThick = m_thickness.getValue().first;
		m_maxThick = m_thickness.getValue().second;
	} else {
		m_minThick = 0;
		m_maxThick = 0;
	}
	Application *app = getApplication();
	if (app->getCurrentObject()->isSpline()) {
		m_currentColor = TPixel32::Red;
		return;
	}

	TPalette *plt = app->getCurrentPalette()->getPalette();
	if (!plt)
		return;

	int style = app->getCurrentLevelStyleIndex();
	TColorStyle *colorStyle = plt->getStyle(style);
	m_currentColor = colorStyle->getMainColor();
}
예제 #11
0
파일: aboutdlg.cpp 프로젝트: bdbdonp/tubras
TAboutDlg::TAboutDlg(IGUIEnvironment* environment, IGUIElement* parent) : 
TGUIDialog(environment, parent, -1, TRecti(0,0,500,400), (TDialogButtons)0, true, true, false)
{
    setText(L"About");

    TGUIImage* image = getApplication()->addGUIImage("tex/iwalktest/iwalktest.png",
        -1.f, 40.f, -1.f, -1.f, false, this);
    if(image)
        addChild(image);


    addText(environment, 0, "Copyright (C) 2011, Tubras LTD", 0xFF770000);
    addText(environment, 1, "(http://code.google.com/p/tubras)", 0xFF770000);

    addText(environment, 3, "Rendering by Irrlicht 3d Engine");
    addText(environment, 4, "Copyright (C) 2002-2011 Nikolaus Gebhard", 0xFF007700);
    addText(environment, 5, "(http://irrlicht.sourceforge.net)", 0xFF007700);

    addText(environment, 7, "Physics by Bullet");
    addText(environment, 8, "Copyright (C) 2011 Erwin Coumans", 0xFF000077);
    addText(environment, 9, "(http://bulletphysics.org)", 0xFF000077);

    u32 xpos = (AbsoluteRect.getWidth() / 2) - 50;
    u32 ypos = AbsoluteRect.getHeight() - 75;
    environment->addButton(TRecti(xpos, ypos, xpos+100, ypos + 32), this, TID_DLG_CANCEL, L"Okey-dokey");
}
예제 #12
0
    //-----------------------------------------------------------------------
    //                       c a l l S t a t e F u n c
    //-----------------------------------------------------------------------
    int TScriptState::callStateFunc(int ref)
    {
        int result=0;

        if(ref <= 0)
            return 0;

        lua_rawgeti(m_lua, LUA_REGISTRYINDEX, ref);
        if(lua_type(m_lua,-1) != LUA_TFUNCTION)
            return 0;

        // call the function
        if (lua_pcall(m_lua, 0, 1, 0) != 0)
        {
            getApplication()->logMessage(LOG_ERROR, "Error calling function TScriptState:: %d %s",
                ref, lua_tostring(m_lua, -1));
            return 1;
        }

        if(lua_isnumber(m_lua, -1))
        {
            result = lua_tointeger(m_lua, -1);
        }

        lua_pop(m_lua, 1);  

        return result;
    }
예제 #13
0
void Demo4State::update(double dtime)
{
    //Update background sprite
    double gameSpeed = 50.; //move 50 pixel / second
    sf::Vector2f gameOffset(0., -gameSpeed * dtime);
    mBackgroundTextRect += gameOffset;
    mBackgroundSprite.setTextureRect(sf::IntRect(mBackgroundTextRect.x, 
            mBackgroundTextRect.y, 800, 600));
    
    //Update fighter position
    double fighterSpeed = 600.;
    sf::Vector2f mousePosition = getApplication()->getMousePosition();
    sf::Vector2f currentPosition = mFighterSprite.getPosition();
    sf::Vector2f center = currentPosition;
    center.x += 95./2.;
    center.y += 151./2.;
    sf::Vector2f move = mousePosition - center;
    double distance = std::sqrt(move.x * move.x + move.y * move.y);
    if (distance >= 5.)
    {
        move.x = move.x / distance * fighterSpeed * dtime;
        move.y = move.y / distance * fighterSpeed * dtime;
        sf::Vector2f destination = currentPosition + move;
        destination.x = std::max(0.f, destination.x);
        destination.x = std::min(800.f-95.f, destination.x);
        destination.y = std::max(0.f, destination.y);
        destination.y = std::min(600.f-151.f, destination.y);
        mFighterSprite.setPosition(destination);
    }  
}
예제 #14
0
LRESULT AVIPreview::onChangeMenu(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
	if (ctrlCommands.GetSelectedCount() == 1)
	{
		int sel = ctrlCommands.GetSelectedIndex();
		const auto pa = FavoriteManager::getInstance()->getPreviewApp(sel);
		if (pa)
		{
			PreviewDlg dlg;
			dlg.name = Text::toT(pa->getName());
			dlg.application = Text::toT(pa->getApplication());
			dlg.argument = Text::toT(pa->getArguments());
			dlg.extensions = Text::toT(pa->getExtension());
			
			if (dlg.DoModal() == IDOK)
			{
				pa->setName(Text::fromT(dlg.name));
				pa->setApplication(Text::fromT(dlg.application));
				pa->setArguments(Text::fromT(dlg.argument));
				pa->setExtension(Text::fromT(dlg.extensions));
				
				ctrlCommands.SetItemText(sel, 0, dlg.name.c_str());
				ctrlCommands.SetItemText(sel, 1, dlg.application.c_str());
				ctrlCommands.SetItemText(sel, 2, dlg.argument.c_str());
				ctrlCommands.SetItemText(sel, 3, dlg.extensions.c_str());
			}
		}
	}
	
	return 0;
}
예제 #15
0
    //-----------------------------------------------------------------------
    //                              a d d I t e m
    //-----------------------------------------------------------------------
    u32 TTextOverlay::addItem(const TString& text,TTextAlignment a, TColor color,
        TColor bgColor)
    {

        s32 offset = 0;
        int idx;
        IGUIEnvironment* mgr = getApplication()->getGUIManager();
        IGUIFont* font=m_panel->getOverrideFont();
        if(!font)
            font = mgr->getSkin()->getFont();

        TRecti apos = m_panel->getAbsolutePosition();

        idx = (int)m_textItems.size();
        TStrStream name;		
        name << m_name.c_str() << "-item" << idx+1;

        TStringW wstr = text.c_str();

        s32 cheight = font->getDimension(L"Ay").Height;
        cheight += font->getKerningHeight();

        TRecti tdim(0,0,apos.getWidth(),cheight);
        
        TTextElement* textArea = mgr->addStaticText(wstr.c_str(),tdim,false,false,m_panel);
        textArea->move(position2di(0,cheight*idx));
        textArea->setOverrideFont(font);
        textArea->setOverrideColor(color);
        textArea->setBackgroundColor(bgColor);

        offset = idx * (cheight);
        s32 theight = ((idx+1) * cheight) + (m_margins.Height * 2);

        EGUI_ALIGNMENT oa=EGUIA_UPPERLEFT;

        switch(a)
        {
        case taLeft:
            oa = EGUIA_UPPERLEFT;
            break;
        case taCenter:
            oa = EGUIA_CENTER;
            break;
        case taRight:
            oa = EGUIA_LOWERRIGHT;
            break;
        };

        textArea->setTextAlignment(oa,EGUIA_UPPERLEFT);

        m_panel->addChild(textArea);
        m_textItems.push_back(textArea);

        if(apos.getHeight() < theight)     
        {
            m_panel->setMinSize(TDimensionu(0,theight));
        }

        return m_textItems.size()-1;
    }
void FullColorBrushTool::onActivate()
{
	if (!m_notifier)
		m_notifier = new FullColorBrushToolNotifier(this);

	TTool::Application *app = getApplication();

	if (app->getCurrentObject()->isSpline()) {
		m_currentColor = TPixel32::Red;
		return;
	}

	int styleIndex = app->getCurrentLevelStyleIndex();
	TPalette *plt = app->getCurrentPalette()->getPalette();
	if (plt) {
		int style = app->getCurrentLevelStyleIndex();
		TColorStyle *colorStyle = plt->getStyle(style);
		m_currentColor = colorStyle->getMainColor();
	}

	if (m_firstTime) {
		m_firstTime = false;
		m_thickness.setValue(TIntPairProperty::Value(FullcolorBrushMinSize, FullcolorBrushMaxSize));
		m_pressure.setValue(FullcolorPressureSensibility ? 1 : 0);
		m_opacity.setValue(TDoublePairProperty::Value(FullcolorMinOpacity, FullcolorMaxOpacity));
		m_hardness.setValue(FullcolorBrushHardness);
	}

	m_brushPad = ToolUtils::getBrushPad(m_thickness.getValue().second, m_hardness.getValue() * 0.01);
	setWorkAndBackupImages();
}
예제 #17
0
파일: TTask.cpp 프로젝트: bdbdonp/tubras
    //-----------------------------------------------------------------------
    //                               s t o p
    //-----------------------------------------------------------------------
    void TTask::stop()
    {
        if(!m_isRunning)
            return;

        m_isRunning = false;
        getApplication()->getTaskManager()->stop(this);
    }
예제 #18
0
        void AnimationBoot::start(Callback callback)
        {
            animationSystem_ = new Graphics::Render::AnimationSystem(
            getApplication().getEcsWorld(),
            getApplication().getEventManager().getEventQueue()
            );
            animationSystem_->registerListeners(
            getApplication().getEventManager().getListenerRegister()
            );

            std::vector<Threading::ThreadableInterface*> animThreadables;
            animThreadables.push_back(animationSystem_);

            setThread(new Threading::Thread(animThreadables, 60));
            getThread().start();
            callback();
        }
예제 #19
0
void Powerup::update() {
	MoveSprite(texture, (float)x, (float)y);
	timeLeft--;
	if(timeLeft <= 0) {
		getApplication()->removeDrawable(this);
		return;
	}
}
예제 #20
0
bool SlaveConfig::mapData(const uint128_t& initID)
{
    LBASSERT(!_objects);

    _objects = new ObjectMap(*this, *getApplication());
    const uint32_t request =
        mapObjectNB(_objects, initID, co::VERSION_OLDEST, getApplicationNode());
    return mapObjectSync(request);
}
예제 #21
0
파일: TTask.cpp 프로젝트: bdbdonp/tubras
    //-----------------------------------------------------------------------
    //                              s t a r t
    //-----------------------------------------------------------------------
    void TTask::start()
    {
        if(m_isRunning)
            return;

        m_isRunning = true;
        getApplication()->getTaskManager()->start(this);

    }
예제 #22
0
bool getAcadMenuGroup(IAcadMenuGroup  **pVal)
{

    IAcadApplication *acadApp = NULL;
    LPDISPATCH  pDisp = NULL;

    if (!getApplication(&pDisp))
        return false;

    HRESULT hr = S_OK;
    hr = pDisp->QueryInterface(IID_IAcadApplication, (LPVOID*)&acadApp);
    if (FAILED(hr))
        return false;


    LPDISPATCH  pTempDisp = NULL;
    IAcadMenuGroups *mnuGrps = NULL;
    long cnt = 0;

    //get the menu groups
    hr = acadApp->get_MenuGroups(&mnuGrps);
    if (FAILED(hr))
    {
        acadApp->Release();
        return false;
    }
    mnuGrps->get_Count(&cnt);


    //get AutoCAD menu group. say it is index 0.
    IAcadMenuGroup *mnuGrp = NULL;

    VARIANT  vtName;
    vtName.vt = VT_I4;
    BSTR  grpName;
    bool found = false ;
    for (long i=0; i < cnt; i++)
    {
        vtName.lVal = i;
        hr = mnuGrps->Item(vtName, &mnuGrp);
        if (FAILED(hr))
            return false;


        hr  = mnuGrp->get_Name(&grpName);
        CString cgrpName(grpName);
        if (cgrpName.CompareNoCase("Acad")==0)
        {
            found = true;
            *pVal = mnuGrp;
            break;
        }
    }

    acadApp->Release();
    return found;
}
예제 #23
0
파일: User.cpp 프로젝트: Caraul/airgit
string Identity::getTag() const noexcept {
	if(!get("TA").empty())
		return get("TA");
	if(get("VE").empty() || get("HN").empty() || get("HR").empty() || get("HO").empty() || get("SL").empty())
		return Util::emptyString;

	return "<" + getApplication() + ",M:" + getV4ModeString() + getV6ModeString() + 
		",H:" + get("HN") + "/" + get("HR") + "/" + get("HO") + ",S:" + get("SL") + ">";
}
예제 #24
0
 //-----------------------------------------------------------------------
 //                       ~ T P h y s i c s O b j e c t
 //-----------------------------------------------------------------------
 TPhysicsObject::~TPhysicsObject()
 {
     if(m_rigidBody)
     {
         getApplication()->getPhysicsManager()->getBulletWorld()->removeRigidBody(m_rigidBody);
         delete m_rigidBody;
     }
     if(m_shape)
         delete m_shape;
 }
예제 #25
0
    void AnimationBoot::cleanUp()
    {
        if (animationSystem_ != NULL)
        {
            animationSystem_->unregisterListeners(
                getApplication().getEventManager().getListenerRegister()
                );

                delete animationSystem_;
            }
        }
예제 #26
0
파일: TOverlay.cpp 프로젝트: bdbdonp/tubras
    //-----------------------------------------------------------------------
    //                          T O v e r l a y
    //-----------------------------------------------------------------------
    TOverlay::TOverlay(TString name, TRectf dims, TColor color) : TDelegate()
    {


        m_name = name;
        m_dims = dims;
        m_panel = getApplication()->getGUIManager()->addStaticText(L"",rect<s32>(0,0,0,0));
        setColor(color);

        m_panel->setRelativePositionProportional(dims);

    }
예제 #27
0
bool Pipe::configExit()
{
    _unmapData();

    if( _renderer )
    {
        getRendererImpl()->setPipe( 0 );
        getApplication()->destroyRenderer( _renderer );
    }
    _renderer = 0;

    return eq::Pipe::configExit();
}
예제 #28
0
/*
  If the working palette is changed, then deactivate the "organize palette"
  toggle.
*/
void StylePickerTool::onImageChanged() {
  std::cout << "StylePickerTool::onImageChanged" << std::endl;
  if (!m_organizePalette.getValue() || !m_paletteToBeOrganized) return;

  TXshLevel *level = getApplication()->getCurrentLevel()->getLevel();
  if (!level) {
    m_organizePalette.setValue(false);
    getApplication()->getCurrentTool()->notifyToolChanged();
    return;
  }
  TPalette *pal = NULL;
  if (level->getType() == PLT_XSHLEVEL)
    pal = level->getPaletteLevel()->getPalette();
  else if (level->getSimpleLevel()) {
    pal = level->getSimpleLevel()->getPalette();
  }
  if (!pal || pal != m_paletteToBeOrganized) {
    m_organizePalette.setValue(false);
    getApplication()->getCurrentTool()->notifyToolChanged();
    return;
  }
}
예제 #29
0
void TTool::invalidate(const TRectD &rect) {
  if (m_viewer) {
    if (rect.isEmpty())
      m_viewer->GLInvalidateAll();
    else {
      TPointD dpiScale(1, 1);
      TXshSimpleLevel *sl =
          getApplication()->getCurrentLevel()->getSimpleLevel();
      if (sl) dpiScale = getCurrentDpiScale(sl, getCurrentFid());
      m_viewer->GLInvalidateRect(getCurrentColumnMatrix() *
                                 TScale(dpiScale.x, dpiScale.y) * rect);
    }
  }
}
예제 #30
0
bool StylePickerTool::onPropertyChanged(std::string propertyName) {
  if (propertyName == m_organizePalette.getName()) {
    if (m_organizePalette.getValue()) {
      if (!startOrganizePalette()) {
        m_organizePalette.setValue(false);
        getApplication()->getCurrentTool()->notifyToolChanged();
        return false;
      }
    } else {
      std::cout << "End Organize Palette" << std::endl;
      m_paletteToBeOrganized = NULL;
    }
  }
  return true;
}