コード例 #1
0
ファイル: MyConst.cpp プロジェクト: wuyutaott/TestBox2D
Pos Pos::right()
{
    return Pos(lx + 1, ly);
}
コード例 #2
0
ファイル: Widget.cpp プロジェクト: BackupTheBerlios/utgs-svn
// Gets Absolute Rectangle
Rect Widget::GetAbsoluteRect (const Rect &rect) const
{
    return rect + GetAbsolutePos( Pos(0,0) );
}
コード例 #3
0
wxObject* wxsBitmapButton::OnBuildPreview(wxWindow* Parent,long Flags)
{
    wxBitmapButton* Preview = new wxBitmapButton(Parent,GetId(),BitmapLabel.GetPreview(wxDefaultSize),Pos(Parent),Size(Parent),Style());

    if ( !BitmapDisabled.IsEmpty() )
    {
        Preview->SetBitmapDisabled(BitmapDisabled.GetPreview(wxDefaultSize));
    }

    if ( !BitmapSelected.IsEmpty() )
    {
        Preview->SetBitmapSelected(BitmapSelected.GetPreview(wxDefaultSize));
    }

    if ( !BitmapFocus.IsEmpty() )
    {
        Preview->SetBitmapFocus(BitmapFocus.GetPreview(wxDefaultSize));
    }

    if ( IsDefault )
    {
        Preview->SetDefault();
    }
    return SetupWindow(Preview,Flags);
}
コード例 #4
0
ファイル: linestring.cpp プロジェクト: albar965/atools
void LineString::append(float longitudeX, float latitudeY, float alt)
{
  QList::append(Pos(longitudeX, latitudeY, alt));
}
コード例 #5
0
ファイル: move.cpp プロジェクト: KDE/knights
void Move::setFrom(int first, int second) {
	setFrom(Pos(first, second ));
}
コード例 #6
0
ファイル: Client.cpp プロジェクト: southor/planet
	void Client::runStep()
	{
		assert(isConsistent());
		
		link.retrieve(getTimeHandler()->getTime());

		getTimeHandler()->nextStep();
		if (connectionPhase == ClientPhase::RUNNING)
		{
			if (getTimeHandler()->isNewTick())
			{
				if ((static_cast<int>(getTimeHandler()->getStepTick()) % (6000/TimeHandler::TICK_DELTA_TIME)) == 0)
				{
					debugPrintState();
				}
				
				assert(predictionHandler->isConsistent());
				
				int currentTick = static_cast<int>(getStepTick());
				
				// calculate current objectLag
				this->currentObjLag = calcCurrentObjLag();

				// get userCmd
				UserCmd userCmd;
				getCurrentUserCmd(userCmd);
				userCmd.objLag = this->currentObjLag; // send currentObjLag to server
				
				// store userCmd
				predictionHandler->setUserCmd(userCmd, currentTick);
				
				// push userCmd to serverlink
				link.pushMessage(userCmd, getTimeHandler()->getTime(), currentTick);

				// transmit messages
				link.transmit();

				//perform shooting
				PlayerObj *playerObj = (worldModel.getPlayerObjs())[playerId];
				playerObj->updateToTickData(currentTick);
				playerObj->setUserCmd(&userCmd);
				worldModel.handlePlayerShooting(playerId, configHandler.getIntValue("client_create_projectile", CLIENT_CREATE_PROJECTILE_DEFAULT) == 1);

				// perform prediction
				predictionHandler->predict(currentTick + 1);

				// remove projectiles that have hit something
				std::vector<GameObjId> projectileRemoves;
				WorldModel::Projectiles::Iterator projectilesIt(worldModel.getProjectiles().begin());
				WorldModel::Projectiles::Iterator projectilesEnd(worldModel.getProjectiles().end());
				for(; projectilesIt != projectilesEnd; ++projectilesIt)
				{
					GameObjId projectileId = projectilesIt->first;
					Projectile *projectile = projectilesIt->second;
					
					// predict hits of own projectiles
					if ((projectile->getShooterId() == static_cast<GameObjId>(playerId)) && configHandler.getIntValue("client_remove_projectile", CLIENT_REMOVE_PROJECTILE_DEFAULT) == 1)
					{
						projectile->updateToTickData(currentTick - 1);
						
						ProjectileHit projectileHit(projectileId, Pos(0.0f, 0.0f));						
						if (worldModel.performProjectileHit(projectileId, projectileHit))
						{
							projectile->setHit(currentTick, projectileHit.hitPosition);
						}
					}
					
					// check hits and remove them later
					int checkTick = currentTick;
					if (projectile->getShooterId() != static_cast<GameObjId>(playerId)) checkTick -= this->currentObjLag;					
					if (projectile->getHitTick() <= checkTick)
						projectileRemoves.push_back(projectileId);
				}
				for(size_t removeId = 0; removeId < projectileRemoves.size(); ++removeId)
				{
					projectileHit(projectileRemoves[removeId]);
				}
			}
			else
			{
				requestRender = true;
			}
		}
		else
		{
			handleServerMessages();
		}
	}
コード例 #7
0
ファイル: Block.hpp プロジェクト: Cadaeiz/Tetris
	Pos operator*(int scale) { return Pos(x*scale,y*scale);}
コード例 #8
0
ファイル: tutorial45.cpp プロジェクト: GLDemos/ogldev-glsl130
    bool Init()
    {
   //    Vector3f Pos(0.0f, 23.0f, -5.0f);
  //      Vector3f Target(-1.0f, 0.0f, 0.1f);
        Vector3f Pos(0.0f, 24.0f, -38.0f);
        Vector3f Target(0.0f, -0.5f, 1.0f);

        Vector3f Up(0.0, 1.0f, 0.0f);

        m_pGameCamera = new Camera(WINDOW_WIDTH, WINDOW_HEIGHT, Pos, Target, Up);

        if (!m_geomPassTech.Init()) {
            OGLDEV_ERROR("Error initializing the geometry pass technique\n");
            return false;
        }

        if (!m_SSAOTech.Init()) {
            OGLDEV_ERROR("Error initializing the SSAO technique\n");
            return false;
        }

        m_SSAOTech.Enable();
        m_SSAOTech.SetSampleRadius(1.5f);
        Matrix4f PersProjTrans;
        PersProjTrans.InitPersProjTransform(m_persProjInfo);
        m_SSAOTech.SetProjMatrix(PersProjTrans);

        if (!m_lightingTech.Init()) {
            OGLDEV_ERROR("Error initializing the lighting technique\n");
            return false;
        }
        
        m_lightingTech.Enable();
        m_lightingTech.SetDirectionalLight(m_directionalLight);
        m_lightingTech.SetScreenSize(WINDOW_WIDTH, WINDOW_HEIGHT);
        m_lightingTech.SetShaderType(0);
        
        if (!m_blurTech.Init()) {
            OGLDEV_ERROR("Error initializing the blur technique\n");
            return false;
        }                
        
        //if (!m_mesh.LoadMesh("../Content/crytek_sponza/sponza.obj")) {
        if (!m_mesh.LoadMesh("../Content/jeep.obj")) {
            return false;            
        }        
     
        m_mesh.GetOrientation().m_scale = Vector3f(0.05f);
        m_mesh.GetOrientation().m_pos = Vector3f(0.0f, 0.0f, 0.0f);
        m_mesh.GetOrientation().m_rotation = Vector3f(0.0f, 180.0f, 0.0f);
        
        if (!m_quad.LoadMesh("../Content/quad.obj")) {
            return false;
        }
        
        if (!m_gBuffer.Init(WINDOW_WIDTH, WINDOW_HEIGHT, true, GL_RGB32F)) {
            return false;
        }

        if (!m_aoBuffer.Init(WINDOW_WIDTH, WINDOW_HEIGHT, false, GL_R32F)) {
            return false;
        }

        if (!m_blurBuffer.Init(WINDOW_WIDTH, WINDOW_HEIGHT, false, GL_R32F)) {
            return false;
        }
        
#ifndef WIN32
        if (!m_fontRenderer.InitFontRenderer()) {
            return false;
        }
#endif        	      
        return true;
    }
コード例 #9
0
Resource *
CreateDropDown( XMLIterator i, XMLCreatorEnv *env )
{
    XMLCreatorEnv ch_env;
    const char *p_name = "create dropdown";
    BeginParentWidget( env, p_name, ch_env );
    
    XMLAttributes attributes;
    XMLStyle      branch_style;
    CascadeStyles( i, env, attributes, branch_style, ch_env);

    // skins & fonts for caption
    std::string skinName = get_attribute( attributes, "title_skin");
    std::string fontName = get_attribute( attributes, "title_font");
    
    SkinMan &skins = QuerySkinMan( skinName );
    FontSet &fonts = QueryFontSet( fontName );

    // caption position
    int titleAlign = 0;    
    try_attribute_i( attributes, "title_align", &titleAlign );
    
    std::vector<int> pos = to_integer_vector( "0,0" );
    std::string position;   
    if ( try_attribute( attributes, "title_distance", &position ) )
    {
        pos = to_integer_vector( position );
        if ( pos.size() != 2 ) { throw Error("pos attribute must have x and y coordinates"); }
    }
    
    CaptionStyle style( skins, fonts, titleAlign, Pos(pos[0], pos[1]) );

    
    // temporary hub for child widget
    SPointer<HubWidget> ptr = new HubWidget( 100, 100 );
    ch_env["parent_hub"] = ptr.get();

    // create child element
    ChildsFromXML( i, &ch_env );
   
    if( ptr->ChildrenCount() != 1 )
        throw Error("DropDown widget %s must have one and only content.", (*i)._name.c_str());

    Widget *content = ptr->FirstChild();
    ptr->Retrieve( content );

    if ( IWList *p_items = dynamic_cast< IWList *>( content ))
    {
        typedef DropButton< ListMenu, RadioLogic > ListMenuButton;
        
        ListMenu *lm = new ListMenuButton( style, p_items );
        p_items->Items().SetFollowMode( ListLogic::FULL_FOLLOW );
        p_items->Items().AllwaysSelected( 1 );
        
        InsertChildWidget( lm, attributes, env );
        SetHint( lm, attributes ); 
        return new AnyResource< Widget *>( lm );
    }
    else if ( IWTableList *p_table = dynamic_cast< IWTableList *>( content ))
    {
        Share< DataConnector > dataCon =
            dynamic_cast< DataTableWidget &>( p_table->Table() )
                .GetDataConnector();
        
        typedef DropButton< TableMenu, RadioLogic > TableMenuButton;
        TableMenu *tm = new TableMenuButton( style, p_table, dataCon.GetTarget() );
        
        dynamic_cast< ListLogic &>( p_table->Enumerator() )
            .SetFollowMode( ListLogic::FULL_FOLLOW );
        dynamic_cast< ListLogic &>( p_table->Enumerator() )
            .AllwaysSelected( 1 );
        
        InsertChildWidget( tm, attributes, env );
        SetHint( tm, attributes ); 
        return new AnyResource< Widget *>( tm );
    }

    return NULL;
}
コード例 #10
0
ファイル: radiobutton.c プロジェクト: hbao/LCUI
/* 初始化单选框部件的数据 */
static void 
RadioButton_Init( LCUI_Widget widget )
{
	int valid_state;
	LCUI_Widget container[2];
	LCUI_RadioButton *radio_button;
	
	radio_button = Widget_NewPrivData(widget, sizeof(LCUI_RadioButton));
	radio_button->on = FALSE;
	/* 初始化图片数据 */ 
	Graph_Init(&radio_button->img_off_disable);
	Graph_Init(&radio_button->img_off_normal);
	Graph_Init(&radio_button->img_off_focus);
	Graph_Init(&radio_button->img_off_down);
	Graph_Init(&radio_button->img_off_over);
	Graph_Init(&radio_button->img_on_disable);
	Graph_Init(&radio_button->img_on_normal);
	Graph_Init(&radio_button->img_on_focus);
	Graph_Init(&radio_button->img_on_down);
	Graph_Init(&radio_button->img_on_over);
	
	radio_button->mutex = NULL;
	
	radio_button->label = Widget_New("label");/* 创建label部件 */
	radio_button->imgbox = Widget_New("picture_box"); /* 创建图像框部件 */
	/* 创建两个容器,用于调整上面两个部件的位置 */
	container[0] = Widget_New(NULL);
	container[1] = Widget_New(NULL);
	
	/* 启用这些部件的自动尺寸调整的功能 */
	Widget_SetAutoSize( widget, TRUE, AUTOSIZE_MODE_GROW_AND_SHRINK );
	Widget_SetAutoSize( container[0], TRUE, AUTOSIZE_MODE_GROW_AND_SHRINK );
	Widget_SetAutoSize( container[1], TRUE, AUTOSIZE_MODE_GROW_AND_SHRINK );
	
	Widget_Container_Add(container[0], radio_button->imgbox);
	Widget_Container_Add(container[1], radio_button->label);
	Widget_Container_Add(widget, container[0]);
	Widget_Container_Add(widget, container[1]);
	
	/* 调整尺寸 */
	Widget_Resize(radio_button->imgbox, Size(15, 15));
	/* 调整布局 */
	Widget_SetAlign(container[0], ALIGN_MIDDLE_LEFT, Pos(0,0));
	Widget_SetAlign(container[1], ALIGN_MIDDLE_LEFT, Pos(17,0));
	Widget_SetAlign(radio_button->imgbox, ALIGN_MIDDLE_CENTER, Pos(0,0));
	Widget_SetAlign(radio_button->label, ALIGN_MIDDLE_CENTER, Pos(0,0));
	
	PictureBox_SetSizeMode(radio_button->imgbox, SIZE_MODE_STRETCH);
	
	/* 显示之 */
	Widget_Show(radio_button->label);
	Widget_Show(radio_button->imgbox);
	Widget_Show(container[0]);
	Widget_Show(container[1]);
	
	Widget_ConnectEvent( widget, EVENT_CLICKED, RadioButton_Click );
	
	valid_state = (WIDGET_STATE_NORMAL | WIDGET_STATE_ACTIVE);
	valid_state |= (WIDGET_STATE_DISABLE | WIDGET_STATE_OVERLAY);
	Widget_SetValidState( widget, valid_state);
}
コード例 #11
0
/*
 * nbodyGravity: Walk the tree starting at the root to do force
 * calculations.
 *
 *
 * Random notes:
 *   - Not inlined without inline from multiple calls in
 *     mapForceBody(). Measurably better with the inline, but only
 *     slightly.
 */
static inline mwvector nbGravity(const NBodyCtx* ctx, NBodyState* st, const Body* p)
{
    mwbool skipSelf = FALSE;

    mwvector pos0 = Pos(p);
    mwvector acc0 = ZERO_VECTOR;

    const NBodyNode* q = (const NBodyNode*) st->tree.root; /* Start at the root */

    while (q != NULL)               /* while not at end of scan */
    {
        mwvector dr = mw_subv(Pos(q), pos0);   /* Then compute distance */
        real drSq = mw_sqrv(dr);               /* and distance squared */

        if (isBody(q) || (drSq >= Rcrit2(q)))      /* If is a body or far enough away to approximate */
        {
            if (mw_likely((const Body*) q != p))   /* self-interaction? */
            {
                real drab, phii, mor3;

                /* Compute gravity */

                drSq += ctx->eps2;   /* use standard softening */
                drab = mw_sqrt(drSq);
                phii = Mass(q) / drab;
                mor3 = phii / drSq;

                acc0.x += mor3 * dr.x;
                acc0.y += mor3 * dr.y;
                acc0.z += mor3 * dr.z;

                if (ctx->useQuad && isCell(q))          /* if cell, add quad term */
                {
                    real dr5inv, drQdr, phiQ;
                    mwvector Qdr;

                    /* form Q * dr */
                    Qdr.x = Quad(q).xx * dr.x + Quad(q).xy * dr.y + Quad(q).xz * dr.z;
                    Qdr.y = Quad(q).xy * dr.x + Quad(q).yy * dr.y + Quad(q).yz * dr.z;
                    Qdr.z = Quad(q).xz * dr.x + Quad(q).yz * dr.y + Quad(q).zz * dr.z;


                    /* form dr * Q * dr */
                    drQdr = Qdr.x * dr.x + Qdr.y * dr.y + Qdr.z * dr.z;

                    dr5inv = 1.0 / (sqr(drSq) * drab);  /* form dr^-5 */

                    /* get quad. part of phi */
                    phiQ = 2.5 * (dr5inv * drQdr) / drSq;

                    acc0.x += phiQ * dr.x;
                    acc0.y += phiQ * dr.y;
                    acc0.z += phiQ * dr.z;

                    /* acceleration */
                    acc0.x -= dr5inv * Qdr.x;
                    acc0.y -= dr5inv * Qdr.y;
                    acc0.z -= dr5inv * Qdr.z;
                }
            }
            else
            {
                skipSelf = TRUE;   /* Encountered self */
            }

            q = Next(q);  /* Follow next link */
        }
        else
        {
             q = More(q); /* Follow to the next level if need to go deeper */
        }
    }

    if (!skipSelf)
    {
        /* If a body does not encounter itself in its traversal of the
         * tree, it is "tree incest" */

        nbReportTreeIncest(ctx, st);
    }

    return acc0;
}
コード例 #12
0
ファイル: wxsstaticbox.cpp プロジェクト: 469306621/Languages
wxObject* wxsStaticBox::OnBuildPreview(wxWindow* Parent,long Flags)
{
    wxStaticBox* Preview = new wxStaticBox(Parent,GetId(),Label,Pos(Parent),Size(Parent),Style());
    return SetupWindow(Preview,Flags);
}
コード例 #13
0
ファイル: DebugModeStatPrinter.cpp プロジェクト: blinkkin/ia
void DebugModeStatPrinter::run() {
  const string separator = "--------------------------------------------------";
  const string indent1 = " ";
  const string indent2 = indent1 + "      ";

  statFile.open("debug_mode_stats_file.txt", ios::trunc);
  printLine("This file was created because Infra Arcana was run in Debug mode\n");
  printLine("Created on   : " + eng->basicUtils->getCurrentTime().getTimeStr(time_minute, true));
  printLine("Game version : " + eng->config->GAME_VERSION);
  printLine("\n");

  printLine("SPELL MAX SPI COSTS");
  printLine(separator);
  for(int i = 0; i < endOfSpells; i++) {
    Spell* const spell = eng->spellHandler->getSpellFromId(Spell_t(i));
    string name = spell->getName();
    name.insert(name.end(), 24 - name.size(), ' ');
    Range cost = spell->getSpiCost(true, eng->player, eng);
    const string costStr =
      toString(cost.lower) + "-" + toString(cost.upper);
    delete spell;
    printLine(indent1 + name + costStr);
  }
  printLine("\n");

  vector<ActorData*> actorDataSorted;
  for(unsigned int i = actor_player + 1; i < endOfActorIds; i++) {
    actorDataSorted.push_back(&(eng->actorDataHandler->dataList[i]));
  }
  IsHigherSpawnMinLvl isHigherSpawnMinLvl;
  std::sort(actorDataSorted.begin(), actorDataSorted.end(), isHigherSpawnMinLvl);

  printLine("MONSTERS PER MIN DLVL");
  printLine(separator);
  printLine(indent1 + "LVL   NR");
  printLine(indent1 + "---------");

  vector<int> monstersPerMinDLVL(actorDataSorted.back()->spawnMinDLVL + 1, 0);
  for(unsigned int i = 0; i < actorDataSorted.size(); i++) {
    monstersPerMinDLVL.at(actorDataSorted.at(i)->spawnMinDLVL)++;
  }
  for(unsigned int i = 0; i < monstersPerMinDLVL.size(); i++) {
    const int LVL = i;
    string lvlStr = toString(LVL);
    lvlStr.insert(lvlStr.end(), 6 - lvlStr.size(), ' ');
    string nrStr = toString(monstersPerMinDLVL.at(i));
    nrStr.insert(nrStr.end(), 3, ' ');
    if(monstersPerMinDLVL.at(i) > 0) {
      nrStr.insert(nrStr.end(), monstersPerMinDLVL.at(i), '*');
    }
    printLine(indent1 + lvlStr + nrStr);
  }
  printLine("\n" + indent1 + "Total number of monsters: " +
            toString(actorDataSorted.size()));
  printLine("\n");

  printLine("STATS FOR EACH MONSTER");
  printLine(separator);
  printLine(indent1 + "Notes:");
  printLine(indent1 + "(U) = Unique monster");
  printLine(indent1 + "(M) = Melee weapon");
  printLine(indent1 + "(R) = Ranged weapon");
  printLine("");

  for(unsigned int i = 0; i < actorDataSorted.size(); i++) {
    ActorData& d = *(actorDataSorted.at(i));

    Actor* const actor = eng->actorFactory->makeActorFromId(d.id);
    actor->place(Pos(-1, -1), &d, eng);

    const string uniqueStr = d.isUnique ? " (U)" : "";
    printLine(indent1 + actor->getNameA() + uniqueStr);

    const string xpStr =
      "XP:" + toString(eng->dungeonMaster->getMonsterXpWorth(d));
    printLine(indent2 + xpStr);

    string hpStr = "HP:" + toString(d.hp);
    hpStr.insert(hpStr.end(), 8 - hpStr.size(), ' ');

    const int attackSkill = d.abilityVals.getVal(ability_accuracyMelee, false, *actor);
    const string attackSkillStr = "Attack skill:" + toString(attackSkill) + "%";
    printLine(indent2 + hpStr + attackSkillStr);

    const Inventory* const inv = actor->getInventory();
    const unsigned int NR_INTRINSIC_ATTACKS = inv->getIntrinsicsSize();
    for(unsigned int i_intr = 0; i_intr < NR_INTRINSIC_ATTACKS; i_intr++) {
      const Item* const item = inv->getIntrinsicInElement(i_intr);
      const ItemData& itemData = item->getData();
      const string meleeOrRangedStr = itemData.isRangedWeapon ? "(R)" : "(M)";
      const string attackNrStr = "Attack " + toString(i_intr + 1);
      const string dmgStr =
        toString(itemData.meleeDmg.first) + "d" +
        toString(itemData.meleeDmg.second);
      printLine(
        indent2 + attackNrStr + " " + meleeOrRangedStr + ": " + dmgStr);
    }
    delete actor;

    printLine("");
  }



  statFile.close();
}
コード例 #14
0
ファイル: map_patterns.cpp プロジェクト: tmo35/ia
void cells_in_room(const Room& room, std::vector<Pos>& adj_to_walls,
                   std::vector<Pos>& away_from_walls)
{
    TRACE_FUNC_BEGIN_VERBOSE;
    vector<Pos> pos_bucket;
    pos_bucket.clear();

    const Rect& r = room.r_;

    for (int x = r.p0.x; x <= r.p1.x; ++x)
    {
        for (int y = r.p0.y; y <= r.p1.y; ++y)
        {
            if (map::room_map[x][y] == &room)
            {
                auto* const f = map::cells[x][y].rigid;

                if (f->can_move_cmn() && f->can_have_rigid())
                {
                    pos_bucket.push_back(Pos(x, y));
                }
            }
        }
    }

    adj_to_walls.clear();
    away_from_walls.clear();

    for (Pos& pos : pos_bucket)
    {
        const int NR_BLK_R = walk_blockers_in_dir(Dir::right, pos);
        const int NR_BLK_D = walk_blockers_in_dir(Dir::down, pos);
        const int NR_BLK_L = walk_blockers_in_dir(Dir::left, pos);
        const int NR_BLK_U = walk_blockers_in_dir(Dir::up, pos);

        const bool IS_ZERO_BLK_ALL_DIR =
            NR_BLK_R == 0 && NR_BLK_D == 0 && NR_BLK_L == 0 && NR_BLK_U == 0;

        if (IS_ZERO_BLK_ALL_DIR)
        {
            away_from_walls.push_back(pos);
            continue;
        }

        bool is_door_adjacent = false;

        for (int dx = -1; dx <= 1; ++dx)
        {
            for (int dy = -1; dy <= 1; ++dy)
            {
                const auto* const f = map::cells[pos.x + dx][pos.y + dy].rigid;

                if (f->id() == Feature_id::door) {is_door_adjacent = true;}
            }
        }

        if (is_door_adjacent) {continue;}

        if (
            (NR_BLK_R == 3 && NR_BLK_U == 1 && NR_BLK_D == 1 && NR_BLK_L == 0) ||
            (NR_BLK_R == 1 && NR_BLK_U == 3 && NR_BLK_D == 0 && NR_BLK_L == 1) ||
            (NR_BLK_R == 1 && NR_BLK_U == 0 && NR_BLK_D == 3 && NR_BLK_L == 1) ||
            (NR_BLK_R == 0 && NR_BLK_U == 1 && NR_BLK_D == 1 && NR_BLK_L == 3))
        {
            adj_to_walls.push_back(pos);
            continue;
        }

    }

    TRACE_FUNC_END_VERBOSE;
}
コード例 #15
0
/*! \brief	Build the control preview.
 *
 * \param parent wxWindow*	The parent window.
 * \param flags long				The control flags.
 * \return wxObject* 				The constructed control.
 *
 */
wxObject* wxsTimePickerCtrl::OnBuildPreview(wxWindow* Parent,long Flags)
{
    wxTimePickerCtrl* Preview = new wxTimePickerCtrl(Parent,GetId(),wxDateTime::Now(),Pos(Parent),Size(Parent),Style());
    return SetupWindow(Preview,Flags);
}
コード例 #16
0
ファイル: pos.cpp プロジェクト: SSMN/MuseScore
Pos Pos::upSnaped(int raster) const
      {
      return Pos(tempo, sig, sig->raster2(tick(), raster));
      }
コード例 #17
0
namespace util {
    const Pos roundVectors[] = {
            Pos(1, 1),
            Pos(1, 0),
            Pos(1, -1),
            Pos(-1, 1),
            Pos(-1, 0),
            Pos(-1, -1),
            Pos(0, 1),
            Pos(0, -1),
    };
    const Pos unitVectors[] = {
            Pos(1, 0),
            Pos(-1, 0),
            Pos(0, 1),
            Pos(0, -1),
    };
}
コード例 #18
0
ファイル: pos.cpp プロジェクト: SSMN/MuseScore
Pos Pos::downSnaped(int raster) const
      {
      return Pos(tempo, sig, sig->raster1(tick(), raster));
      }
コード例 #19
0
ファイル: Block.hpp プロジェクト: Cadaeiz/Tetris
	Pos operator+(const Pos & p) { return Pos(x+p.x,y+p.y);}
コード例 #20
0
ファイル: a_movingcamera.cpp プロジェクト: floverdevel/zdoom
bool APathFollower::Interpolate ()
{
	DVector3 dpos(0, 0, 0);
	FLinkContext ctx;

	if ((args[2] & 8) && Time > 0.f)
	{
		dpos = Pos();
	}

	if (CurrNode->Next==NULL) return false;

	UnlinkFromWorld (&ctx);
	DVector3 newpos;
	if (args[2] & 1)
	{	// linear
		newpos.X = Lerp(CurrNode->X(), CurrNode->Next->X());
		newpos.Y = Lerp(CurrNode->Y(), CurrNode->Next->Y());
		newpos.Z = Lerp(CurrNode->Z(), CurrNode->Next->Z());
	}
	else
	{	// spline
		if (CurrNode->Next->Next==NULL) return false;

		newpos.X = Splerp(PrevNode->X(), CurrNode->X(), CurrNode->Next->X(), CurrNode->Next->Next->X());
		newpos.Y = Splerp(PrevNode->Y(), CurrNode->Y(), CurrNode->Next->Y(), CurrNode->Next->Next->Y());
		newpos.Z = Splerp(PrevNode->Z(), CurrNode->Z(), CurrNode->Next->Z(), CurrNode->Next->Next->Z());
	}
	SetXYZ(newpos);
	LinkToWorld (&ctx);

	if (args[2] & 6)
	{
		if (args[2] & 8)
		{
			if (args[2] & 1)
			{ // linear
				dpos.X = CurrNode->Next->X() - CurrNode->X();
				dpos.Y = CurrNode->Next->Y() - CurrNode->Y();
				dpos.Z = CurrNode->Next->Z() - CurrNode->Z();
			}
			else if (Time > 0.f)
			{ // spline
				dpos = newpos - dpos;
			}
			else
			{
				int realarg = args[2];
				args[2] &= ~(2|4|8);
				Time += 0.1f;
				dpos = newpos;
				Interpolate ();
				Time -= 0.1f;
				args[2] = realarg;
				dpos = newpos - dpos;
				newpos -= dpos;
				SetXYZ(newpos);
			}
			if (args[2] & 2)
			{ // adjust yaw
				Angles.Yaw = dpos.Angle();
			}
			if (args[2] & 4)
			{ // adjust pitch; use floats for precision
				double dist = dpos.XY().Length();
				Angles.Pitch = dist != 0.f ? VecToAngle(dist, -dpos.Z) : 0.;
			}
		}
		else
		{
			if (args[2] & 2)
			{ // interpolate angle
				DAngle angle1 = CurrNode->Angles.Yaw.Normalized180();
				DAngle angle2 = angle1 + deltaangle(angle1, CurrNode->Next->Angles.Yaw);
				Angles.Yaw = Lerp(angle1.Degrees, angle2.Degrees);
			}
			if (args[2] & 1)
			{ // linear
				if (args[2] & 4)
				{ // interpolate pitch
					Angles.Pitch = Lerp(CurrNode->Angles.Pitch.Degrees, CurrNode->Next->Angles.Pitch.Degrees);
				}
			}
			else
			{ // spline
				if (args[2] & 4)
				{ // interpolate pitch
					Angles.Pitch = Splerp(PrevNode->Angles.Pitch.Degrees, CurrNode->Angles.Pitch.Degrees,
						CurrNode->Next->Angles.Pitch.Degrees, CurrNode->Next->Next->Angles.Pitch.Degrees);
				}
			}
		}
	}

	return true;
}
コード例 #21
0
bool
Camera::Padlock(const Point& target, double alimit, double e_lo, double e_hi)
{
	// No navel gazing:
	if (target == Pos())
	return false;

	Point tgt, tmp = target - Pos();

	// Rotate into the view orientation:
	tgt.x = (tmp * vrt());
	tgt.y = (tmp * vup());
	tgt.z = (tmp * vpn());

	if (tgt.z == 0) {
		Yaw(0.1);

		tgt.x = (tmp * vrt());
		tgt.y = (tmp * vup());
		tgt.z = (tmp * vpn());

		if (tgt.z == 0)
		return false;
	}

	bool   locked  = true;
	double az      = atan(tgt.x/tgt.z);
	double orig    = az;

	// if target is behind, offset by 180 degrees:
	if (tgt.z < 0)
	az -= PI;

	while (az >  PI) az -= 2*PI;
	while (az < -PI) az += 2*PI;

	if (alimit > 0) {
		if (az < -alimit) {
			az = -alimit;
			locked = false;
		}
		else if (az > alimit) {
			az = alimit;
			locked = false;
		}
	}

	Yaw(az);

	// Rotate into the new view orientation:
	tgt.x = (tmp * vrt());
	tgt.y = (tmp * vup());
	tgt.z = (tmp * vpn());

	double el      = atan(tgt.y/tgt.z);

	if (e_lo > 0 && el < -e_lo) {
		el = -e_lo;
		locked = false;
	}

	else if (e_hi > 0 && el > e_hi) {
		el = e_hi;
		locked = false;
	}

	Pitch(-el);

	return locked;
}
コード例 #22
0
ファイル: MyConst.cpp プロジェクト: wuyutaott/TestBox2D
Pos Pos::up()
{
    return Pos(lx, ly - 1);
}
コード例 #23
0
ファイル: linestring.cpp プロジェクト: albar965/atools
void LineString::append(double longitudeX, double latitudeY, double alt)
{
  QList::append(Pos(longitudeX, latitudeY, alt));
}
コード例 #24
0
ファイル: MyConst.cpp プロジェクト: wuyutaott/TestBox2D
Pos Pos::down()
{
    return Pos(lx, ly + 1);
}
コード例 #25
0
ファイル: move.cpp プロジェクト: KDE/knights
void Move::setTo(int first, int second) {
	d->to = Pos(first, second);
}
コード例 #26
0
ファイル: MyConst.cpp プロジェクト: wuyutaott/TestBox2D
Pos Pos::left()
{
    return Pos(lx - 1, ly);
}
コード例 #27
0
ファイル: Widget.cpp プロジェクト: BackupTheBerlios/utgs-svn
// Gets Relative Rectangle
Rect Widget::GetRelativeRect (const Rect &rect) const
{
    return rect + GetRelativePos( Pos(0,0) );
}
コード例 #28
0
/** 初始化键位设置窗口 */
void GameWindow_InitSetKeyboardWindow(void)
{
	/* 创建所需的GUI部件 */
	window = Widget_New("window");
	box = Widget_New(NULL);
	label = Widget_New("label");
	label_left = Widget_New("label");
	label_right = Widget_New("label");
	label_up = Widget_New("label");
	label_down = Widget_New("label");
	label_jump = Widget_New("label");
	label_defense = Widget_New("label");
	label_a_atk = Widget_New("label");
	label_b_atk = Widget_New("label");
	btn_left = Widget_New("button");
	btn_right = Widget_New("button");
	btn_up = Widget_New("button");
	btn_down = Widget_New("button");
	btn_a_atk = Widget_New("button");
	btn_b_atk = Widget_New("button");
	btn_jump = Widget_New("button");
	btn_defense = Widget_New("button");
	btn_ok = Widget_New("button");
	btn_reset = Widget_New("button");
	
	Widget_Container_Add( box, btn_left );
	Widget_Container_Add( box, btn_right );
	Widget_Container_Add( box, btn_up );
	Widget_Container_Add( box, btn_down );
	Widget_Container_Add( box, btn_jump );
	Widget_Container_Add( box, btn_defense );
	Widget_Container_Add( box, btn_a_atk );
	Widget_Container_Add( box, btn_b_atk );
	Widget_Container_Add( box, label_left );
	Widget_Container_Add( box, label_right );
	Widget_Container_Add( box, label_up );
	Widget_Container_Add( box, label_down );
	Widget_Container_Add( box, label_jump );
	Widget_Container_Add( box, label_defense );
	Widget_Container_Add( box, label_a_atk );
	Widget_Container_Add( box, label_b_atk );
	Window_ClientArea_Add( window, box );
	Window_ClientArea_Add( window, label );
	Window_ClientArea_Add( window, btn_ok );
	Window_ClientArea_Add( window, btn_reset );
	
	Widget_SetAutoSize( btn_left, FALSE, 0 );
	Widget_SetAutoSize( btn_right, FALSE, 0 );
	Widget_SetAutoSize( btn_up, FALSE, 0 );
	Widget_SetAutoSize( btn_down, FALSE, 0 );
	Widget_SetAutoSize( btn_jump, FALSE, 0 );
	Widget_SetAutoSize( btn_a_atk, FALSE, 0 );
	Widget_SetAutoSize( btn_b_atk, FALSE, 0 );
	Widget_SetAutoSize( btn_defense, FALSE, 0 );
	Widget_SetAutoSize( btn_ok, FALSE, 0 );

	Widget_Resize( btn_left, KEYBTN_SIZE );
	Widget_Resize( btn_right, KEYBTN_SIZE );
	Widget_Resize( btn_up, KEYBTN_SIZE );
	Widget_Resize( btn_down, KEYBTN_SIZE );
	Widget_Resize( btn_jump, KEYBTN_SIZE );
	Widget_Resize( btn_a_atk, KEYBTN_SIZE );
	Widget_Resize( btn_b_atk, KEYBTN_SIZE );
	Widget_Resize( btn_defense, KEYBTN_SIZE );
	Widget_Resize( btn_ok, BTN_SIZE );
	Widget_Resize( btn_reset, BTN_SIZE );
	
	Widget_Move( btn_left, Pos(0,50+22) );
	Widget_Move( btn_right, Pos(100,50+22) );
	Widget_Move( btn_up, Pos(50,0+22) );
	Widget_Move( btn_down, Pos(50,50+22) );
	Widget_Move( btn_jump, Pos(200,50+22) );
	Widget_Move( btn_a_atk, Pos(200,0+22) );
	Widget_Move( btn_b_atk, Pos(250,0+22) );
	Widget_Move( btn_defense, Pos(250,50+22) );
	
	Widget_Move( label_left, Pos(10,125) );
	Widget_Move( label_right, Pos(110,125) );
	Widget_Move( label_up, Pos(60,0) );
	Widget_Move( label_down, Pos(60,125) );
	Widget_Move( label_a_atk, Pos(210,0) );
	Widget_Move( label_b_atk, Pos(260,0) );
	Widget_Move( label_jump, Pos(210,125) );
	Widget_Move( label_defense, Pos(260,125) );

	UpdateKeyBtn();
	/* 设置各种文本 */
	Label_TextW( label_left, TEXT_LEFT );
	Label_TextW( label_right, TEXT_RIGHT );
	Label_TextW( label_up, TEXT_UP );
	Label_TextW( label_down, TEXT_DOWN );
	Label_TextW( label_jump, TEXT_JUMP );
	Label_TextW( label_defense, TEXT_DEFENSE );
	Label_TextW( label_a_atk, TEXT_A_ATK );
	Label_TextW( label_b_atk, TEXT_B_ATK );
	/* 设置窗口 */
	Widget_SetStyleID( window, WINDOW_STYLE_LINE );
	Widget_Resize( window, WINDOW_SIZE );
	Widget_SetPadding( Window_GetClientArea(window), Padding(10,10,10,10) );

	Label_TextW( label, TEXT_SET_KEYBOARD );
	Widget_SetBackgroundColor( label, RGB(255,255,255) );
	Widget_SetBackgroundTransparent( label, FALSE );

	Button_TextW( btn_ok, TEXT_OK );
	Button_TextW( btn_reset, TEXT_RESET );

	Widget_SetSize( box, "100%", "165px" );
	Widget_SetBorder( box, Border(1,BORDER_STYLE_SOLID,RGB(200,200,200)) );
	Widget_SetPadding( box, Padding(10,10,10,10) );

	Widget_SetAlign( box, ALIGN_TOP_CENTER, Pos(0,12) );
	Widget_SetAlign( label, ALIGN_TOP_CENTER, Pos(0,0) );
	Widget_SetAlign( btn_ok, ALIGN_BOTTOM_CENTER, Pos(-50,-5) );
	Widget_SetAlign( btn_reset, ALIGN_BOTTOM_CENTER, Pos(50,-5) );
	/* 为键位按钮连接事件 */
	Widget_ConnectEvent( btn_ok, EVENT_CLICKED, btn_ok_on_clicked );
	Widget_ConnectEvent( btn_reset, EVENT_CLICKED, btn_reset_on_clicked );
	Widget_ConnectEvent( btn_left, EVENT_CLICKED, btn_key_on_clicked );
	Widget_ConnectEvent( btn_right, EVENT_CLICKED, btn_key_on_clicked );
	Widget_ConnectEvent( btn_up, EVENT_CLICKED, btn_key_on_clicked );
	Widget_ConnectEvent( btn_down, EVENT_CLICKED, btn_key_on_clicked );
	Widget_ConnectEvent( btn_b_atk, EVENT_CLICKED, btn_key_on_clicked );
	Widget_ConnectEvent( btn_a_atk, EVENT_CLICKED, btn_key_on_clicked );
	Widget_ConnectEvent( btn_jump, EVENT_CLICKED, btn_key_on_clicked );
	Widget_ConnectEvent( btn_defense, EVENT_CLICKED, btn_key_on_clicked );
	
	Widget_Show( btn_left );
	Widget_Show( btn_right );
	Widget_Show( btn_up );
	Widget_Show( btn_down );
	Widget_Show( btn_jump );
	Widget_Show( btn_a_atk );
	Widget_Show( btn_b_atk );
	Widget_Show( btn_defense );
	Widget_Show( label_left );
	Widget_Show( label_right );
	Widget_Show( label_up );
	Widget_Show( label_down );
	Widget_Show( label_jump );
	Widget_Show( label_a_atk );
	Widget_Show( label_b_atk );
	Widget_Show( label_defense );
	Widget_Show( btn_ok );
	Widget_Show( btn_reset );
	Widget_Show( box );
	Widget_Show(label );
}