void AGameplayPawn::DestroyLine(int x1, int y1, int x2, int y2, int l)
{
	int xl = l;
	if (x1 > x2)
		xl = -xl;
	if (y1 < y2)
		xl = -xl;
	int maxX = Max(x1, x2) + l;
	int maxY = Max(y1, y2) + l;
	int minX = Min(x1, x2) - l;
	int minY = Min(y1, y2) - l;
	if (x1 == x2)
		x1++;
	float K = ((y2 - y1) / (float)(x2 - x1));
	for (int i = minX; i <= maxX; i++) 
	{
		int minLine = (int)(y1 + K * (i - x1 + xl)) - l;
		int maxLine = (int)(y1 + K * (i - x1 - xl)) + l;
		for (int j = Max(minY, minLine); j <= Min(maxY, maxLine); j++) 
		{
			if (i >= 0 && i < width && j >= 0 && j < height)
				RemoveAtIndex(i, j);
		}
	}
	l++;
	UpdateLine(x1, y1, x2, y2, l);
}
//----------------------------------------------------------------------------
void InverseKinematics::OnKeyDown (unsigned char ucKey, int, int)
{
    if ( ucKey == 'q' || ucKey == 'Q' || ucKey == KEY_ESCAPE )
    {
        RequestTermination();
        return;
    }

    if ( Transform(ucKey) )
        return;

    switch ( ucKey )
    {
    case '0':  // reset frame rate measurements
        ResetTime();
        return;
    case 'w':
        m_spkWireframeState->Enabled() = !m_spkWireframeState->Enabled();
        return;
    case 'i':
        m_pkIKCtrl->Active() = !m_pkIKCtrl->Active();
        m_spkScene->UpdateGS(0.0f);
        UpdateLine();
        return;
    }
}
Example #3
0
void frmMainConfig::OnEditSetting(wxListEvent &event)
{
	wxString name = cfgList->GetText(event.GetIndex());
	if (!name.IsEmpty())
	{
		pgSettingItem *item = options[name];
		wxASSERT(item);
		dlgMainConfig dlg(this, item);
		dlg.Go();

		if (item->orgLine && !item->newLine->Differs(item->orgLine))
		{
			delete item->newLine;
			item->newLine = 0;
		}
		else
		{
			changed = true;
			fileMenu->Enable(MNU_SAVE, true);
			editMenu->Enable(MNU_UNDO, true);
			toolBar->EnableTool(MNU_SAVE, true);
			toolBar->EnableTool(MNU_UNDO, true);


		}
		UpdateLine(event.GetIndex());
	}
}
/*===========================================================================
 *
 * Class CSrConfigEntry Method - void SetValueFormatV (pString, Args);
 *
 * Extended method to set the value to the given vprintf() formated string.
 *
 *=========================================================================*/
void CSrConfigEntry::SetValueFormatV (const char* pString, va_list Args) {
  char    Buffer[256];

  _vsnprintf(Buffer, 250, pString, Args);
  m_Value = Buffer;

  UpdateLine();
}
Example #5
0
void CTitlePaneDlg::OnEnChangeEditTitle()
{
	// TODO:  Add your control notification handler code here
	m_TitleCtrl.GetWindowText(m_strTitle);

	CTitleHelper::CountTitleLine(m_strTitle, m_strCharCount);
	UpdateLine(m_TitleCtrl, m_CntLineCtrl);
	OnSaveItem();

	m_CntLineCtrl.SetWindowText(m_strCharCount);
}
Example #6
0
    void DocTracker::UpdateLine( MagoST::ISession* session, uint32_t curOffset, const MagoST::LineNumber& lineNum, Module* mod )
    {
        _ASSERT( session != NULL );
        _ASSERT( mod != NULL );

        mCurData.mMod = mod;
        mCurData.mHasLineInfo = true;

        UpdateLine( session, curOffset, lineNum );

        _ASSERT( IsValid() );
    }
Example #7
0
void COutputsPage::OnSourceSelectDialog( UINT nID ) 
/////////////////////////////////////////////////////////////////////////////
{
	COutSourceSelect dlg;

	dlg.m_usDstLine = LINE_OUT_1 + (nID - IDC_OUT1_DIALOG);

	int nResponse = dlg.DoModal();
	
	// force the screen to repaint
	UpdateLine( dlg.m_usDstLine - LINE_OUT_1 );
}
Example #8
0
static void Key(unsigned char key, int x, int y)
{

   switch (key) {
   case 27:
      exit(1);
   default:
      UpdateLine();
      line++;
      break;
   }

   glutPostRedisplay();
}
Example #9
0
void frmMainConfig::OnUndo(wxCommandEvent &ev)
{
	wxString name = cfgList->GetText(cfgList->GetSelection());
	if (!name.IsEmpty())
	{
		pgSettingItem *item = options[name];
		if (item->newLine)
		{
			delete item->newLine;
			item->newLine = 0;
			UpdateLine(cfgList->GetSelection());
		}
	}
}
void Fraction::SetPosition(const QPoint &point)
{
	 position_.setX(point.x());
	 position_.setY(point.y());

	 numerator->SetPosition(point);
	 denominator->SetPosition(QPoint(position_.x(), position_.y() + numerator->Bound().height()));

	 //numerator->SetPosition(QPoint(point.x(), denominator->GetPosition().y() - numerator->Bound().height()));

	 position_.setY(numerator->GetPosition().y());

	 UpdateLine();
}
Example #11
0
void CFlashingCursor::erase(int cx, int cy)
{
int x, y, line_number;
EditView *ev = editor.curev;

	visible = 0;
	if (cy < 0 || cy >= editor.height || !ev) return;
	//stat("erase[%d, %d]", cx, cy);
	
	x = GET_CURSOR_PX(cx);
	y = GET_CURSOR_PY(cy);
	
	// restore the image behind the cursor
	LockWindow();
	line_number = (ev->scroll.y + cy);
	
	if (line_number >= ev->nlines)
	{
		MainView->SetLowColor(GetEditBGColor(COLOR_TEXT));
		MainView->FillRect(BRect(x, y, x + (CURSOR_W - 1), y + (CURSOR_H - 1)), B_SOLID_LOW);
	}
	else
	{
		editor.curline_bb->Lock();
		
		if (line_number != editor.bbed_line)
		{
			clLine *line = ev->GetLineHandle(line_number);
			if (line)
			{
				if (!line->lexresult.points) lexer_update_line(line);
				UpdateLine(ev, editor.curline_bb, line, 0, line_number);
				editor.bbed_line = line_number;
			}
			else
			{
				staterr("CFlashingCursor::erase: could not obtain line handle to update BB");
			}
		}
		
		BRect source(x, 0, x + (CURSOR_W - 1), CURSOR_H-1);
		BRect dest(x, y, x + (CURSOR_W - 1), y + (CURSOR_H-1));
		
		editor.curline_bb->BlitTo(view, source, dest);
		editor.curline_bb->Unlock();
	}
	
	UnlockWindow();
}
Example #12
0
//删除工具栏
BOOL RingDockSite::DelBar(RingDockBar* dockbar,BOOL bUpdate/*=TRUE*/)
{
	if(dockbar && dockbar->GetChild() && dockbar->GetChild()->GetParent() == m_hWnd)
	{
		LPRINGBARLINEINFO line = NULL,save = dockbar->m_lineInfo;
		int nSize = BarOutLine(dockbar,TRUE,line);
				
		//line作为引用,由BarOutLine设置
		if(line == NULL)
			DelLine(save);

		UpdateLine(line,nSize,bUpdate);
		return TRUE;
	}
	return FALSE;
}
Example #13
0
void COutputsPage::OnShowWindow(BOOL bShow, UINT nStatus) 
/////////////////////////////////////////////////////////////////////////////
{
	CPropertyPage::OnShowWindow(bShow, nStatus);
	
	if( bShow )
	{
		for( int i=0; i<16; i++ )
			UpdateLine( i );

		theApp.m_nPage = PAGE_OUTPUTS;
		//SetTimer( 0, 10, NULL );
	}
	else
	{
		//KillTimer( 0 );
	}
}
Example #14
0
static void Init(void)
{
   fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
   fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
   fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
   fflush(stderr);

   glClearColor(0.0, 0.0, 1.0, 0.0);

   glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
   glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
   glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
   glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
   glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

   MakeImage();
   UpdateLine();
   line++;
}
Example #15
0
BOOL RingDockSite::HideBar(RingDockBar* dockbar)
{
	if(dockbar == NULL)
		return FALSE;

	OnDockBarHide(dockbar);
	RingDockBar* bar = dockbar->m_lineInfo->m_first;
	
	while(bar)
	{
		if(bar->IsVisible())
			return TRUE;
		bar = bar->m_next;
	}
	dockbar->m_lineInfo->isVisible = FALSE;

	int step = -dockbar->m_lineInfo->m_maxSize;

	UpdateLine(dockbar->m_lineInfo,-dockbar->m_lineInfo->m_maxSize);
	return TRUE;
}
Example #16
0
/*!***************************************************************************
@Function		Print3D
@Input			fPosX		X Position
@Input			fPosY		Y Position
@Input			fScale		Text scale
@Input			Colour		ARGB colour
@Input			UTF32		Array of UTF32 characters
@Input			bUpdate		Whether to update the vertices
@Return			EPVRTError	Success of failure
@Description	Takes an array of UTF32 characters and generates the required mesh.
*****************************************************************************/
EPVRTError CPVRTPrint3D::Print3D(float fPosX, float fPosY, const float fScale, unsigned int Colour, const CPVRTArray<PVRTuint32>& UTF32, bool bUpdate)
{
	// No textures! so... no window
	if (!m_bTexturesSet)
	{
		PVRTErrorOutputDebug("DisplayWindow : You must call CPVRTPrint3D::SetTextures(...) before using this function.\n");
		return PVR_FAIL;
	}

	// nothing to be drawn
	if(UTF32.GetSize() == 0)
		return PVR_FAIL;

	// Adjust input parameters
	if(!m_bUsingProjection)
	{
		fPosX =  (float)((int)(fPosX * (640.0f/100.0f)));
		fPosY = -(float)((int)(fPosY * (480.0f/100.0f)));
	}

	// Create Vertex Buffer (only if it doesn't exist)
	if(m_pPrint3dVtx == 0)
	{
		m_pPrint3dVtx = (SPVRTPrint3DAPIVertex*)malloc(MAX_LETTERS*4*sizeof(SPVRTPrint3DAPIVertex));

		if(!m_pPrint3dVtx)
			return PVR_FAIL;
	}

	// Fill up our buffer
	if(bUpdate)
		m_nCachedNumVerts = UpdateLine(0.0f, fPosX, fPosY, fScale, Colour, UTF32, m_pPrint3dVtx);

	// Draw the text
	if(!DrawLine(m_pPrint3dVtx, m_nCachedNumVerts))
		return PVR_FAIL;

	return PVR_SUCCESS;
}
Example #17
0
LRESULT RingDockSite::OnLButtonUp(RINGPARAMS& param)
{
	SetCursor(m_windowInfo.hCursor);

	if(m_CaptureBar)
	{
		m_CaptureBar->StopDrag(m_parent->Handle(),&m_dragger,param);
		m_CaptureBar = NULL;
	}
	else if(m_dragger.IsDragging())
	{
		int nStep;

		LPRECT lprc = m_dragger.StopDrag(m_hWnd,param.mousept.x,param.mousept.y);
		
		if(IsVert())
		{
			nStep = lprc->left - m_Curr->m_SplitRc.left;
			if(m_State == TBS_FLAG_DOCKRIGHT)
				nStep = -nStep;
			else
				CopyRect(&m_Curr->m_SplitRc,lprc);			
		}
		else
		{
			nStep = lprc->top - m_Curr->m_SplitRc.top;
			if(m_State == TBS_FLAG_DOCKBOTTOM)
				nStep = -nStep;
			else
				CopyRect(&m_Curr->m_SplitRc,lprc);			
		}

		m_Curr->m_maxSize += nStep;
		UpdateLine(m_Curr,nStep);
	}
	return 0;
}
//----------------------------------------------------------------------------
bool InverseKinematics::OnInitialize ()
{
    if ( !Application::OnInitialize() )
        return false;

    // set up camera
    ms_spkCamera->SetFrustum(1.0f,1000.0f,-0.55f,0.55f,0.4125f,-0.4125f);
    Vector3f kCamLoc(0.0f,-2.0f,0.5f);
    Matrix3f kCamOrient(-1.0f,0.0f,0.0f,0.0f,0.0f,1.0f,0.0f,1.0f,0.0f);
    ms_spkCamera->SetFrame(kCamLoc,kCamOrient);


    // ** layout of scene graph **
    // scene
    //     line
    //     iknode
    //         plane
    //         target
    //             goal
    //         root
    //             origin
    //             effector
    //                 end

    // create objects
    m_spkScene = new Node(2);
    Node* pkIKNode = new Node(3);
    m_spkRoot = new Node(2);
    m_spkEffector = new Node(1);
    m_spkTarget = new Node;
    m_spkLine = CreateLine();
    TriMesh* pkPlane = CreatePlane();
    TriMesh* pkGoal = CreateCube();
    TriMesh* pkOrigin = CreateCube();
    TriMesh* pkEnd = CreateCube();

    // transform objects
    pkIKNode->Rotate().FromAxisAngle(Vector3f::UNIT_Y,0.1f);
    pkIKNode->Translate() = Vector3f(0.1f,0.1f,0.1f);
    m_spkTarget->Translate() = 2.0f*Vector3f::UNIT_Y;
    m_spkEffector->Translate() = Vector3f::UNIT_X;

    // set parent-child links
    m_spkScene->AttachChild(m_spkLine);
    m_spkScene->AttachChild(pkIKNode);
    pkIKNode->AttachChild(pkPlane);
    pkIKNode->AttachChild(m_spkTarget);
    pkIKNode->AttachChild(m_spkRoot);
    m_spkTarget->AttachChild(pkGoal);
    m_spkRoot->AttachChild(pkOrigin);
    m_spkRoot->AttachChild(m_spkEffector);
    m_spkEffector->AttachChild(pkEnd);

    // create joints
    IKJoint** apkJoint = new IKJoint*[2];
    apkJoint[0] = new IKJoint(m_spkRoot);
    apkJoint[0]->AllowRotation(2) = true;
    apkJoint[1] = new IKJoint(m_spkEffector);
    apkJoint[1]->AllowTranslation(2) = true;

    // create goal
    IKGoal** apkGoal = new IKGoal*[1];
    apkGoal[0] = new IKGoal(m_spkTarget,m_spkEffector,1.0f);

    // create IK controller
    m_pkIKCtrl = new IKController(2,apkJoint,1,apkGoal,1);
    m_pkIKCtrl->Active() = false;
    m_spkRoot->AttachControl(m_pkIKCtrl);

    // set desired render state
    m_spkWireframeState = new WireframeState;
    m_spkScene->SetRenderState(m_spkWireframeState);
    m_spkZBufferState = new ZBufferState;
    m_spkZBufferState->Enabled() = true;
    m_spkZBufferState->Writeable() = true;
    m_spkZBufferState->Compare() = ZBufferState::CF_LEQUAL;
    m_spkScene->SetRenderState(m_spkZBufferState);

    // initial update of objects
    ms_spkCamera->Update();
    m_spkScene->UpdateGS(0.0f);
    m_spkScene->UpdateRS();
    UpdateLine();

    m_bTurretActive = true;
    SetTurretAxes();
    m_fTrnSpeed = 0.1f;
    m_fRotSpeed = 0.01f;

    return true;
}
/*===========================================================================
 *
 * Class CSrConfigEntry Method - void Set (pVar, pVal);
 *
 *=========================================================================*/
void CSrConfigEntry::Set (const char* pVar, const char* pVal) {
  m_Variable = pVar;
  m_Value    = pVal;

  UpdateLine();
}
Example #20
0
void CTitlePaneDlg::OnEnVscrollEditTitle()
{
	// TODO: Add your control notification handler code here
	UpdateLine(m_TitleCtrl, m_CntLineCtrl);
}
Example #21
0
/////////////////////////////////////////////////////////////
//
//加入工具栏,工具栏必须是本窗口的子窗口且dockbar已调用SetDockSite加入到本停靠坞
//函数自动判断该工具栏是新加入或需要调整位置
//lprc为相对于父窗口坐标
//
/////////////////////////////////////////////////////////////
BOOL RingDockSite::AddBar(RingDockBar* dockbar,LPRECT lprc)
{	
	if(dockbar && dockbar->m_pSite == this)
	{
		int m,nSize,nDel=0;
		LPRINGBARLINEINFO tmp = NULL;
		LPRINGBARLINEINFO lpline = NULL;
		BOOL bLast = FALSE;
		RECT rc;
		if(lprc)
		{
			CopyRect(&rc,lprc);
			MapWindowPoints(m_parent->Handle(),m_hWnd,(LPPOINT)&rc,2);
			lprc = &rc;

			//指定位置停靠,先根据lprc的中线判断停靠位置
			if(IsVert())
			{
				if(dockbar->IsAllLineBar())
				{
					m = lprc->left;
					lprc = NULL;
				}
				else
					m = (lprc->left + lprc->right)/2;
			}
			else
			{
				if(dockbar->IsAllLineBar())
				{
					m = lprc->top;
					lprc = NULL;
				}
				else
					m = (lprc->top + lprc->bottom)/2;
			}
		}
		else
			m = 9999;	//加到最后

		//寻找要停靠的行
		lpline = GetDockLine(m);
		LPRINGBARLINEINFO save = dockbar->m_lineInfo;
		if(save)		  //已停靠在本窗口位置
		{
			nDel = BarOutLine(dockbar,(lpline != save),tmp);
			if(tmp == NULL && lpline != save)
			{
				//要删除行
				DelLine(save);
			}			
		}
		
		nSize = AddBarInLine(dockbar,lpline,lprc);
		if(dockbar->IsSizeBar())
		{
			if(lpline->m_nSizeBarCnt == 0)
				nSize += m_SplitterSize;
			
			lpline->m_nSizeBarCnt ++;
			if(lprc == NULL)	//第一次加入
				dockbar->InitDockSize();
			SetSizeSplitRect(lpline);
		}
			
		UpdateLine(NULL,nSize + nDel);
		return TRUE;
	}
	else
		return FALSE;
}
Example #22
0
    void DocTracker::Update( Address64 address )
    {
        RefPtr<Module>              mod;
        RefPtr<MagoST::ISession>    session;
        uint16_t                    section = 0;
        uint32_t                    offset = 0;
        MagoST::LineNumber          lineNum = { 0 };

        // set the old info, so we can tell if the doc changed
        mOldData = mCurData;

        // see if we can get line info from the mod we already have

        if ( mCurData.mHasLineInfo )
        {
            _ASSERT( mCurData.mMod != NULL );

            if ( mCurData.mMod->GetSymbolSession( session ) )
            {
                section = session->GetSecOffsetFromVA( address, offset );
            }

            if ( section != 0 )
            {
                uint16_t                lineIndex = 0;

                if ( FindLineInSegment( section, offset, lineIndex ) )
                {
                    UpdateLine( offset, lineIndex );
                    return;
                }

                if ( session->FindLine( section, offset, lineNum ) )
                {
                    UpdateLine( session, offset, lineNum );
                    return;
                }
            }

            mCurData.mHasLineInfo = false;
        }

        // look for the module, then the line inside it

        mod = mCurData.mMod;

        if ( (mod == NULL) || !mod->Contains( address ) )
        {
            mod.Release();
            if ( !mProg->FindModuleContainingAddress( address, mod ) )
                return;
        }

        if ( !mod->GetSymbolSession( session ) )
            return;

        section = session->GetSecOffsetFromVA( address, offset );

        if ( !session->FindLine( section, offset, lineNum ) )
            return;

        UpdateLine( session, offset, lineNum, mod );
    }
Example #23
0
/*!***************************************************************************
 @Function			UpdateTitleVertexBuffer
 @Return			true or false
 @Description
*****************************************************************************/
bool CPVRTPrint3D::UpdateTitleVertexBuffer(unsigned int dwWin)
{
	float fRPos;
	unsigned int dwLenL = 0, dwLenR = 0;

	/* Doesn't exist */
	if (!(m_pWin[dwWin].dwFlags & Print3D_WIN_EXIST) && dwWin)
		return false;

	/* Allocate our buffers if needed */
	if(m_pWin[dwWin].pTitleVtxL==0 || m_pWin[dwWin].pTitleVtxR==0)
	{
		dwLenL = (unsigned int)strlen(m_pWin[dwWin].bTitleTextL);
		FREE(m_pWin[dwWin].pTitleVtxL);
		if(dwLenL)
			m_pWin[dwWin].pTitleVtxL = (SPVRTPrint3DAPIVertex*)malloc(dwLenL*4*sizeof(SPVRTPrint3DAPIVertex));

		dwLenR = m_pWin[dwWin].bTitleTextR ? (unsigned int)strlen(m_pWin[dwWin].bTitleTextR) : 0;
		FREE(m_pWin[dwWin].pTitleVtxR);
		if(dwLenR)
			m_pWin[dwWin].pTitleVtxR = (SPVRTPrint3DAPIVertex*)malloc(dwLenR*4*sizeof(SPVRTPrint3DAPIVertex));
	}

	/* Left title */
	if (dwLenL)
	{
		m_pWin[dwWin].nTitleVerticesL = UpdateLine(dwWin, 0.0f,
			(m_pWin[dwWin].fWinPos[0] + 6.0f),
			(m_pWin[dwWin].fWinPos[1] + 7.0f),
			m_pWin[dwWin].fTitleFontSize,
			m_pWin[dwWin].dwTitleFontColorL,
			m_pWin[dwWin].bTitleTextL,
			m_pWin[dwWin].pTitleVtxL);
	}
	else
	{
		m_pWin[dwWin].nTitleVerticesL = 0;
		m_pWin[dwWin].pTitleVtxL = NULL;
	}

	/* Right title */
	if (dwLenR)
	{
		/* Compute position */
		fRPos = GetLength(m_pWin[dwWin].fTitleFontSize,m_pWin[dwWin].bTitleTextR);

		fRPos = m_pWin[dwWin].fWinSize[0]  - fRPos - 6.0f;

		/* Check that we're not under minimum position */
		if(fRPos<m_pWin[dwWin].fTextRMinPos)
			fRPos = m_pWin[dwWin].fTextRMinPos;

		/* Add window position */
		fRPos += m_pWin[dwWin].fWinPos[0];

		/* Print text */
		m_pWin[dwWin].nTitleVerticesR = UpdateLine(dwWin, 0.0f,
			fRPos,
			m_pWin[dwWin].fWinPos[1] + 7.0f,
			m_pWin[dwWin].fTitleFontSize,
			m_pWin[dwWin].dwTitleFontColorR,
			m_pWin[dwWin].bTitleTextR,
			m_pWin[dwWin].pTitleVtxR);
	}
	else
	{
		m_pWin[dwWin].nTitleVerticesR = 0;
		m_pWin[dwWin].pTitleVtxR = NULL;
	}

	return true;
}
Example #24
0
/*!***************************************************************************
 @Function			UpdateMainTextVertexBuffer
 @Return			true or false
 @Description
*****************************************************************************/
bool CPVRTPrint3D::UpdateMainTextVertexBuffer(unsigned int dwWin)
{
	int i;
	float		fNewPos, fTitleSize;
	unsigned int		dwPointer = 0, dwLen;

	/* Doesn't exist */
	if (!(m_pWin[dwWin].dwFlags & Print3D_WIN_EXIST) && dwWin) return false;

	/* No text to update vertices */
	if(m_pWin[dwWin].pTextBuffer==NULL) return true;

	/* Well, once we've got our text, allocate it to draw it later */
	/* Text, line by line */
	for (i = 0; i < (int) m_pWin[dwWin].dwBufferSizeY; i++)
	{
		/* line length */
		dwLen = (unsigned int)strlen(&m_pWin[dwWin].pTextBuffer[dwPointer]);
		if(dwLen==0)
		{
			m_pWin[dwWin].nLineVertices[i] = 0;
			m_pWin[dwWin].pLineVtx[i] = NULL;
		}
		else
		{
			/* Create Vertex Buffer (one per line) */
			if (m_pWin[dwWin].pLineVtx[i]==0)
			{
				m_pWin[dwWin].pLineVtx[i] = (SPVRTPrint3DAPIVertex*)malloc(m_pWin[dwWin].dwBufferSizeX *4*sizeof(SPVRTPrint3DAPIVertex));

				if(!m_pWin[dwWin].pLineVtx[i])
					return false;
			}

			/* Compute new text position */
			fTitleSize = 0.0f;
			if(m_pWin[dwWin].fTitleFontSize < 0.0f)
			{
				/* New position for alternate font */
				if(m_pWin[dwWin].dwFlags & Print3D_WIN_TITLE)
					fTitleSize = 8.0f +16;
				fNewPos = fTitleSize + (float)(i * 12.0f);
			}
			else
			{
				/* New position for normal font */
				if(m_pWin[dwWin].dwFlags & Print3D_WIN_TITLE)
					fTitleSize = m_pWin[dwWin].fTitleFontSize * 23.5f + 16.0f;
				fNewPos = fTitleSize + (float)(i * m_pWin[dwWin].fWinFontSize) * LINES_SPACING;
			}

			/* Print window text */
			m_pWin[dwWin].nLineVertices[i] = UpdateLine(dwWin, 0.0f,
				(m_pWin[dwWin].fWinPos[0] + 6.0f),
				(m_pWin[dwWin].fWinPos[1] + 6.0f + fNewPos),
				m_pWin[dwWin].fWinFontSize, m_pWin[dwWin].dwWinFontColor,
				&m_pWin[dwWin].pTextBuffer[dwPointer],
				m_pWin[dwWin].pLineVtx[i]);
		}

		/* Increase pointer */
		dwPointer += m_pWin[dwWin].dwBufferSizeX;
	}

	return true;
}
//----------------------------------------------------------------------------
bool InverseKinematics::Transform (unsigned char ucKey)
{
    Matrix3f rot, incr;

    switch ( ucKey )
    {
        case 'x':
            m_spkTarget->Translate().X() -= m_fTrnSpeed;
            break;
        case 'X':
            m_spkTarget->Translate().X() += m_fTrnSpeed;
            break;
        case 'y':
            m_spkTarget->Translate().Y() -= m_fTrnSpeed;
            break;
        case 'Y':
            m_spkTarget->Translate().Y() += m_fTrnSpeed;
            break;
        case 'z':
            m_spkTarget->Translate().Z() -= m_fTrnSpeed;
            break;
        case 'Z':
            m_spkTarget->Translate().Z() += m_fTrnSpeed;
            break;
        case 'r':
            rot = m_spkTarget->Rotate();
            incr.FromAxisAngle(Vector3f::UNIT_X,m_fRotSpeed);
            m_spkTarget->Rotate() = incr*rot;
            break;
        case 'R':
            rot = m_spkTarget->Rotate();
            incr.FromAxisAngle(Vector3f::UNIT_X,-m_fRotSpeed);
            m_spkTarget->Rotate() = incr*rot;
            break;
        case 'a':
            rot = m_spkTarget->Rotate();
            incr.FromAxisAngle(Vector3f::UNIT_Y,m_fRotSpeed);
            m_spkTarget->Rotate() = incr*rot;
            break;
        case 'A':
            rot = m_spkTarget->Rotate();
            incr.FromAxisAngle(Vector3f::UNIT_Y,-m_fRotSpeed);
            m_spkTarget->Rotate() = incr*rot;
            break;
        case 'p':
            rot = m_spkTarget->Rotate();
            incr.FromAxisAngle(Vector3f::UNIT_Z,m_fRotSpeed);
            m_spkTarget->Rotate() = incr*rot;
            break;
        case 'P':
            rot = m_spkTarget->Rotate();
            incr.FromAxisAngle(Vector3f::UNIT_Z,-m_fRotSpeed);
            m_spkTarget->Rotate() = incr*rot;
            break;
        default:
            return false;
    }

    m_spkScene->UpdateGS(0.0f);
    UpdateLine();
    return true;
}
Example #26
0
CBuffer::size_type CBuffer::UpdateLine(const CString& sMatch,
                                       const CString& sFormat,
                                       const CString& sText) {
    return UpdateLine(CMessage(sMatch).GetCommand(), CMessage(sFormat), sText);
}
Example #27
0
/*!***************************************************************************
 @Function			PVRTPrint3D
 @Input				fPosX		Position of the text along X
 @Input				fPosY		Position of the text along Y
 @Input				fScale		Scale of the text
 @Input				Colour		Colour of the text
 @Input				pszFormat	Format string for the text
 @Return			PVR_SUCCESS or PVR_FAIL
 @Description		Display 3D text on screen.
					No window needs to be allocated to use this function.
					However, CPVRTPrint3D::SetTextures(...) must have been called
					beforehand.
					This function accepts formatting in the printf way.
*****************************************************************************/
EPVRTError CPVRTPrint3D::Print3D(float fPosX, float fPosY, const float fScale, unsigned int Colour, const char * const pszFormat, ...)
{
#if !defined (DISABLE_PRINT3D)

	va_list				args;
	static char			Text[MAX_LETTERS+1], sPreviousString[MAX_LETTERS+1];
	static float		XPosPrev, YPosPrev, fScalePrev;
	static unsigned int	ColourPrev;
	static unsigned int	nVertices;

	// No textures! so... no window
	if (!m_bTexturesSet)
	{
		PVRTErrorOutputDebug("DisplayWindow : You must call CPVRTPrint3D::SetTextures(...) before using this function.\n");
		return PVR_FAIL;
	}

	// Reading the arguments to create our Text string
	va_start(args, pszFormat);
#if defined(__SYMBIAN32__) || defined(UITRON) || defined(_UITRON_)
	vsprintf(Text, pszFormat, args);
#else
	vsnprintf(Text, MAX_LETTERS+1, pszFormat, args);
#endif
	va_end(args);

	// nothing to be drawn
	if(*Text == 0)
		return PVR_FAIL;

	// Adjust input parameters
	if(!m_bUsingProjection)
	{
		fPosX *= 640.0f/100.0f;
		fPosY *= 480.0f/100.0f;
	}

	// We check if the string has been changed since last time
	if(
		strcmp (sPreviousString, Text) != 0 ||
		fPosX != XPosPrev ||
		fPosY != YPosPrev ||
		fScale != fScalePrev ||
		Colour != ColourPrev ||
		m_pPrint3dVtx == NULL)
	{
		// copy strings
		strcpy (sPreviousString, Text);
		XPosPrev = fPosX;
		YPosPrev = fPosY;
		fScalePrev = fScale;
		ColourPrev = Colour;

		// Create Vertex Buffer (only if it doesn't exist)
		if(m_pPrint3dVtx == 0)
		{
			m_pPrint3dVtx = (SPVRTPrint3DAPIVertex*)malloc(MAX_LETTERS*4*sizeof(SPVRTPrint3DAPIVertex));

			if(!m_pPrint3dVtx)
				return PVR_FAIL;
		}

		// Fill up our buffer
		nVertices = UpdateLine(0, 0.0f, fPosX, fPosY, fScale, Colour, Text, m_pPrint3dVtx);
	}

	// Draw the text
	DrawLineUP(m_pPrint3dVtx, nVertices);
#endif

	return PVR_SUCCESS;
}