/**
* @brief 绘制指定位置的光标
* 
* 如果光标不在指定位置,则不会绘制
*/
void DrawCursorPos(struct ChessBoard *cp, struct ChessPos pos)
{
    struct ChessPos *cursor;

    //绘制光标
    //仅在游戏正常进行时绘制
    if (cp->gameState == GSTAT_ACTIVE)
    {
        cursor = ActiveCursor(cp);

        if (MatchPos(*cursor, pos.line, pos.row))
        {
            DrawCursor(*cursor, cp->activePlayer);
        }

        if (cp->chessLocked)
        {
            cursor = &cp->lockedCursor;

            if (MatchPos(*cursor, pos.line, pos.row))
            {
                //棋子锁定光标是两玩家共用的
                DrawCursor(*cursor, PLY_BOTH);
            }
        }
    }
}
Beispiel #2
0
// Renders the buffer to the screen.
void CConsole::DrawBuffer(CTextRenderer& textRenderer)
{
	if (m_fHeight < m_iFontHeight)
		return;

	CMatrix3D savedTransform = textRenderer.GetTransform();

	textRenderer.Translate(2.0f, m_fHeight - (float)m_iFontOffset + 1.0f, 0.0f);

	textRenderer.Color(1.0f, 1.0f, 0.0f);
	textRenderer.PutAdvance(L"]");

	textRenderer.Color(1.0f, 1.0f, 1.0f);

	if (m_iBufferPos == 0)
		DrawCursor(textRenderer);

	for (int i = 0; i < m_iBufferLength; i++)
	{
		textRenderer.PrintfAdvance(L"%lc", m_szBuffer[i]);
		if (m_iBufferPos-1 == i)
			DrawCursor(textRenderer);
	}

	textRenderer.SetTransform(savedTransform);
}
Beispiel #3
0
void GraphView::CurrentProbeChanged(Draw *draw, int pi, int ni, int d) {

	wxRegion reg;

	DrawCursor(pi, true, &reg);

	int i = d;
	if (i)
		i = i > 0 ? -1 : 1;

	if (m_draw->GetDoubleCursor() && ni >= 0) {
		int vd = m_draw->GetValuesTable().size();

		int s, e;

		if (d >= 0) {
			s = std::max(0, ni - d);
			e = ni;
		} else {
			s = ni;
			e = std::min(vd - 1, ni - d);
		}

		for (int i = s; i <= e; ++i) 
			DrawPoint(i, &reg, false);
	}

	DrawCursor(ni, false, &reg);

	m_graphs->UpdateArea(reg);

}
Beispiel #4
0
void
MFCSequenceEditor::OnDraw(CDC* pdc)
{
	CRect	clipBox;
	int		cbType;
	cbType = pdc->GetClipBox(&clipBox);
//	fprintf(stderr, "OnDraw() clip (%d %d %d %d) type %s\n", clipBox.left, clipBox.top, clipBox.right, clipBox.bottom, cbType==COMPLEXREGION?"complex":cbType==SIMPLEREGION?"simple":cbType==NULLREGION?"null":"error");
//	fprintf(stderr, "lt %d\n", lastScheduledEvent.ticks);
	CDocument* pDoc = GetDocument();
#ifdef QUA_V_GDI_PLUS
	Graphics	graphics(pdc->m_hDC);
	DrawGridGraphics(graphics, clipBox);

// test the interoperation of GDI and GDI+
//	Color	p = Color::MakeARGB(100, 255, 20, 255);
//	Pen	semip(p, 3);
//	graphics.DrawLine(&semip, 0,0, 200, 200);
//	for (short i=0; i<NIR(); i++) {
//		MFCInstanceView *ir = (MFCInstanceView *)IR(i);
//		if (ir->bounds.Intersects(clipBox)) {
//			ir->Draw(&graphics, &clipBox);
//		}
//	}
	DrawCursor(graphics, clipBox);
#else
	DrawGrid(pdc, &clipBox);
	DrawCursor(pdc, &clipBox);
#endif
//	fprintf(stderr, "OnDraw() finito\n");
}
Beispiel #5
0
void
ViewBuffer::MoveCursor(int32 x, int32 y)
{
	DrawCursor(fCursorX, fCursorY);
	DrawCursor(x, y);
	
	fCursorX = x;
	fCursorY = y;
}
Beispiel #6
0
void CGame::PlayTurn() {

	int x,y;

	scare_mouse();
	DrawBoard();
	DrawPlayer();
	DrawScores();
	DrawCursor();

	blit(background, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
	unscare_mouse();

	while (!players[currplayer].Done()) {

		if (mouse_b & 1) {

			x = mouse_x;
			y = mouse_y;
			players[currplayer].HandleMouse(x,y);
			rest (200); //rest for a bit so it doesnt keep catching mouse clicks
			
			scare_mouse();
			DrawBoard();
			DrawScores(); //shouldnt have to redraw this, but i dont have time to do a decent redraw management system
			if (!players[currplayer].Done())
				DrawPlayer(); //only redraw if not at end of turn
			DrawCursor();
	
			blit(background, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
			unscare_mouse();
		}

		
	}//end while

	players[currplayer].ResetTurnComplete();
		

	//update currplayer

	int oldcurrplayer;
	oldcurrplayer = currplayer;

	do {
		if (currplayer == (numplayers-1)) {  //if currplayer is last in line
			currplayer = 0;
		}
		else {
			currplayer++;
		}

	//stop increment currplayer if the curr isnt playing AND we have gone through the whole list already
	} while (!players[currplayer].stillplaying && currplayer != oldcurrplayer);


}
void					
BF_GUI_ColorView::MouseDown(BPoint point)
{
	if(point.x>255) return;
	DrawCursor(false);
	*piColor = (uint8)point.x;	
	DrawCursor(true);
	
	poUnit->Draw(poUnit->Bounds());
}
/*-----------------------------------------------------------------*/
void __fastcall TChoosePaletteForm::SelectColor (COLORREF _color)
{
    EraseCursor();
    for (int i=0; i<MAX_PAL_ENTRY; i++)
        if (_color==Data->palette->GetColor(i)) {
            index = i;
            DrawCursor();
            return;
        }
    index = 0;
    DrawCursor();
}
/**
**  Display update.
**
**  This functions updates everything on screen. The map, the gui, the
**  cursors.
*/
void UpdateDisplay()
{
	if (GameRunning || Editor.Running == EditorEditing) {
		DrawMapArea();
		DrawMessages();

		if (CursorState == CursorStateRectangle) {
			DrawCursor();
		}

		if ((Preference.BigScreen && !BigMapMode) || (!Preference.BigScreen && BigMapMode)) {
			UiToggleBigMap();
		}

		if (!BigMapMode) {
			for (size_t i = 0; i < UI.Fillers.size(); ++i) {
				UI.Fillers[i].G->DrawSubClip(0, 0,
											 UI.Fillers[i].G->Width,
											 UI.Fillers[i].G->Height,
											 UI.Fillers[i].X, UI.Fillers[i].Y);
			}
			DrawMenuButtonArea();
			DrawUserDefinedButtons();

			UI.Minimap.Draw();
			UI.Minimap.DrawViewportArea(*UI.SelectedViewport);

			UI.InfoPanel.Draw();
			DrawResources();
			UI.StatusLine.Draw();
			UI.StatusLine.DrawCosts();
			UI.ButtonPanel.Draw();
		}

		DrawTimer();
	}

	DrawPieMenu(); // draw pie menu only if needed

	DrawGuichanWidgets();

	if (CursorState != CursorStateRectangle) {
		DrawCursor();
	}

	//
	// Update changes to display.
	//
	Invalidate();
}
Beispiel #10
0
void Game::ComposeFrame()
{
	const int baseX = 100;
	const int baseY = 100;

	if( CheckForVictory() == EMPTY )
	{
		DrawGrid( baseX, baseY );

		DoUserInput();
		DrawCursor( cursorX, cursorY );
	}
	else {
		DrawGrid( baseX, baseY );

		if( CheckForVictory() == X ){
			winR = 255;
		}
		else {
			winB = 255;
		}

		gfx.DrawLine( winX1 + 50, winY1 + 140, winX2 + 50, winY2 + 140, winR, 0, winB );
	}

	
}
void
BF_GUI_ColorView::Draw(BRect o_Rect)
{
	// fill back //
	SetHighColor(SYS_COLOR(BF_COLOR_DIALOG_BACK));
	BRect oRect(Bounds());	
	FillRect(oRect);		
	
	// draw lines //
	BPoint oPointTop(0,4),oPointBottom(0,oRect.Height()-4);
	rgb_color oCol;
	RGB_SET(oCol,0,0,0);
	for(int32 i=0;i<256;i++){	
		SetHighColor(oCol);
		
		StrokeLine(oPointTop,oPointBottom);
		
		oPointTop.x++;
		oPointBottom.x++;

		if(iColorIndex==0) oCol.red++;else
		if(iColorIndex==1) oCol.green++;else
		if(iColorIndex==2) oCol.blue++;
	}
	DrawCursor(true);
}
Beispiel #12
0
void PageSettingsTabs1::SetCursor(void)
{
  CRect rectCursorAnim;
  m_staticCursorAnim.GetClientRect(&rectCursorAnim);
  CClientDC dc(m_staticCursorAnim.m_hWnd);
  CBrush brush(::CreateSolidBrush(RGB(0,0,0)));
  dc.FillRect(rectCursorAnim, brush);

  rectCursorAnim.right  -= 12;
  rectCursorAnim.right  /= 2;
  rectCursorAnim.bottom -= 8;

  m_cursor.reset();
  m_cursor = CursorFactory::CreateCursor(
    m_hWnd,
    true,
    static_cast<CursorStyle>(m_comboCursor.GetCurSel()),
    dc,
    rectCursorAnim,
    m_tabData->crCursorColor,
    this,
    true);

  DrawCursor();
}
Beispiel #13
0
void RegistLoop (double timestep ){
	int ww = param.x_resolution;
	int hh = param.y_resolution;
	Music.Update ();    
	check_gl_error();
    ClearRenderContext ();
    set_gl_options (GUI);
    SetupGuiDisplay ();
	TColor col;
		
	update_ui_snow (timestep);
	draw_ui_snow();

	Tex.Draw (BOTTOM_LEFT, 0, hh - 256, 1);
	Tex.Draw (BOTTOM_RIGHT, ww-256, hh-256, 1);
	Tex.Draw (TOP_LEFT, 0, 0, 1);
	Tex.Draw (TOP_RIGHT, ww-256, 0, 1);
	Tex.Draw (T_TITLE_SMALL, CENTER, AutoYPosN (5), scale);

//	DrawFrameX (area.left, area.top, area.right-area.left, area.bottom - area.top, 
//			0, colMBackgr, col, 0.2);

	FT.AutoSizeN (3);
	FT.SetColor (colWhite);
	int top = AutoYPosN (24);
	FT.DrawString (area.left, top, "Select your player name:");
	FT.DrawString (area.left + framewidth + arrowwidth, top, "Select a character:");

	FT.AutoSizeN (4);
	if (curr_focus == 0) col = colDYell; else col = colWhite;
	DrawFrameX (area.left, area.top, framewidth, frameheight, 3, colMBackgr, col, 1.0);
	FT.SetColor (col);
	FT.DrawString (area.left + 20, area.top, Players.GetName (curr_player));
	Tex.DrawDirectFrame (Players.GetAvatarID (curr_player), 
		area.left + 60, AutoYPosN (40), texsize, texsize, 3, colWhite);

	if (curr_focus == 1) col = colDYell; else col = colWhite;
	DrawFrameX (area.left + framewidth + arrowwidth, area.top, 
		framewidth, frameheight, 3, colMBackgr, col, 1.0);
	FT.SetColor (col);
	FT.DrawString (area.left + framewidth + arrowwidth + 20, 
		area.top, CharList[curr_character].name);
	Tex.DrawDirectFrame (CharList[curr_character].preview, 
		area.right - texsize - 60 - arrowwidth, 
		AutoYPosN (40), texsize, texsize, 3, colWhite);


	FT.SetColor (colWhite);
	PrintArrow (0, (curr_player > 0));	

	PrintArrow (1, (curr_player < last_player));
	PrintArrow (2, (curr_character > 0));	
	PrintArrow (3, (curr_character < last_character));

	PrintTextButton (0, curr_focus);
	PrintTextButton (1, curr_focus);

	if (param.ice_cursor) DrawCursor ();
    Winsys.SwapBuffers();
} 
Beispiel #14
0
/*-----------------------------------------------------------------*/
void __fastcall CrFeld::EnableCursor()
{
    dbw3_assert(frm);
    dbw3_assert(frm->CursorTimer);
    DrawCursor();
    frm->CursorTimer->Enabled = true;
}
Beispiel #15
0
/**
**	Draw the cursor and prepare tobe restored by HideAnyCursor again.
**      Note: This function can be called, without calling HideAnyCursor first,
**            which means that this function should re-use/free memory of the
**            last call.
**            When calling multiple times, the old cursor is expected to be
**            overdrawn by something else (else HideAnyCursor is needed!)
**            Also the cursors are not invalidated (refresh on real screen)
**            here, but this is done by InvalidateCursorAreas.
**
**  FIXME: event handler should be temporary stopped while copying
**         CursorX,CursorY,.. because between two copy commands another
**         event can occure, which let invalid mouse position be delivered.
*/
global void DrawAnyCursor(void)
{
    // Disable any previous drawn cursor
    OldCursorInvalidate=OldCursorW=
	OldCursorRectangleInvalidate=OldCursorRectangleW=
	BuildingCursor=0;

    //
    //	First, Selecting rectangle
    //
    if( CursorState==CursorStateRectangle
	     && (CursorStartX!=CursorX || CursorStartY!=CursorY) ) {
	DrawVisibleRectangleCursor(CursorStartX,CursorStartY,CursorX,CursorY);
    }
    //
    //	Or Selecting position for building
    //
    else if( CursorBuilding && CursorOn==CursorOnMap ) {
	DrawBuildingCursor();
	BuildingCursor=1;
    }

    //
    //	Last, Normal cursor.
    //  This will also save (part of) drawn rectangle cursor, but that's ok.
    //
    DrawCursor(GameCursor,CursorX,CursorY,GameCursor->SpriteFrame);
}
static void GameSelectLoop (double time_step) {
	int ww = param.x_resolution;
	int hh = param.y_resolution;

	check_gl_error();
	Music.Update ();    
    set_gl_options (GUI);
    ClearRenderContext ();
    SetupGuiDisplay ();
    
	if (param.ui_snow) {
		update_ui_snow (time_step);
		draw_ui_snow();
    }

	Tex.Draw (T_TITLE, CENTER, AutoYPosN (5), param.scale);
	Tex.Draw (BOTTOM_LEFT, 0, hh-256, 1);
	Tex.Draw (BOTTOM_RIGHT, ww-256, hh-256, 1);
	Tex.Draw (TOP_LEFT, 0, 0, 1);
	Tex.Draw (TOP_RIGHT, ww-256, 0, 1);

	PrintTextButton (0, scope);
	PrintTextButton (1, scope);
	PrintTextButton (2, scope);
	PrintTextButton (3, scope);
	PrintTextButton (4, scope);
	PrintTextButton (5, scope);
	PrintTextButton (6, scope);

	if (param.ice_cursor) DrawCursor ();
	Reshape (ww, hh);
	Winsys.SwapBuffers ();
}
Beispiel #17
0
/*-----------------------------------------------------------------*/
void __fastcall CrCursorHandlerImpl::EnableCursor()
{
    dbw3_assert(frm);
    dbw3_assert(frm->CursorTimer);
    DrawCursor();
    frm->CursorTimer->Enabled = true;
}
/*-----------------------------------------------------------------*/
void __fastcall TFixeinzugForm::pbFixeinzugPaint(TObject *Sender)
{
    DrawGrid (pbFixeinzug);
    DrawData (pbFixeinzug);
    DrawRange();
    DrawCursor();
}
/*-----------------------------------------------------------------*/
void __fastcall TFixeinzugForm::pbFixeinzugMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y)
{
    int i = X / dx;
    int j = maxy-1 - (Y / dy);

    dbw3_assert(i>=0);
    dbw3_assert(j>=0);

    if (i>=maxx || j>=maxy) return;

    short old = einzug[scrollx+i];
    if (old==j+1) einzug[scrollx+i] = 0;
    else einzug[scrollx+i] = short(j+1);
    changed = true;
    CalcRange();
    if (old!=0) {
        pbFixeinzug->Canvas->Pen->Color = clBtnFace;
        pbFixeinzug->Canvas->Brush->Color = clBtnFace;
        pbFixeinzug->Canvas->Rectangle (i*dx+2, (maxy-old)*dy+2, (i+1)*dx-1, (maxy-old+1)*dy-1);
    }
    DrawData (pbFixeinzug, i);
    DeleteCursor();
    cx = i;
    cy = j;
    DeleteRange();
    CalcRange();
    DrawRange();
    DrawCursor();
}
Beispiel #20
0
/**
**	Draw the cursor
*/
global void DrawAnyCursor(void)
{
    RectangleCursor=BuildingCursor=0;

    //
    //	Selecting rectangle
    //
    if( CursorState==CursorStateRectangle
	     && (CursorStartX!=CursorX || CursorStartY!=CursorY) ) {
	DrawRectangleCursor();
	RectangleCursor=1;
    } else

    //
    //	Selecting position for building
    //
    if( CursorBuilding && CursorOn==CursorOnMap ) {
	DrawBuildingCursor();
	BuildingCursor=1;
    }

    //
    //	Normal cursor.
    //
    DrawCursor(CloneCursor,CursorX,CursorY,0);
}
Beispiel #21
0
void
ViewBuffer::Draw(BRect updateRect)
{
	if (fGlyphGrid) {
		int32 startX	= max_c(0, (int32)(updateRect.left / CHAR_WIDTH));
		int32 endX		= min_c(fColumns - 1, (int32)(updateRect.right / CHAR_WIDTH) + 1);
		int32 startY	= max_c(0, (int32)(updateRect.top / CHAR_HEIGHT));
		int32 endY		= min_c(fRows - 1, (int32)(updateRect.bottom / CHAR_HEIGHT) + 1);

		char string[2];
		string[1] = 0;

		for (int32 y = startY; y <= endY; y++) {
			for (int32 x = startX; x <= endX; x++) {
				uint16 grid = fGlyphGrid[y * fColumns + x];
				uint8 glyph = grid >> 8;
				uint8 attr = grid & 0x00ff;
				string[0] = glyph;
				_RenderGlyph(x, y, string, attr, false);
			}
		}
	}

	DrawCursor(fCursorX, fCursorY);
}
void CWindowOPTION_TASKBAR::Draw(PCImg32 pDst)
{
	int nLevel;
	HDC hDC;
	HFONT hFontOld;
	COLORREF clText;

	if (m_dwTimeDrawStart) {
		goto Exit;
	}

	DrawFrame ();

	clText		= RGB (1, 1, 1);
	hDC			= m_pDib->Lock ();
	hFontOld	= (HFONT)SelectObject (hDC, m_hFont);
	SetBkMode (hDC, TRANSPARENT);

	TextOut2 (hDC, 32, 16 + 16 * 0, "ON",	clText);
	TextOut2 (hDC, 32, 16 + 16 * 1, "OFF",	clText);

	SelectObject (hDC, hFontOld);
	m_pDib->Unlock ();

	DrawCursor (8, 16 + 16 * m_nPos);
	m_dwTimeDrawStart = timeGetTime ();

Exit:
	nLevel = 100;
	if (m_bActive == FALSE) {
		nLevel = 60;
	}
	pDst->BltLevel (m_ptViewPos.x + 32, m_ptViewPos.y + 32, m_sizeWindow.cx, m_sizeWindow.cy, m_pDib, 0, 0, nLevel, TRUE);
}
int DrawOpening()
{
	//int hoOldTime = GetCurrentTime();
	if(lpOpening == NULL || lpLogin == NULL)
		return FALSE;

	if(WorkMode == OPENING_MODE)
		lpOpening->Draw();
	else if(WorkMode == LOGIN_MODE)
		lpLogin->Draw();
	

	if(lpD3DDevice && LoginEndFlag == FALSE)
	{
		lpD3DDevice->BeginScene();
		
			/*
			POINT mousePos;
			GetCursorPos(&mousePos);
			ScreenToClient(hwnd, &mousePos);
			dsDrawTexImage(MatHoCursorDefault , mousePos.x, mousePos.y ,32,32,255);
			*/

			DrawCursor();
		lpD3DDevice->EndScene();
	}
	if(LoginEndFlag)
		CursorShowFlag = FALSE;
	return TRUE;
}
Beispiel #24
0
asm .MODEL TINY

int PutChar(unsigned char ch) /* public */
{
    int i;
    /* unsigned short offset = GetVideoOffset(current_row,current_col); */
    UnDrawCursor();
    if(ch == '\n')
    {
        GoNextRow();
    }
    else if(ch == '\r')
    {
        GoFirstColumn();
    }
    else if(ch == '\t')
    {
        /* Make current_col align to a 4-character span */
        i = 4 - (current_col % 4);
        /* Although it is a recursive call, we will not make it true recursive */
        for(;i > 0;i--) PutChar(' ');
    }
    else
    {
        video_char_ptr[current_offset] = ch;
        video_char_ptr[current_offset + 1] = default_mode;
        GoNextPosition();
    }
    DrawCursor();
    return ch;
}
/*-----------------------------------------------------------------*/
void __fastcall TChoosePaletteForm::DummyEditKeyDown(TObject *Sender, WORD &Key, TShiftState Shift)
{
    int x = index/GRIDSIZE;
    int y = index%GRIDSIZE;

    switch (Key) {
        case VK_LEFT:
            if (x>0) --x;
            break;

        case VK_RIGHT:
            if (x<15) ++x;
            break;

        case VK_UP:
            if (y>0) --y;
            else if (x>0) { y=15; --x; }
            break;

        case VK_DOWN:
            if (y<15) ++y;
            else if (x<15) { y=0; ++x; }
            break;
    }

    int newcol = x*GRIDSIZE+y;
    if (newcol!=index && newcol<MAX_PAL_ENTRY) {
        EraseCursor();
        index = x*GRIDSIZE+y;
        DrawCursor();
    }
}
Beispiel #26
0
/**
**  Display update.
**
**  This functions updates everything on screen. The map, the gui, the
**  cursors.
*/
void UpdateDisplay(void)
{
	if (GameRunning || Editor.Running == EditorEditing) {
		DrawMapArea();
		DrawMessages();

		if (CursorState == CursorStateRectangle) {
			DrawCursor();
		}

		if (!BigMapMode) {
			for (int i = 0; i < (int)UI.Fillers.size(); ++i) {
				UI.Fillers[i].G->DrawSubClip(0, 0,
					UI.Fillers[i].G->Width,
					UI.Fillers[i].G->Height,
					UI.Fillers[i].X, UI.Fillers[i].Y);
			}
			DrawMenuButtonArea();

			UI.Minimap.Draw(UI.SelectedViewport->MapX, UI.SelectedViewport->MapY);
			UI.Minimap.DrawCursor(UI.SelectedViewport->MapX,
				UI.SelectedViewport->MapY);

			UI.InfoPanel.Draw();
			UI.ButtonPanel.Draw();
			DrawResources();
			UI.StatusLine.Draw();
		}

		DrawCosts();
		DrawTimer();
	}

	DrawPieMenu(); // draw pie menu only if needed

	DrawGuichanWidgets();
	
	if (CursorState != CursorStateRectangle) {
		DrawCursor();
	}

	//
	// Update changes to display.
	//
	Invalidate();
}
Beispiel #27
0
void CComposingView::DrawForPinyin(
    /* [in] */ ICanvas* canvas)
{
    Float x, y, value;
    Int32 top = 0;
    x = mPaddingLeft + LEFT_RIGHT_MARGIN;
    y = -(mFmi->GetTop(&top), top) + mPaddingTop;

    mPaint->SetColor(mStrColor);

    Int32 cursorPos = 0;
    mDecInfo->GetCursorPosInCmpsDisplay(&cursorPos);
    Int32 cmpsPos = cursorPos;
    String cmpsStr;
    mDecInfo->GetComposingStrForDisplay(&cmpsStr);
    Int32 activeCmpsLen = 0;
    mDecInfo->GetActiveCmpsDisplayLen(&activeCmpsLen);
    if (cursorPos > activeCmpsLen) cmpsPos = activeCmpsLen;
    canvas->DrawText(cmpsStr, 0, cmpsPos, x, y, mPaint);
    x += (mPaint->MeasureText(cmpsStr, 0, cmpsPos, &value), value);
    if (cursorPos <= activeCmpsLen) {
        if (ComposingStatus_EDIT_PINYIN == mComposingStatus) {
            DrawCursor(canvas, x);
        }
        canvas->DrawText(cmpsStr, cmpsPos, activeCmpsLen, x, y, mPaint);
    }

    x += (mPaint->MeasureText(cmpsStr, cmpsPos, activeCmpsLen, &value), value);

    if ((Int32)cmpsStr.GetLength() > activeCmpsLen) {
        mPaint->SetColor(mStrColorIdle);
        Int32 oriPos = activeCmpsLen;
        if (cursorPos > activeCmpsLen) {
            if (cursorPos > (Int32)cmpsStr.GetLength()) cursorPos = cmpsStr.GetLength();
            canvas->DrawText(cmpsStr, oriPos, cursorPos, x, y, mPaint);
            x += (mPaint->MeasureText(cmpsStr, oriPos, cursorPos, &value), value);

            if (ComposingStatus_EDIT_PINYIN == mComposingStatus) {
                DrawCursor(canvas, x);
            }

            oriPos = cursorPos;
        }
        canvas->DrawText(cmpsStr, oriPos, cmpsStr.GetLength(), x, y, mPaint);
    }
}
/*-----------------------------------------------------------------*/
void __fastcall TChoosePaletteForm::pbColorsMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y)
{
    if (Button==mbLeft) {
        EraseCursor();
        SetCursor(X, Y);
        DrawCursor();
    }
}
void EventSelectLoop (double timestep) {
	int ww = param.x_resolution;
	int hh = param.y_resolution;
	TColor col;
		
	check_gl_error();
   	set_gl_options (GUI );
	Music.Update ();    
    ClearRenderContext ();
	SetupGuiDisplay ();

	if (param.ui_snow) {
		update_ui_snow (timestep);
		draw_ui_snow ();
	}

	Tex.Draw (T_TITLE_SMALL, CENTER, AutoYPosN (5), param.scale);
	Tex.Draw (BOTTOM_LEFT, 0, hh-256, 1);
	Tex.Draw (BOTTOM_RIGHT, ww-256, hh-256, 1);
	Tex.Draw (TOP_LEFT, 0, 0, 1);
	Tex.Draw (TOP_RIGHT, ww-256, 0, 1);
	
//	DrawFrameX (area.left, area.top, area.right-area.left, area.bottom - area.top, 
//			0, colMBackgr, colBlack, 0.2);

	FT.AutoSizeN (3);
	FT.SetColor (colWhite);
	FT.DrawString (area.left, AutoYPosN (30), Trans.Text (6));
	FT.DrawString (area.left,AutoYPosN (45), Trans.Text (7));
	if (Events.IsUnlocked (curr_event, curr_cup) == false) {
		FT.SetColor (colLGrey);
 		FT.DrawString (CENTER, AutoYPosN (58), Trans.Text (10));
	}

	FT.AutoSizeN (4);

	if (curr_focus == 0) col = colDYell; else col = colWhite;
	DrawFrameX (area.left, frametop1, framewidth, frameheight, 3, colMBackgr, col, 1.0);
	FT.SetColor (colDYell);
	FT.DrawString (area.left + 20, frametop1, EventList[curr_event].name);

	if (curr_focus == 1) col = colDYell; else col = colWhite;
	DrawFrameX (area.left, frametop2, framewidth, frameheight, 3, colMBackgr, col, 1.0);
	if (Events.IsUnlocked (curr_event, curr_cup)) FT.SetColor (colDYell); 
		else FT.SetColor (colLGrey);
	FT.DrawString (area.left + 20, frametop2, Events.GetCupTrivialName (curr_event, curr_cup));

	PrintArrow (0, (curr_event > 0));	
	PrintArrow (1, (curr_event < last_event));
	PrintArrow (2, (curr_cup > 0));	
	PrintArrow (3, (curr_cup < last_cup));

	if (Events.IsUnlocked (curr_event, curr_cup)) PrintTextButton (0, curr_focus);
	PrintTextButton (1, curr_focus);

	if (param.ice_cursor) DrawCursor ();
    SDL_GL_SwapBuffers ();
}
LRESULT PageSettingsTabs1::OnTimer(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
    if ((wParam == CURSOR_TIMER) && (m_cursor.get() != NULL))
    {
        DrawCursor();
    }

    return 0;
}