Example #1
0
void SetPos(int i, int j){
	COORD pos = { i, j };
	SetPos(pos);
}
Example #2
0
bool Progress::SetPosCanceled(int pos)
{
	stop.Show();
	SetPos(pos);
	return cancel;
}
Example #3
0
/// Copies \p s to the internal buffer.
void ostringstream::str (const string& s)
{
    m_Buffer = s;
    ostream::link (m_Buffer);
    SetPos (m_Buffer.size());
}
	void CContainerUI::ProcessScrollBar(RECT rc, int cxRequired, int cyRequired)
	{
		// by 冰下海 2015/08/16
		while (m_pHorizontalScrollBar)
		{
			// Scroll needed
			if (cxRequired > rc.right - rc.left && !m_pHorizontalScrollBar->IsVisible())
			{
				m_pHorizontalScrollBar->SetVisible(true);
				m_pHorizontalScrollBar->SetScrollRange(cxRequired - (rc.right - rc.left));
				m_pHorizontalScrollBar->SetScrollPos(0);
				SetPos(m_rcItem);
				break;
			}

			// No scrollbar required
			if (!m_pHorizontalScrollBar->IsVisible()) break;

			// Scroll not needed anymore?
			int cxScroll = cxRequired - (rc.right - rc.left);
			if (cxScroll <= 0)
			{
				m_pHorizontalScrollBar->SetVisible(false);
				m_pHorizontalScrollBar->SetScrollPos(0);
				m_pHorizontalScrollBar->SetScrollRange(0);
				SetPos(m_rcItem);
			}
			else
			{
				RECT rcScrollBarPos = { rc.left, rc.bottom, rc.right, rc.bottom + m_pHorizontalScrollBar->GetFixedHeight() };
				m_pHorizontalScrollBar->SetPos(rcScrollBarPos);

				if (m_pHorizontalScrollBar->GetScrollRange() != cxScroll) 
				{
					int iScrollPos = m_pHorizontalScrollBar->GetScrollPos();
					m_pHorizontalScrollBar->SetScrollRange(::abs(cxScroll)); // if scrollpos>range then scrollpos=range
					if(iScrollPos > m_pHorizontalScrollBar->GetScrollPos()) 
					{
						SetPos(m_rcItem);
					}
				}
			}
			break;
		}

		while (m_pVerticalScrollBar)
		{
			// Scroll needed
			if (cyRequired > rc.bottom - rc.top && !m_pVerticalScrollBar->IsVisible()) 
			{
				m_pVerticalScrollBar->SetVisible(true);
				m_pVerticalScrollBar->SetScrollRange(cyRequired - (rc.bottom - rc.top));
				m_pVerticalScrollBar->SetScrollPos(0);
				SetPos(m_rcItem);
				break;
			}

			// No scrollbar required
			if (!m_pVerticalScrollBar->IsVisible()) break;

			// Scroll not needed anymore?
			int cyScroll = cyRequired - (rc.bottom - rc.top);
			if (cyScroll <= 0) 
			{
				m_pVerticalScrollBar->SetVisible(false);
				m_pVerticalScrollBar->SetScrollPos(0);
				m_pVerticalScrollBar->SetScrollRange(0);
				SetPos(m_rcItem);
				break;
			}

			RECT rcScrollBarPos = { rc.right, rc.top, rc.right + m_pVerticalScrollBar->GetFixedWidth(), rc.bottom };
			m_pVerticalScrollBar->SetPos(rcScrollBarPos);

			if (m_pVerticalScrollBar->GetScrollRange() != cyScroll)
			{
				int iScrollPos = m_pVerticalScrollBar->GetScrollPos();
				m_pVerticalScrollBar->SetScrollRange(::abs(cyScroll)); // if scrollpos>range then scrollpos=range
				if(iScrollPos > m_pVerticalScrollBar->GetScrollPos()) 
				{
					SetPos(m_rcItem);
				}
			}
			break;
		}
	}
Example #5
0
void Robot::Action()
{
	switch (GetType())
	{
	case Left:
		if (!startattack)
		{
			if (!trigger)
			{
				if (coretype != Eternity)
				{
					HGE *hge = hgeCreate(HGE_VERSION);
					float x, y;
					hge->Input_GetMousePos(&x, &y);
					int dis = GetDistance(x, y);
					if (dis < 20)
					{
						if (hge->Input_KeyDown(HGEK_LBUTTON))
						{
							trigger = true;
							backx = GetX();
							backy = GetY();
						}
						else
						{
							if (hge->Input_KeyDown(HGEK_RBUTTON))
								Suicide(true);
						}
					}
				}
			}
			else
			{
				ObjectPool::GetObjPool().LockOnGameObject(this);
				if (runback)
				{
					if (GoToAnotherPos(backx,backy))
					{
						trigger = false;
						runback = false;
						SetSpeed(0);
					}
				}
				else
				{
					HGE *hge = hgeCreate(HGE_VERSION);
					float x, y;
					hge->Input_GetMousePos(&x, &y);
					SetPos(x, y);
					if (hge->Input_KeyUp(HGEK_LBUTTON))
					{
     					if (x<ACT_START_X || x>ACT_END_X || y<ACT_START_Y || y>ACT_END_Y)
						{
							runback = true;
							SetSpeed(1200);
						}
						else
						{
							switch (coretype)
							{
								//攻击型
								//开始攻击
							case Attack:
								SetCollisionRange(40);
								SetSolid(true);
								SetBlock(true);
								break;
								//触发技能型
								//跟hero做intercation将自身赋给hero然后自杀
							case Magic:
								dynamic_cast<Hero*>(ObjectPool::GetObjPool().GetOurHero(GetType()))->SetSkill(GetInnerCode() + 300);
								Suicide();
								break;
								//BUFF型
								//施放技能 
							case Buff:
							{
										 int count = 0;
										 Hero *a = dynamic_cast<Hero*>(ObjectPool::GetObjPool().GetOurHero(GetType()));
										 for (int i = 0; i < STD_CORES; i++)
										 {
											 Robot *b = dynamic_cast<Robot*>(a->GetCOREs(i));
											 if (b && b->IsActive())
											 {
												 if (b->GetInnerCode() == GetInnerCode())
												 {
													 b->Suicide();
													 a->Interaction(b);
												 }
												 else
												 if (b->GetCoreType() == Buff)
													 count++;
											 }

										 }
										 SetSpeed(1500);
										 SetAim(25+count * 50, 175);
							}
								break;
							}
							startattack = true;
						}
					}
				}
			}
		}
		else
		{
			switch (coretype)
			{
			case Attack:
				if (GetAim())
					GetAngle(GetAim());
				if (shootdelay)
					shootdelay--;
				else
				{
					if (!GetAim())
						SetAim(ObjectPool::GetObjPool().GetRandomEnemyUnit(GetType()));
					else
					{
						Skill *skill = new Skill(this, CORESKILL);
						ObjectPool::GetObjPool().InsertObject(skill, true);
					}
					shootdelay = std_shootdelay;
				}
				break;
			case Buff:
				if (GoToAim())
				{
					if (!buffstart)
					{
						ObjectPool::GetObjPool().GetOurHero(GetType())->Interaction(this);
						buffstart = true;
					}
					if (shootdelay)
						shootdelay--;
					else
					{
						Suicide();
						if (host)
							host->Interaction(this);
					}
				}
				break;
			}
			HGE *hge = hgeCreate(HGE_VERSION);
			if (hge->Input_KeyDown(HGEK_RBUTTON))
			{
				float x, y;
				hge->Input_GetMousePos(&x, &y);
				if (GetDistance(backx, backy, x, y) < 20)
				{
					Suicide(true);
				}
			}
		}
		break;
	case None:
		if (!GetSpeed())
		{
			HGE *hge = hgeCreate(HGE_VERSION);
			float x, y;
			hge->Input_GetMousePos(&x, &y);
			int dis = GetDistance(x, y);
			if (dis < 50)
			{
				ObjectPool::GetObjPool().GetEnemyHero(GetType())->Scilence();
				if (dis < 40)
				{
					if (hge->Input_KeyDown(HGEK_LBUTTON))
						ObjectPool::GetObjPool().GetEnemyHero(GetType())->Interaction(this);
					else
					{
						if (hge->Input_KeyDown(HGEK_RBUTTON))
						{
							Suicide(true);
							tremble = 0;
						}
					}
				}
			}
			else
				ObjectPool::GetObjPool().GetEnemyHero(GetType())->UnScilence();
		}
		else
			ObjectPool::GetObjPool().GetEnemyHero(GetType())->UnScilence();
		break;
	}
	if (tremble)
	{
		tremble--;
		int a = tremble / 5;
		int b = tremble % 5;
		if (a % 2)
			SetX(GetX() + (3 - b) * 2);
		else
			SetX(GetX() - (3 - b) * 2);
	}
}
void MY_UI::Controls::Window::Dragging(){	
	Utilities::Point p = GetPos();
	p.x += New_MousePosx - Old_MousePosx;
	p.y += New_MousePosy - Old_MousePosy;
	SetPos(p.x, p.y);
}
Example #7
0
BoxCollider::BoxCollider() : Collider(ColliderType::Box){
	SetPos(Vector3(0.0f, 0.0f, 0.0f));
	SetSize(Vector3(1.0f, 1.0f, 1.0f));
}
Example #8
0
int EBuffer::DoWrap(int WrapAll) {
    int L, Len, C, P, Ind;
    PELine LP;
    int Left = BFI(this, BFI_LeftMargin), Right = BFI(this, BFI_RightMargin);
    int FirstParaLine;
    int NoChange = 0, NoChangeX = 0;

    if (Left >= Right) return 0;

    L = VToR(CP.Row);

    FirstParaLine = 0;
    if (L > 0)
        if (IsLineBlank(L - 1)) FirstParaLine = L;

    while (L < RCount) {
        NoChange = 1;

        if (VToR(CP.Row) != L || L != FirstParaLine) {
            if (VToR(CP.Row) == L)
                if (CP.Col <= LineIndented(L))
                    if (SetPos(Left, CP.Row) == 0) WFAIL(1);
            Ind = IndentLine(L, Left);
            if (VToR(CP.Row) == L)
                if (SetPos((CP.Col + Ind > 0) ? CP.Col + Ind : 0, CP.Row) == 0) WFAIL(2);
            NoChange = 0;
        }
        Len = LineLen(L);

        if (IsLineBlank(L)) break;

        if (Len < Right) {
            int firstwordbeg = -1;
            int firstwordend = -1;
            int X;
            PELine lp;

            if (L < RCount - 1) {
                IndentLine(L + 1, 0);
                if ((ScreenPos(RLine(L + 1), RLine(L + 1)->Count) == 0) ||
                        (RLine(L + 1)->Chars[0] == '>') || (RLine(L + 1)->Chars[0] == '<')) break;
            } else
                break;
            if (L + 1 >= RCount) break;

            lp = RLine(L + 1);
            for (X = 0; X < lp->Count; X++) {
                if (firstwordbeg == -1 &&
                        ((lp->Chars[X] != ' ') && (lp->Chars[X] != '\t'))) {
                    firstwordbeg = X;
                } else if (firstwordend == -1 &&
                           ((lp->Chars[X] == ' ' || lp->Chars[X] == '\t'))) {
                    firstwordend = X - 1;
                }
            }
            if (firstwordbeg != -1)
                if (firstwordend == -1)
                    firstwordend = lp->Count;

            if (firstwordend == -1) break;
            if (Right - Len > firstwordend - firstwordbeg) {
                if (JoinLine(L, Len + 1) == 0) WFAIL(3);
                NoChange = 0;
                continue;
            } else
                IndentLine(L + 1, Left);
        } else if (Len > Right) {
            C = Right;
            P = CharOffset(LP = RLine(L), C);
            while ((C > Left) &&
                    ((LP->Chars[P] != ' ') &&
                     (LP->Chars[P] != 9)))
                C = ScreenPos(LP, --P);

            if (P <= Left) {
                L++;
                continue;
            }
            C = ScreenPos(LP, P);
            if (SplitLine(L, C) == 0) WFAIL(4);
            IndentLine(L + 1, Left);
            if (L < RCount - 2 && LineLen(L + 1) == Left) {
                if (!IsLineBlank(L + 2)) {
                    if (JoinLine(L + 1, Left) == 0) WFAIL(5);
                }
            }
            if (L == VToR(CP.Row) && CP.Col > C) {
                if (SetPos(Left + CP.Col - C - 1, CP.Row + 1) == 0) WFAIL(6);
            }
            NoChange = 0;
            L++;
            continue;
        }
        if (WrapAll == 0)
            if (NoChangeX) {
                //printf("\n\nBreak OUT = %d\n\x7", L);
                break;
            }
        L++;
        NoChangeX = NoChange;
    }
    if (WrapAll == 1)
        if (SetPosR(Left,
                    (L < RCount - 2) ? (L + 2) :
                    (L < RCount - 1) ? (L + 1) :
                    (RCount - 1)) == 0) WFAIL(7);
    return 1;
}
Example #9
0
int EBuffer::WrapPara() {
    while (VToR(CP.Row) < RCount - 1 && IsLineBlank(VToR(CP.Row)))
        if (SetPos(CP.Col, CP.Row + 1) == 0) return 0;
    return DoWrap(1);
}
Example #10
0
VError XLinuxFileDesc::SetPos(sLONG8 inOffset, bool inFromStart) const
{
	return SetPos(inOffset, (inFromStart==true ? SET : CUR));
}
Example #11
0
/////////////////////////////////////////////////////////////////////
// コンストラクタ
ActiveSubDomain::ActiveSubDomain( int pos[3] )
{
  SetPos(pos);
}
Example #12
0
void CN3UITooltip::SetText(const std::string& szText)
{
	if(!m_bVisible || m_bSetText) return;

	// ÅøÆÁ»óÀÚ Å©±â¸¦ Á¶Á¤ÇÑ´Ù.
	int iStrLen = szText.size();
	if (0 == iStrLen || NULL == m_pBuffOutRef) return;

	m_pBuffOutRef->ClearOnlyStringBuffer();	//¿ì¼± ±âÁ¸¿¡ ÀÖ´ø ±Û¾¾¸¦ Áö¿î´Ù.(Á¤·ÄÇÏÁö ¾Ê°í)
	SIZE size;
	if (m_pBuffOutRef->GetTextExtent(szText, iStrLen, &size))
	{
		if (std::string::npos != szText.find('\n'))
		{	// '\n'¹®ÀÚ¿­Áß¿¡ \nÀÌ µé¾î°¡ ÀÖÀ¸¹Ç·Î multi lineÀ¸·Î °£ÁÖ
			m_pBuffOutRef->SetStyle(UISTYLE_STRING_ALIGNLEFT|UISTYLE_STRING_ALIGNTOP);
		}
		else if (iStrLen<25)
		{	// 25byte ¹Ì¸¸ÀÌ¸é ±×³É ÇÑÁÙ·Î.
			m_pBuffOutRef->SetStyle(UISTYLE_STRING_SINGLELINE|UISTYLE_STRING_ALIGNCENTER|UISTYLE_STRING_ALIGNVCENTER);
		}
		else
		{	// single lineÀ̹ǷΠÀû´çÇÑ Å©±â¸¦ °è»êÇÑ´Ù.
			SIZE CharSize = {0,0};
			if (FALSE == m_pBuffOutRef->GetTextExtent("°¡", 2, &CharSize)) return;

			int iDiv = 25;
			int iLineCount = (iStrLen + iDiv-1)/iDiv;
			while (iLineCount > (iDiv/2))
			{
				iDiv += 5;
				iLineCount = (iStrLen + iDiv-1)/iDiv;
			}
			size.cx = ((iDiv+1)*CharSize.cx + 1)/2;
			size.cy = iLineCount*CharSize.cy;
		}

		size.cx += 12;
		size.cy += 12;
		SetSize(size.cx, size.cy);
	}
	m_pBuffOutRef->SetString(szText);

	// À§Ä¡ Á¶Á¤
	POINT	ptNew = m_ptCursor;
	ptNew.x -= (m_rcRegion.right - m_rcRegion.left) / 2;
	ptNew.y -= (m_rcRegion.bottom - m_rcRegion.top) + 10;

	D3DVIEWPORT9 &vp = s_CameraData.vp;
	int iRegionWidth = m_rcRegion.right - m_rcRegion.left;
	int iRegionHeight = m_rcRegion.bottom - m_rcRegion.top;

	if (ptNew.x + iRegionWidth > vp.X+vp.Width)	// È­¸é ¿À¸¥¦UÀ¸·Î ¹þ¾î³­ °æ¿ì
		ptNew.x = vp.X+vp.Width - iRegionWidth;
	if (ptNew.x < vp.X)	ptNew.x = vp.X;	// È­¸é ¿ÞÂÊÀ¸·Î ¹þ¾î³­ °æ¿ì

	if (ptNew.y + iRegionHeight > vp.Y+vp.Height)	// È­¸é ÇÏ´ÜÀ¸·Î ¹þ¾î³­ °æ¿ì
		ptNew.y = vp.Y+vp.Height - iRegionHeight;
	if (ptNew.y < vp.Y) ptNew.y = vp.Y;	// È­¸é »ó´ÜÀ¸·Î ¹þ¾î³­ °æ¿ì	

	SetPos(ptNew.x, ptNew.y);

	m_bSetText = true;
}
Example #13
0
	void CControlUI::Move(SIZE szOffset, bool bNeedInvalidate)
	{
		m_cXY.cx += szOffset.cx;
		m_cXY.cy += szOffset.cy;
		SetPos(m_rcItem, bNeedInvalidate);
	}
Example #14
0
void SpriteCellComponent::SetCell(Cell* c)
{
	CellComponent::SetCell(c);
	SetPos(c->GetPos().x+_myx, c->GetPos().y+_myy);
}
Example #15
0
int EBuffer::BackSpace() {
    int Y = VToR(CP.Row);

    if (CheckBlock() == 1 && BFI(this, BFI_BackSpKillBlock)) {
        if (BlockKill() == 0)
            return 0;
    } else if (BFI(this, BFI_WordWrap) == 2 && CP.Row > 0 && !IsLineBlank(Y - 1) &&
               CP.Col <= BFI(this, BFI_LeftMargin) && CP.Col <= LineIndented(Y)) {
        if (SetPos(LineLen(Y - 1), CP.Row - 1) == 0) return 0;
    } else if (CP.Col == 0) {
        if (CP.Row > 0)
            if (ExposeRow(VToR(CP.Row) - 1) == 0) return 0;
        if (MoveUp() == 0) return 0;
        if (MoveLineEnd() == 0) return 0;
        if (LineJoin() == 0) return 0;
    } else {
        if (BFI(this, BFI_BackSpUnindents) && (LineIndented(Y) == CP.Col)) {
            int C = CP.Col, C1 = 0;
            int L = VToR(CP.Row);

            C1 = C;
            while (L > 0 && (IsLineBlank(L - 1) || (C1 = LineIndented(L - 1)) >= C)) L--;
            if (L == 0) C1 = 0;
            if (C1 == C) C1--;
            if (C1 < 0) C1 = 0;
            if (C1 > C) C1 = C;
            if (SetPos(C1, CP.Row) == 0) return 0;
            if (C > LineIndented(Y)) return 0;
            if (DelText(Y, C1, C - C1) == 0) return 0;
            if (BFI(this, BFI_Insert) == 0)
                if (InsText(Y, C1, 1, " ") == 0) return 0;
        } else if (BFI(this, BFI_BackSpKillTab)) {
            int P;
            int C = CP.Col, C1;

            P = CharOffset(RLine(Y), C - 1);
            C1 = ScreenPos(RLine(Y), P);
            if (SetPos(C1, CP.Row) == 0) return 0;
            if (DelText(Y, C1, C - C1) == 0) return 0;
            if (BFI(this, BFI_Insert) == 0)
                if (InsText(Y, C1, 1, " ") == 0) return 0;
        } else {
            if (MovePrev() == 0) return 0;

            ELine *L = RLine(Y);
            int C = CharOffset(L, CP.Col);

            if (L->Count > 0 && L->Chars[C] == 9) {
                /* We're on top of tab character. Skip over all spaces and
                   tabs so that only the last space/tab gets deleted. */
                while (C < L->Count &&
                        (L->Chars[C+1] == 9 || L->Chars[C+1] == ' ')) C++;
            }

            if (DelText(Y, ScreenPos(L, C), 1) == 0) return 0;
            if (BFI(this, BFI_Insert) == 0)
                if (InsText(Y, ScreenPos(L, C), 1, " ") == 0) return 0;
        }
    }
    if (BFI(this, BFI_WordWrap) == 2) {
        if (DoWrap(0) == 0) return 0;
    }
    if (BFI(this, BFI_Trim)) {
        Y = VToR(CP.Row);
        if (TrimLine(Y) == 0) return 0;
    }
    return 1;
}
Example #16
0
int EBuffer::MoveLineStart() {
    SetPos(0, CP.Row);
    return 1;
}
void MY_UI::Controls::Window::Restore(){
	SetPos(Internal_Window.Old_Pos.x, Internal_Window.Old_Pos.y);
	SetSize(Internal_Window.Old_Size.x, Internal_Window.Old_Size.y);
}
Example #18
0
int EBuffer::MoveLineEnd() {
    SetPos(LineLen(VToR(CP.Row)), CP.Row);
    return 1;
}
Example #19
0
char *InputString(int y, int x, int l, char *tmp)
{
	int n,m, xx;
	char c;
	static char buf[80];
	char *defbuf[] = {
		"DEFAULT.D32",
		"DOS4GW.D32",
		"FAILSAFE.D32",
		"MAXIMUM.D32",
		"MINIMUM.D32",
		"PMODEW.D32",
		"STANDARD.D32",
		"VERBOSE.D32",
		"CUSTOM.D32",
		""
	};

	m=-1; xx=x;
	if(tmp!=NULL) strcpy(buf,tmp);
l8:	Print_At(y,x-1,"<");
	Print_At(y,x+l,">");
	for(n=0; n<l; n++) Print_At(y,x+n,".");
	for(n=0; buf[n]!=NULL; n++) { SetPos(y,x+n); PrintC(buf[n]); }

	for(; n<l; n++)
	{
l0:		SetBlink(1); Print_At(y,x+n,"Û"); SetBlink(0);

		do
		{	GetKey();
			c=toupper(keychar);
			if(c==0x1B) goto l1;
			if(c==0x0D) goto l1;
			if(c==0x08) break;
			if(keycode==UP)   { m++; if(m>8) m=0; x=xx; strcpy(buf,defbuf[m]); goto l8; }
			if(keycode==DOWN) { m--; if(m<0) m=8; x=xx; strcpy(buf,defbuf[m]); goto l8; }
		} while(c<0x20);

		if(c==0x08)
		{
		  if(n>0)
		  {
			Print_At(y,x+n,".");
			n--;
			goto l0;
		  } else goto l0;
		}
		buf[n]=c;
		Print_At(y,x+n,"%c",c);
	}

l1:	buf[n]=0;

	Print_At(y,x-1," ");
	Print_At(y,x+l," ");
	for(n=0; n<l; n++) Print_At(y,x+n," ");

	keychar=keycode=0;
	if(c==0x1B) return(NULL);
	else if(strlen(buf)==0) return(NULL);
	else return(buf);
}
Example #20
0
int EBuffer::MovePageStart() {
    SetPos(CP.Col, GetVPort()->TP.Row, tmLeft);
    return 1;
}
Example #21
0
BoxCollider::BoxCollider(Vector3 pos, Vector3 size) : Collider(ColliderType::Box){
	SetPos(pos);
	SetSize(size);
}
Example #22
0
int EBuffer::MoveFileStart() {
    SetPos(0, 0);
    return 1;
}
Example #23
0
void CVolumeCtrl::SetPosInternal(int pos)
{
    SetPos(pos);
    GetParent()->PostMessage(WM_HSCROLL, MAKEWPARAM((short)pos, SB_THUMBPOSITION), (LPARAM)m_hWnd); // this will be reflected back on us
}
Example #24
0
int EBuffer::MoveFileEnd() {
    SetPos(LineLen(VToR(VCount - 1)), VCount - 1);
    return 1;
}
Example #25
0
void CSSEditCtrls::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
	if (nChar != VK_UP && nChar != VK_DOWN) {
		m_nStartTime = 0;
		CEdit::OnKeyDown(nChar, nRepCnt, nFlags);
		return;
	}

	if (m_nLockCnt)
		return;

	int	nPos = m_nPos;

	if (nChar == VK_UP) {
		if (nPos == m_nRangeMax) {
			m_nStartTime = 0;
			return;
		}
	} else if (nPos == m_nRangeMin) {
		m_nStartTime = 0;
		return;
	}

	if (!m_nStartTime)
		m_nStartTime = GetTickCount();

	int	nInc = 1;

	{
		UDACCEL	uda[10];
		int nAccel = m_Spinner.GetAccel(10, uda);
		UINT	dt = (GetTickCount() - m_nStartTime) / 1000;
		for (int n = 0; n < nAccel; n++) {
			if (dt >= uda[n].nSec)
				nInc = uda[n].nInc;
			else
				break;
		}
	}

	if (!nInc)
		return;

	if (nChar == VK_UP) {
		if (m_nRangeMax - nPos <= nInc)
			nPos = m_nRangeMax;
		else {
			int n = nInc - (nPos % nInc);
			if (n > nInc)
				n -= nInc;
			nPos += n;
		}
	} else if (nChar == VK_DOWN) {
		if (nPos - m_nRangeMin <= nInc)
			nPos = m_nRangeMin;
		else {
			int	n = nInc + (nPos % nInc);
			if (n > nInc)
				n -= nInc;
			nPos -= n;
		}
	}

	SetPos(nPos);
}
Example #26
0
int EBuffer::MoveNextTab() {
    int P = CP.Col;

    P = NextTab(P, BFI(this, BFI_TabSize));
    return SetPos(P, CP.Row);
}
Example #27
0
int Buffer::Peek() {
	int curPos = GetPos();
	int ch = Read();
	SetPos(curPos);
	return ch;
}
Example #28
0
int EBuffer::MoveSavedPosCol() {
    if (SavedPos.Col == -1) return 0;
    if (SetPos(SavedPos.Col, CP.Row) == 0) return 0;
    return 1;
}
Example #29
0
/////////////////////////////// Trait Selection ////////////////////////////////////////////
void
TraitSelection::Setup( UINT32 aVal )
{
	Destroy();

	SOLDIERTYPE * pSoldier = NULL;

	GetSoldier( &pSoldier, gusSelectedSoldier );

	if ( pSoldier == NULL )
		return;

	SetupPopup("TraitSelection");

	POPUP_OPTION *pOption;
	
	CHAR16 pStr[300];

	// create entries for the sub-menus for each trait
	const UINT8 num = 2;
	UINT8 traitarray[num];
	traitarray[0] = RADIO_OPERATOR_NT;
	traitarray[1] = VARIOUSSKILLS;
	for ( int i = 0; i < num; ++i)
	{
		swprintf( pStr, gzMercSkillTextNew[traitarray[i]] );

		pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &Wrapper_Setup_SkillSelection, traitarray[i] ) );

		// if we cannot perform this skill, grey it out
		if ( !HAS_SKILL_TRAIT(pSoldier, traitarray[i]) )
		{
			// Set this option off.
			pOption->setAvail(new popupCallbackFunction<bool,void*>( &Popup_OptionOff, NULL ));
		}

		GetPopup()->addOption( *pOption );
	}

	// cancel option
	swprintf( pStr, pSkillMenuStrings[SKILLMENU_CANCEL] );
	pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &Wrapper_Cancel_TraitSelection, 0 ) );
	GetPopup()->addOption( *pOption );
		
	// grab soldier's x,y screen position
	INT16 sX, sY;
	// sevenfm: changed TraitsMenu position from soldier to mouse
	//GetSoldierScreenPos( pSoldier, &sX, &sY );
	GetGridNoScreenPos( sTraitsMenuTargetGridNo, gsInterfaceLevel, &sX, &sY );
		
	if( sX < 0 ) sX = 0;
	if( sY < 0 ) sY = 0;

	usTraitMenuPosX = sX + 30;		
	usTraitMenuPosY = sY;

	if ( ( usTraitMenuPosX + 400 ) > SCREEN_WIDTH )
		usTraitMenuPosX = SCREEN_WIDTH - 400;

	if ( ( usTraitMenuPosY + 130 ) > SCREEN_HEIGHT )
		usTraitMenuPosY = SCREEN_HEIGHT - 190;

	SetPos(usTraitMenuPosX, usTraitMenuPosY);
}
Example #30
0
void drawPlaying(){//画游戏区域
	/*system("cls");
	system("mode con cols=100 lines=60");
	drawFrame(0, 0, 65, 43, '~', '|');
	drawFrame(66, 0, 99, 4, '-', '|');
	drawFrame(66, 4, 99, 9, '-', '|');
	drawFrame(66, 9, 99, 20, '-', '|');
	drawFrame(66, 20, 99, 24, '-', '|');*/
	SetPos(60, 5);
	cout << "得分:";
	SetPos(60, 6);
	cout << "血量:";
	SetPos(60, 7);
	cout << "生命:";
	SetPos(60, 8);
	cout << "水平:";
	SetPos(60, 10);
	cout << "操作方式:";
	SetPos(60, 12);
	cout << "  w,a,s,d 控制战机移动。";
	SetPos(60, 13);
	cout << "  J:子弹 K:炸弹";
	SetPos(60, 14);
	cout << "  L:社会主义好 U:死不了";
	SetPos(60, 15);
	cout << "  I:影分身 O:女神的宽恕";
	SetPos(60, 16);
	cout << "  P:最终决战奥义·凡哥的爱";
	SetPos(60, 17);
	cout << "  空格:暂停游戏";
	SetPos(60, 18);
	cout << "  T:退出游戏 R:重新开始";
	SetPos(60, 22);
	cout << "增益提示:";
	SetPos(0, 45);
}