void DrawStartingBoard(string choice) { int i; string letter[10]={"A","B","C","D","E","F","G","H","I","J"}; if( StringEqual(choice,"y") ) { PlayNamedSound("Fanfare"); } for (i=0;i<=NUM_COLS;i++) { if (i!=NUM_COLS) { MovePen((i+1.3)*LG,GetWindowHeight()-LG); DrawTextString(IntegerToString(i)); } MovePen((i+1)*LG,GetWindowHeight()-1.3*LG); DrawLine(0,(-NUM_ROWS)*LG); } for (i=0;i<=NUM_ROWS;i++) { if (i!=NUM_ROWS) { MovePen(LG/4,GetWindowHeight()-(11.1-i)*LG); DrawTextString(letter[9-i]); } MovePen(LG,GetWindowHeight()-(11.3-i)*LG); DrawLine((NUM_COLS)*LG,0); } }
/////////////////////////////////////////////////////////////////////////////// // // draw_mem function // // author: Shaun Gruenig, Hannah Aker, Kelsey Bellew // // description: This function call the appropriate GUI functions to create // a graphical representation of the physical memory. // // /////////////////////////////////////////////////////////////////////////////// void draw_mem ( void ) { glClear ( GL_COLOR_BUFFER_BIT ); glutSetWindowTitle ( "Memory Contents" ); int i, j, yval; int address_num = 0; string t; stringstream out; char temp; char *f; int size = memvec.size(); for ( j = 0; j < 8; j++ ) { for ( i = 0; i < 32; i++ ) { yval = ScreenHeight - 25 * i; out << address_num << " "; out << ( bitset<sizeof ( address ) * 8> ) memvec[address_num++]; t = out.str(); f = ( char* ) t.c_str(); DrawTextString ( f, j * 130 + 3, yval - 20, Black ); out.str ( "" ); DrawRectangle ( ( j * 130 ) + 30, yval, ( j + 1 ) * 130, yval - 25, Black ); } } glFlush(); }
void DrawButtonText(buttonT & button) { SetFont(BUTTON_FONT); SetStyle(BUTTON_STYLE); SetPointSize(BUTTON_POINT_SIZE); MovePen(button.x + (button.width - TextStringWidth(button.name)) / 2, button.y + (button.height + GetFontAscent()) / 2); DrawTextString(button.name); }
/* * Function: DrawCenteredChar * -------------------------- * Used to draw the letters in the center of the cube. * Note that this function centers the char * both vertically and horizontally around the point specified. */ static void DrawCenteredChar(double centerX, double centerY, char ch) { string s(1, ch); SetFont(CUBE_FONT); SetPointSize(gState.cubeFontSize); MovePen(centerX - TextStringWidth(s)/2, centerY - GetFontAscent()/2); DrawTextString(s); }
/////////////////////////////////////////////////////////////////////////////// // // draw_pt function // // author: Shaun Gruenig, Hannah Aker, Kelsey Bellew // // description: This function call the appropriate GUI functions to create // a graphical representation of the page table. // // /////////////////////////////////////////////////////////////////////////////// void draw_pt ( void ) { glClear ( GL_COLOR_BUFFER_BIT ); glutSetWindowTitle ( "Page Table" ); int i, yval; string t; stringstream out; char temp; char *f; int size = ptvec.size(); for ( i = 0; i < size / 2; i++ ) { yval = ScreenHeight - 30 * i - 20; out << i << " "; out << ( bitset < sizeof ( data ) * 8 - PAGE_SIZE > ) ptvec[i]; t = out.str(); f = ( char* ) t.c_str(); DrawTextString ( f, 2, yval, Black ); out.str ( "" ); } for ( i = size / 2; i < size; i++ ) { yval = ScreenHeight - 30 * ( i - size / 2 ) - 20; out << i << " "; out << ( bitset < sizeof ( data ) * 8 - PAGE_SIZE > ) ptvec[i]; t = out.str(); f = ( char* ) t.c_str(); DrawTextString ( f, 122, yval, Black ); out.str ( "" ); } for ( i = 0; i < size; i++ ) { yval = ScreenHeight - 30 * i; DrawRectangle ( 20, yval, 120, yval - 30, Black ); DrawRectangle ( 140, yval, 240, yval - 30, Black ); } glFlush(); }
static void DrawCenteredText(string text, double cx, double cy, string color) { double x = cx - TextStringWidth(text)/2; double y = cy - GetFontAscent()/2; MovePen(x, y); string oldColor = GetPenColor(); SetPenColor(color); DrawTextString(text); SetPenColor(oldColor); }
void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice, int left, int top, CPDF_Font* pFont, int height, const CFX_ByteString& str, FX_ARGB argb) { FX_RECT font_bbox; pFont->GetFontBBox(font_bbox); FX_FLOAT font_size = (FX_FLOAT)height * 1000.0f / (FX_FLOAT)(font_bbox.top - font_bbox.bottom); FX_FLOAT origin_x = (FX_FLOAT)left; FX_FLOAT origin_y = (FX_FLOAT)top + font_size * (FX_FLOAT)font_bbox.top / 1000.0f; CFX_AffineMatrix matrix(1.0f, 0, 0, -1.0f, 0, 0); DrawTextString(pDevice, origin_x, origin_y, pFont, font_size, &matrix, str, argb); }
void AppMainThread(void* param) { fresult fres = App.Init(); if (fres!=SUCCESS) { char* err = "Failed to init App"; DrawTextString(10,10,err,Length(err),WHITE,0); return; } RegisterButtonHandlers(AppOnButtonClick, AppOnButtonHold); fres = App.Start(); if (fres!=SUCCESS) { char* err = "Failed to Show main form"; DrawTextString(10,10,err,Length(err),WHITE,0); return; } }
/* * Function: DrawPlayerLabel * ------------------------- * Labels player word list with specified name and draws a line underneath the label. * It also resets the player's score and word list count back to zero. */ static void DrawPlayerLabel(playerT player, string name) { SetPenColor("Label Color"); MovePen(gState.scoreBox[player].x, gState.scoreBox[player].y); DrawLine(gState.scoreBox[player].w , 0); SetFont(SCORE_FONT); SetPointSize(SCORE_FONT_SIZE); MovePen(gState.scoreBox[player].x, gState.scoreBox[player].y + GetFontDescent()); DrawTextString(name); gState.scores[player] = gState.numWords[player] = 0; }
/* * Function: DrawOneScore * ---------------------- * Draws the specified score for the player according to player enum. */ static void DrawOneScore(playerT playerNum, int value) { SetFont(SCORE_FONT); SetPointSize(SCORE_FONT_SIZE); SetPenColor("Label Color"); string str = IntegerToString(value); MovePen(gState.scoreBox[playerNum].x + gState.scoreBox[playerNum].w - TextStringWidth(str), gState.scoreBox[playerNum].y + GetFontDescent() + 0.03); // the 0.03 hack added Sept-2011 // Using SetEraseMode() to delete old score interfered with the line underneath DrawTextString(str); }
/////////////////////////////////////////////////////////////////////////////// // // draw_tlb function // // author: Shaun Gruenig, Hannah Aker, Kelsey Bellew // // description: This function call the appropriate GUI functions to create // a graphical representation of the translation look-aside // buffer. // // /////////////////////////////////////////////////////////////////////////////// void draw_tlb ( void ) { glClear ( GL_COLOR_BUFFER_BIT ); glutSetWindowTitle ( "TLB" ); int i, yval; string t; stringstream out; char *f; int size = tlbvec.size(); for ( i = 0; i < size; i++ ) { yval = ScreenHeight - 30 * i - 20; out << ( bitset < sizeof ( data ) * 8 - PAGE_SIZE > ) tlbvec[i].first; t = out.str(); f = ( char* ) t.c_str(); DrawTextString ( f, 25, yval, Black ); out.str ( "" ); out << ( bitset < sizeof ( data ) * 8 - PAGE_SIZE > ) tlbvec[i].second; t = out.str(); f = ( char* ) t.c_str(); DrawTextString ( f, 125, yval, Black ); out.str ( "" ); } for ( i = 0; i < TLB_SIZE; i++ ) { yval = ScreenHeight - 30 * i; DrawRectangle ( 0, yval, 100, yval - 30, Black ); DrawRectangle ( 100, yval, 200, yval - 30, Black ); } glFlush(); }
/* Function: DrawFilledCircleWithLabel * Usage: DrawFilledCircleWithLabel(center, .25, "Green", "You are here"); * ----------------------------------------------------------------------- * Uses facilities from extgraph to draw a circle filled with * color specified. The circle is centered at the given coord has the * specified radius. A label is drawn to the right of the circle. * If you don't want a label, pass the empty string. */ void DrawFilledCircleWithLabel(coordT center, double radius, string color, string label) { MovePen(center.x + radius, center.y); SetPenColor(color); StartFilledRegion(1.0); DrawArc(radius, 0, 360); EndFilledRegion(); MovePen(center.x + radius, center.y); SetFont("Helvetica"); SetPointSize(FONT_SIZE); DrawTextString(label); }
void DrawPathfinderNode(pointT center, string color, string label) { MovePen(center.x + NODE_RADIUS, center.y); SetPenColor(color); StartFilledRegion(1.0); DrawArc(NODE_RADIUS, 0, 360); EndFilledRegion(); if (!label.empty()) { MovePen(center.x + NODE_RADIUS + 2, center.y + 0.4 * GetFontAscent()); SetFont("Helvetica"); SetPointSize(FONT_SIZE); DrawTextString(label); } }
/* Function: DrawFilledCircleWithLabel * Usage: DrawFilledCircleWithLabel(center, "Green", "You are here"); * ------------------------------------------------------------------- * Uses facilities from extgraph to draw a circle filled with * color specified. The circle is centered at the given coord has the * specified radius. A label is drawn to the right of the circle. * You can leave off the last argument if no label is desired. */ void DrawFilledCircleWithLabel(coordT center, string color, string label) { MovePen(center.x + CircleRadius, center.y); SetPenColor(color); StartFilledRegion(1.0); DrawArc(CircleRadius, 0, 360); EndFilledRegion(); if (!label.empty()) { MovePen(center.x + CircleRadius, center.y); SetFont("Helvetica"); SetPointSize(LabelFontSize); DrawTextString(label); } }
void DrawPrintfMessage(string message) { MovePen( LG , GetWindowHeight()-11.5*LG ); SetPenColor("White"); StartFilledRegion(1); DrawLine(0,-2*LG); DrawLine(23*LG,0); DrawLine(0,2*LG); DrawLine(-23*LG,0); EndFilledRegion(); SetPenColor("Black"); MovePen( 2*LG , GetWindowHeight()-12.3*LG ); DrawTextString(message); }
/* * Function: RecordWordForPlayer * ----------------------------- * Exported function to add a word to a player's list and update * their score accordingly. It keeps track of the number of * words recorded for each player and position each successive word * in rows and columms from left to right, top to bottom. It * also updates the scoreboards with point additions. */ void RecordWordForPlayer(string word, playerT player) { if (player != Human && player != Computer) Error("RecordWordForPlayer called with invalid player argument."); word = ConvertToLowerCase(word); SetFont(WORD_FONT); SetPointSize(WORD_FONT_SIZE); SetPenColor("Word Color"); int numWordsInRow = gState.scoreBox[player].w/gState.wordColumnWidth; int row = gState.numWords[player] / numWordsInRow; int col = gState.numWords[player] % numWordsInRow; MovePen(gState.scoreBox[player].x + col*gState.wordColumnWidth, gState.scoreBox[player].y -(row+1)*GetFontHeight()); DrawTextString(word); gState.numWords[player]++; AddToScoreForPlayer(word.length() - 3, player); // +1 pt for each letter over length 4 if (col == numWordsInRow -1) UpdateDisplay(); // force update when completing a row }
bool __CALLOUT InitializeShell() { Clear(BLUE); const char* str = "PRICE of HONOR!"; DrawTextString(40,60,str,Length(str),RED,BLUE); GetBatteryLevel(); SetScreenBrightness(100); char buff[200]; int res = snprintf(buff,sizeof(buff),"test %d",0); DrawPixel(1,1,WHITE); DoVibroAndBeep(500); ubyte_t l = GetLustraId(); SendRadioPacket(NULL,0); uword_t a = GetArmletId(); FILE log; OpenFile(&log, "log.txt", true); char* s = "log test"; WriteFile(&log, s, Length(s)); /* //int i = 0; //Color area[100]; //for (i=0; i<100; i++) area[i] = 0xF0F; //DrawArea(5,5,area,100,10,10); //WriteFile(&log, (char*)area, 100); //for (i=0; i<100; i++) area[i] = 0x0; //ReadFile(&log, (char*)area, 100); //AppendFile(&log, (char*)area, 100); //DrawArea(5,5,area,100,10,10); */ RequestTimer(TimerProc,100); int up = GetUpTime(); int rnd = GetRandom(50); //SetCureName is checked in AppMainThread //WritePill is checked in AppMainThread //StartThread(AppMainThread,NULL); return true; //TODO }
void DrawScore(int MissilesLeft,int ShipsLeft,int hit,int total) { MovePen(16.5*LG,GetWindowHeight()); StartFilledRegion(1); SetPenColor("White"); DrawLine(0,-10*LG); DrawLine(7*LG,0); DrawLine(0,10*LG); DrawLine(-7*LG,0); EndFilledRegion(); SetPenColor("Black"); MovePen(17*LG,GetWindowHeight()-4*LG); DrawTextString("Missiles left: "); DrawTextString(IntegerToString(MissilesLeft)); MovePen(17*LG,GetWindowHeight()-5.5*LG); DrawTextString("Ships to sink: "); DrawTextString(IntegerToString(ShipsLeft)); MovePen(17*LG,GetWindowHeight()-7*LG); DrawTextString("Hit rate: "); DrawTextString(IntegerToString(percent(hit,total))); DrawTextString("%"); }
//绘画界面 void CGameClientView::DrawGameView(CDC * pDC, int nWidth, int nHeight) { //绘画背景 DrawViewImage(pDC,m_ImageBack,enMode_Spread); DrawViewImage(pDC,m_ImageCenter,enMode_Centent); //绘画用户 TCHAR szBuffer[32]; for (WORD i=0;i<GAME_PLAYER;i++) { //变量定义 WORD wUserTimer=GetUserTimer(i); const tagUserData * pUserData=GetUserInfo(i); ///////////////////////////////////////////////////// //tagUserData *pUserData = new tagUserData; //strcpy( (char*)pUserData->szName, "dkjfdkfjdkfj" ); //pUserData->cbUserStatus = US_READY; //wUserTimer = 10; //m_ImageLand.DrawImage(pDC,m_ptLand[i].x,m_ptLand[i].y); //m_wBombTime = 2; //m_bShowWarming[i]=true; //m_bCardCount[i] = 2; //m_cbCallScorePhase=5; //m_bScore[i] = 3; //m_bPass[i]=false; //m_wLandUser = 2; //m_wBombTime=4; /////////////////////////////////////////////////////// //绘画用户 if (pUserData!=NULL) { //用户名字 pDC->SetTextAlign( ( ( i == 2 && ! m_bDeasilOrder ) || ( i == 0 && m_bDeasilOrder ) ) ? TA_RIGHT : TA_LEFT ); pDC->SetTextColor((wUserTimer>0)?RGB(250,250,250):RGB(220,220,220)); DrawTextString( pDC, pUserData->szName, RGB( 255, 255, 255 ), RGB( 0, 0, 0 ), m_ptName[i].x,m_ptName[i].y ); //剩余扑克 // if (i!=1) { _snprintf(szBuffer,sizeof(szBuffer),TEXT("剩余:%d 张"),m_bCardCount[i]); DrawTextString( pDC, szBuffer, RGB( 255, 255, 255 ), RGB( 0, 0, 0 ), m_ptName[i].x,m_ptName[i].y+18 ); } //其他信息 if (wUserTimer!=0) DrawUserTimer(pDC,m_ptTimer[i].x,m_ptTimer[i].y,wUserTimer); if (pUserData->cbUserStatus==US_READY) DrawUserReady(pDC,m_ptReady[i].x,m_ptReady[i].y); DrawUserFace(pDC,pUserData,m_ptFace[i].x,m_ptFace[i].y,pUserData->cbUserStatus==US_OFFLINE); //报牌信息 if(m_bShowWarming[i]) { //创建资源 CFont InfoFont; InfoFont.CreateFont(-40,0,0,0,400,0,0,0,134,3,2,1,2,TEXT("黑体")); //设置 DC pDC->SetTextColor(RGB(255,0,0)); pDC->SetTextAlign(TA_CENTER|TA_TOP); CFont * pOldFont=pDC->SelectObject(&InfoFont); //绘画信息 if ( i == 0 || i == 2) { if ( m_bCardCount[i] == 1) m_ImageOnecardWarming.DrawImage(pDC, m_ptWarmingCard[i].x, m_ptWarmingCard[i].y); else if(m_bCardCount[i] == 2 ) m_ImageTwoCardWarming.DrawImage(pDC, m_ptWarmingCard[i].x, m_ptWarmingCard[i].y); } //清理资源 pDC->SelectObject(pOldFont); InfoFont.DeleteObject(); } //亮牌信息 if ( m_bBrightStart[i] ) { BYTE const SECTION_COUNT = 11; INT nInfoWidth = m_ImageScore.GetWidth() / SECTION_COUNT; INT nInfoHeight = m_ImageScore.GetHeight(); INT nXPos = nInfoWidth * 8 ; m_ImageScore.DrawImage(pDC, m_ptBrightStart[i].x, m_ptBrightStart[i].y, nInfoWidth, nInfoHeight, nXPos, 0 ); } } } //显示倍数 //if ( m_cbCallScorePhase >= CSD_SNATCHLAND && m_cbLandScore > 1 ) //{ // //位置信息 // INT const LAND_TIMES_COUNT = 5; // INT nXPos = 0; // INT nNumWidth = m_ImageLandTimes.GetWidth() / LAND_TIMES_COUNT; // INT nNumHeight = m_ImageLandTimes.GetHeight(); // if ( m_cbLandScore == 2 ) nXPos = 0; // else if ( m_cbLandScore == 3 ) nXPos = nNumWidth; // else if ( m_cbLandScore == 4 ) nXPos = 2 * nNumWidth; // else if ( m_cbLandScore == 5 ) nXPos = 3 * nNumWidth; // INT nSpace = 10; // INT nXStartPos = ( nWidth - ( 2 * nNumWidth - nSpace ) ) / 2; // INT nYStartPos = 250; // //绘画图片 // m_ImageLandTimes.DrawImage( pDC, nXStartPos, nYStartPos, nNumWidth, nNumHeight, nNumWidth * 4, 0 ); // m_ImageLandTimes.DrawImage( pDC, nXStartPos+nNumWidth-nSpace, nYStartPos, nNumWidth, nNumHeight, nXPos, 0 ); //} //叫分标志 int nXImagePos,nImageWidth=m_ImageScore.GetWidth(),nImageHeight=m_ImageScore.GetHeight(); for (WORD i=0;i<3;i++) { if ((m_bScore[i]!=0)||(m_bPass[i]==true) || m_bDoubleScore[i]==true) { BYTE const SECTION_COUNT = 11; if ( m_bPass[i]==true ) nXImagePos=m_ImageScore.GetWidth()*4/SECTION_COUNT; else if ( m_bScore[i]==255 && m_cbUserPhase[i] == CSD_SNATCHLAND ) nXImagePos=m_ImageScore.GetWidth()*6/SECTION_COUNT; else if ( m_bScore[i]==255 && m_cbUserPhase[i] == CSD_BRIGHTCARD ) nXImagePos=m_ImageScore.GetWidth()*10/SECTION_COUNT; else if ( m_bScore[i]==255 ) nXImagePos=m_ImageScore.GetWidth()*3/SECTION_COUNT; else if (m_bScore[i]==4) nXImagePos=7*m_ImageScore.GetWidth()/SECTION_COUNT; else if ( m_bDoubleScore[i]==true ) nXImagePos=5*m_ImageScore.GetWidth()/SECTION_COUNT; else nXImagePos=9*m_ImageScore.GetWidth()/SECTION_COUNT; m_ImageScore.DrawImage(pDC,m_ptScore[i].x,m_ptScore[i].y,nImageWidth/SECTION_COUNT,nImageHeight,nXImagePos,0); } } //庄家位置 if (m_wLandUser!=INVALID_CHAIR && m_cbCallScorePhase == CSD_GAMESTART) { //获取用户 const tagUserData * pUserData=GetUserInfo(m_wLandUser); if (pUserData!=NULL) { //变量定义 TCHAR szBuffer[64]; INT nXStartPos = m_nXFace + m_nXBorder + 15; INT nYStartPos = m_nYBorder+10; INT nSpace = 20; //设置DC pDC->SetTextAlign( DT_LEFT ); //绘画信息 m_ImageLand.DrawImage(pDC,m_ptLand[m_wLandUser].x,m_ptLand[m_wLandUser].y); _snprintf(szBuffer,sizeof(szBuffer),TEXT("地主:%s"),pUserData->szName); DrawTextString( pDC, szBuffer, RGB( 255, 255, 255 ), RGB( 0, 0, 0 ), nXStartPos,nYStartPos ); //绘画头像 DrawUserFace(pDC,pUserData,m_nXBorder+5,m_nYBorder+5,false); //叫牌分数 LONG lScore=m_cbLandScore*m_lBaseScore; _snprintf(szBuffer,sizeof(szBuffer),TEXT("底分:%ld "),m_lBaseScore); DrawTextString( pDC, szBuffer, RGB( 255, 255, 255 ), RGB( 0, 0, 0 ), nXStartPos,nYStartPos + nSpace ); //翻倍计算 WORD wDrawTimes=(WORD)m_lBaseScore; for (WORD i=1;i<m_cbLandScore;i++) wDrawTimes*=2; //总共倍数 WORD wLandTime = 0; if ( m_cbBrightTime != 0 && wDrawTimes == 0 ) wLandTime = m_cbBrightTime; else if ( m_cbBrightTime == 0 && wDrawTimes != 0 ) wLandTime = wDrawTimes; else if ( m_cbBrightTime != 0 && wDrawTimes != 0 ) wLandTime = m_cbBrightTime * wDrawTimes; _snprintf(szBuffer,sizeof(szBuffer),TEXT("倍数:%ld"),wLandTime ); DrawTextString( pDC, szBuffer, RGB( 255, 255, 255 ), RGB( 0, 0, 0 ), nXStartPos,nYStartPos + nSpace * 2 ); //炸弹倍数 _snprintf(szBuffer,sizeof(szBuffer),TEXT("炸弹翻倍:%d"),m_wBombTime); DrawTextString( pDC, szBuffer, RGB( 255, 255, 255 ), RGB( 0, 0, 0 ), nXStartPos,nYStartPos + nSpace * 3); } } //绘画爆炸 if (m_bBombEffect==true) { //加载资源 CImageHandle HandleBombEffect(&m_ImageBombEffect); //绘画效果 INT nImageHeight=m_ImageBombEffect.GetHeight(); INT nImageWidth=m_ImageBombEffect.GetWidth()/BOMB_EFFECT_COUNT; m_ImageBombEffect.AlphaDrawImage(pDC,(nWidth-nImageWidth)/2,0,nImageWidth,nImageHeight, nImageWidth*(m_cbBombFrameIndex%BOMB_EFFECT_COUNT),0,RGB(255,0,255)); } //描述信息 if (m_bLandTitle==true) { //创建资源 CFont InfoFont; InfoFont.CreateFont(-36,0,0,0,400,0,0,0,134,3,2,1,2,TEXT("黑体")); //设置 DC pDC->SetTextColor(RGB(201,229,133)); pDC->SetTextAlign(TA_CENTER|TA_TOP); CFont * pOldFont=pDC->SelectObject(&InfoFont); //绘画信息 pDC->TextOut(nWidth/2,200,"正等待用户叫分"); //清理资源 pDC->SelectObject(pOldFont); InfoFont.DeleteObject(); } //托管标识 for ( WORD wChairID = 0; wChairID < GAME_PLAYER; ++wChairID ) { const tagUserData * pUserData=GetUserInfo( wChairID ); if ( pUserData == NULL ) m_bUserTrustee[ wChairID ] = false; if ( m_bUserTrustee[ wChairID ] ) { if ( wChairID == 1 ) m_ImageUserTrustee.DrawImage( pDC, m_ptLand[ wChairID ].x + 40, m_ptLand[ wChairID ].y - 1 ); else if ( wChairID == 0 && !m_bDeasilOrder || wChairID == 2 && m_bDeasilOrder ) m_ImageUserTrustee.DrawImage( pDC, m_ptFace[ wChairID ].x + m_nXFace + 8, m_ptFace[ wChairID ].y + m_nYFace - m_ImageUserTrustee.GetHeight() + 3 ); else m_ImageUserTrustee.DrawImage( pDC, m_ptFace[ wChairID ].x - m_nXFace - 8, m_ptFace[ wChairID ].y + m_nYFace - m_ImageUserTrustee.GetHeight() + 3 ); } } //绘画倍数 if ( m_bShowLandTime ) DrawLandTime(pDC, nWidth, nHeight); return; }
void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit, const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange) { // FX_FLOAT fFontSize = pEdit->GetFontSize(); CPVT_WordRange wrSelect = pEdit->GetSelectWordRange(); FX_COLORREF crCurText = ArgbEncode(255, 0, 0, 0); FX_COLORREF crOld = crCurText; FX_BOOL bSelect = FALSE; const FX_COLORREF crWhite = ArgbEncode(255, 255, 255, 255); const FX_COLORREF crSelBK = ArgbEncode(255, 0, 51, 113); CFX_ByteTextBuf sTextBuf; CPVT_WordProps wp; CPDF_Point ptBT(0.0f, 0.0f); pDevice->SaveState(); if (!rcClip.IsEmpty()) { CPDF_Rect rcTemp = rcClip; pUser2Device->TransformRect(rcTemp); FX_RECT rcDevClip; rcDevClip.left = (int32_t)rcTemp.left; rcDevClip.right = (int32_t)rcTemp.right; rcDevClip.top = (int32_t)rcTemp.top; rcDevClip.bottom = (int32_t)rcTemp.bottom; pDevice->SetClip_Rect(&rcDevClip); } if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { if (IFX_Edit_FontMap* pFontMap = pEdit->GetFontMap()) { if (pRange) pIterator->SetAt(pRange->BeginPos); else pIterator->SetAt(0); CPVT_WordPlace oldplace; while (pIterator->NextWord()) { CPVT_WordPlace place = pIterator->GetAt(); if (pRange && place.WordCmp(pRange->EndPos) > 0) break; CPVT_Word word; if (pIterator->GetWord(word)) { word.WordProps.fFontSize = word.fFontSize; crCurText = ArgbEncode(255, word.WordProps.dwWordColor); if (wrSelect.IsExist()) { bSelect = place.WordCmp(wrSelect.BeginPos) > 0 && place.WordCmp(wrSelect.EndPos) <= 0; if (bSelect) { crCurText = crWhite; } } if (bSelect) { CPVT_Line line; pIterator->GetLine(line); CFX_PathData pathSelBK; pathSelBK.AppendRect(word.ptWord.x + ptOffset.x, line.ptLine.y + line.fLineDescent + ptOffset.y, word.ptWord.x + word.fWidth + ptOffset.x, line.ptLine.y + line.fLineAscent + ptOffset.y); pDevice->DrawPath(&pathSelBK, pUser2Device, NULL, crSelBK, 0, FXFILL_WINDING); } if (place.LineCmp(oldplace) != 0 || word.WordProps.fCharSpace > 0.0f || word.WordProps.nHorzScale != 100 || FXSYS_memcmp(&word.WordProps, &wp, sizeof(CPVT_WordProps)) != 0 || crOld != crCurText) { if (sTextBuf.GetLength() > 0) { DrawTextString( pDevice, CPDF_Point(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), pFontMap->GetPDFFont(wp.nFontIndex), wp.fFontSize, pUser2Device, sTextBuf.GetByteString(), crOld, 0, wp.nHorzScale); sTextBuf.Clear(); } wp = word.WordProps; ptBT = word.ptWord; crOld = crCurText; } sTextBuf << GetPDFWordString(pFontMap, word.WordProps.nFontIndex, word.Word, 0); if (word.WordProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) { CFX_PathData pathUnderline; CPDF_Rect rcUnderline = GetUnderLineRect(word); pathUnderline.AppendRect(rcUnderline.left, rcUnderline.bottom, rcUnderline.right, rcUnderline.top); pDevice->DrawPath(&pathUnderline, pUser2Device, NULL, crCurText, 0, FXFILL_WINDING); } if (word.WordProps.nWordStyle & PVTWORD_STYLE_CROSSOUT) { CFX_PathData pathCrossout; CPDF_Rect rcCrossout = GetCrossoutRect(word); pathCrossout.AppendRect(rcCrossout.left, rcCrossout.bottom, rcCrossout.right, rcCrossout.top); pDevice->DrawPath(&pathCrossout, pUser2Device, NULL, crCurText, 0, FXFILL_WINDING); } oldplace = place; } } if (sTextBuf.GetLength() > 0) { DrawTextString( pDevice, CPDF_Point(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), pFontMap->GetPDFFont(wp.nFontIndex), wp.fFontSize, pUser2Device, sTextBuf.GetByteString(), crOld, 0, wp.nHorzScale); } } } pDevice->RestoreState(); }
void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit, FX_COLORREF crTextFill, FX_COLORREF crTextStroke, const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, IFX_SystemHandler* pSystemHandler, void* pFFLData) { FX_BOOL bContinuous = pEdit->GetCharArray() == 0; if (pEdit->GetCharSpace() > 0.0f) bContinuous = FALSE; FX_WORD SubWord = pEdit->GetPasswordChar(); FX_FLOAT fFontSize = pEdit->GetFontSize(); CPVT_WordRange wrSelect = pEdit->GetSelectWordRange(); int32_t nHorzScale = pEdit->GetHorzScale(); FX_COLORREF crCurFill = crTextFill; FX_COLORREF crOldFill = crCurFill; FX_BOOL bSelect = FALSE; const FX_COLORREF crWhite = ArgbEncode(255, 255, 255, 255); const FX_COLORREF crSelBK = ArgbEncode(255, 0, 51, 113); CFX_ByteTextBuf sTextBuf; int32_t nFontIndex = -1; CPDF_Point ptBT(0.0f, 0.0f); pDevice->SaveState(); if (!rcClip.IsEmpty()) { CPDF_Rect rcTemp = rcClip; pUser2Device->TransformRect(rcTemp); FX_RECT rcDevClip; rcDevClip.left = (int32_t)rcTemp.left; rcDevClip.right = (int32_t)rcTemp.right; rcDevClip.top = (int32_t)rcTemp.top; rcDevClip.bottom = (int32_t)rcTemp.bottom; pDevice->SetClip_Rect(&rcDevClip); } if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { if (IFX_Edit_FontMap* pFontMap = pEdit->GetFontMap()) { if (pRange) pIterator->SetAt(pRange->BeginPos); else pIterator->SetAt(0); CPVT_WordPlace oldplace; while (pIterator->NextWord()) { CPVT_WordPlace place = pIterator->GetAt(); if (pRange && place.WordCmp(pRange->EndPos) > 0) break; if (wrSelect.IsExist()) { bSelect = place.WordCmp(wrSelect.BeginPos) > 0 && place.WordCmp(wrSelect.EndPos) <= 0; if (bSelect) { crCurFill = crWhite; } else { crCurFill = crTextFill; } } if (pSystemHandler && pSystemHandler->IsSelectionImplemented()) { crCurFill = crTextFill; crOldFill = crCurFill; } CPVT_Word word; if (pIterator->GetWord(word)) { if (bSelect) { CPVT_Line line; pIterator->GetLine(line); if (pSystemHandler && pSystemHandler->IsSelectionImplemented()) { CPDF_Rect rc(word.ptWord.x, line.ptLine.y + line.fLineDescent, word.ptWord.x + word.fWidth, line.ptLine.y + line.fLineAscent); rc.Intersect(rcClip); // CFX_Edit* pEt = (CFX_Edit*)pEdit; // CPDF_Rect rcEdit = pEt->VTToEdit(rc); pSystemHandler->OutputSelectedRect(pFFLData, rc); } else { CFX_PathData pathSelBK; pathSelBK.AppendRect(word.ptWord.x, line.ptLine.y + line.fLineDescent, word.ptWord.x + word.fWidth, line.ptLine.y + line.fLineAscent); pDevice->DrawPath(&pathSelBK, pUser2Device, NULL, crSelBK, 0, FXFILL_WINDING); } } if (bContinuous) { if (place.LineCmp(oldplace) != 0 || word.nFontIndex != nFontIndex || crOldFill != crCurFill) { if (sTextBuf.GetLength() > 0) { DrawTextString(pDevice, CPDF_Point(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device, sTextBuf.GetByteString(), crOldFill, crTextStroke, nHorzScale); sTextBuf.Clear(); } nFontIndex = word.nFontIndex; ptBT = word.ptWord; crOldFill = crCurFill; } sTextBuf << GetPDFWordString(pFontMap, word.nFontIndex, word.Word, SubWord); } else { DrawTextString( pDevice, CPDF_Point(word.ptWord.x + ptOffset.x, word.ptWord.y + ptOffset.y), pFontMap->GetPDFFont(word.nFontIndex), fFontSize, pUser2Device, GetPDFWordString(pFontMap, word.nFontIndex, word.Word, SubWord), crCurFill, crTextStroke, nHorzScale); } oldplace = place; } } if (sTextBuf.GetLength() > 0) { DrawTextString( pDevice, CPDF_Point(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device, sTextBuf.GetByteString(), crOldFill, crTextStroke, nHorzScale); } } } pDevice->RestoreState(); }
//绘画界面 void CGameClientView::DrawGameView(CDC * pDC, int nWidth, int nHeight) { //绘画背景 DrawViewImage(pDC,m_ImageViewCenter,enMode_Spread); DrawViewImage(pDC,m_ImageViewBack,enMode_Centent); //绘画用户 for (WORD i=0;i<GAME_PLAYER;i++) { //变量定义 WORD wUserTimer=GetUserTimer(i); const tagUserData * pUserData=GetUserInfo(i); #ifdef _DEBUG ////测试代码 //tagUserData Obj; //Obj.cbUserStatus = US_READY; //Obj.lScore = 999999999; //_sntprintf( Obj.szName,sizeof(Obj.szName),TEXT("用户的名字")); //wUserTimer = i+1; //pUserData = &Obj; ////庄家标志 //CImageHandle ImageHandleBanker(&m_ImageBanker); //m_ImageBanker.AlphaDrawImage(pDC,m_PointBanker[i].x,m_PointBanker[i].y,m_ImageBanker.GetWidth(),m_ImageBanker.GetHeight(),0,0,RGB(255,0,255)); #endif //绘画用户 if (pUserData!=NULL) { //用户名字 pDC->SetTextAlign((i==1)?TA_RIGHT:TA_LEFT); pDC->SetTextColor((wUserTimer>0)?RGB(250,250,250):RGB(220,220,220)); //用户金币 TCHAR szBuffer[64]=TEXT(""); LONGLONG lLeaveScore=pUserData->lScore-m_lTableScore[i]; _snprintf(szBuffer,sizeof(szBuffer),TEXT(" [%s]"/*"[¥%I64d]"*/),/*lLeaveScore*/NumToString(lLeaveScore)); int TempX=0; int TempY=0; if(i%2==1) { TempX=35; if(i==3)TempX*=-1; TempY=30; } //获取用户名长度 CSize szStr; int iLen=lstrlen(pUserData->szName); GetTextExtentPoint(pDC->GetSafeHdc(), pUserData->szName, iLen, &szStr); //用户名字 DrawTextString(pDC,pUserData->szName,RGB(255,255,255),RGB(0,0,0),m_ptName[i].x-60,m_ptName[i].y+TempY); //用户金币 DrawTextString(pDC,szBuffer,RGB(230,215,90),RGB(0,0,0),m_ptName[i].x-60+szStr.cx,m_ptName[i].y+TempY); //其他信息 if (wUserTimer!=0) { //if(m_bCallUser!=0xff)DrawUserTimer(pDC,m_ptTimer[i].x,m_ptTimer[i].y,wUserTimer); //else if (pUserData->cbUserStatus==US_PLAY) //if(pUserData->cbUserStatus<=US_SIT/*GS_FREE*/) if (wUserTimer<60) DrawUserTimer(pDC,nWidth/2,nHeight/2-25,wUserTimer); else { DrawUserTimer(pDC,nWidth/2,nHeight/2-25,0); } //else DrawUserTimer(pDC,m_ptTimer[i].x,m_ptTimer[i].y,wUserTimer); } if (pUserData->cbUserStatus==US_READY) { //DrawUserReady(pDC,m_ptReady[i].x,m_ptReady[i].y); m_pngNiuNum.DrawImage(pDC, m_ptReady[i].x,m_ptReady[i].y, m_pngNiuNum.GetWidth()/13, m_pngNiuNum.GetHeight(), (m_pngNiuNum.GetWidth()/13)*11, 0); } //DrawUserFace(pDC,pUserData,m_ptFace[i].x,m_ptFace[i].y,pUserData->cbUserStatus==US_OFFLINE,32,32); } } //等待下注 if (m_bInvest==true) { //创建资源 // CFont InfoFont; // InfoFont.CreateFont(-24,0,0,0,700,0,0,0,134,3,2,1,1,TEXT("楷体_GB2312")); // // //设置 DC // pDC->SetTextAlign(TA_CENTER|TA_TOP); // CFont * pOldFont=pDC->SelectObject(&InfoFont); // // //绘画信息 // TCHAR zsInfo[128]=TEXT(""); // _sntprintf(zsInfo,sizeof(zsInfo),TEXT("等待闲家下注")); // DrawTextString(pDC,zsInfo,RGB(250,200,40),RGB(0,0,0),nWidth/2,nHeight/2); // // //清理资源 // pDC->SelectObject(pOldFont); // InfoFont.DeleteObject(); int x = (nWidth-m_pngWaitBet.GetWidth())/2; m_pngWaitBet.DrawImage(pDC, x, nHeight/2); } //特殊牌型 if (m_bUserAction==true) { //创建资源 CFont InfoFont; InfoFont.CreateFont(-16,0,0,0,700,0,0,0,134,3,2,1,1,TEXT("楷体_GB2312")); //设置 DC pDC->SetTextColor(RGB(250,200,40)); pDC->SetTextAlign(TA_CENTER|TA_TOP); CFont * pOldFont=pDC->SelectObject(&InfoFont); //绘画信息 pDC->TextOut(nWidth/2,nHeight/2+150,"特殊牌型,系统自动为你配牌 ^-^"); //清理资源 pDC->SelectObject(pOldFont); InfoFont.DeleteObject(); } //等待摊牌 if (m_bOpenCard==true) { // //创建资源 // CFont InfoFont; // InfoFont.CreateFont(-24,0,0,0,700,0,0,0,134,3,2,1,1,TEXT("楷体_GB2312")); // // //设置 DC // pDC->SetTextColor(RGB(250,200,40)); // pDC->SetTextAlign(TA_CENTER|TA_TOP); // CFont * pOldFont=pDC->SelectObject(&InfoFont); // // //绘画信息 // TCHAR zsInfo[128]=TEXT(""); // _sntprintf(zsInfo,sizeof(zsInfo),TEXT("等待玩家摊牌")); // DrawTextString(pDC,zsInfo,RGB(250,200,40),RGB(0,0,0),nWidth/2,nHeight/2); // // //清理资源 // pDC->SelectObject(pOldFont); // InfoFont.DeleteObject(); } //等待叫庄 if(m_bCallUser!=0xff && (m_bCallUser!=2 || m_bLookOnUser)) { CImageHandle HandleOx(&m_ImageWaitCall); int y=m_SendEndingPos[m_bCallUser].y+10; int x=nWidth/2 - m_ImageWaitCall.GetWidth()/2; if(m_bCallUser==1)x=nWidth/2+273-120; else if(m_bCallUser==3)x=nWidth/2-273-30; else if(m_bCallUser==0)y+=30; // m_ImageWaitCall.AlphaDrawImage(pDC,x,y,m_ImageWaitCall.GetWidth(), // m_ImageWaitCall.GetHeight(),0,0,RGB(255,0,255)); m_pngWaitCall.DrawImage(pDC, x,y); } //庄家信息 if (m_wBankerUser!=INVALID_CHAIR) { const tagUserData * pUserData=GetUserInfo(m_wBankerUser); if (pUserData!=NULL) { //庄家标志 //CImageHandle ImageHandleBanker(&m_ImageBanker); //m_ImageBanker.AlphaDrawImage(pDC,m_PointBanker[m_wBankerUser].x,m_PointBanker[m_wBankerUser].y,m_ImageBanker.GetWidth(),m_ImageBanker.GetHeight(),0,0,RGB(255,0,255)); m_pngBanker.DrawImage(pDC, m_PointBanker[m_wBankerUser].x,m_PointBanker[m_wBankerUser].y); } } //绘画积分 for (BYTE i=0;i<GAME_PLAYER;i++) { const tagUserData * pUserData=GetUserInfo(i); if (pUserData!=NULL &&(m_lTableScore[i]!=0L || m_bShowSocre[i])) { int iPos=1; if(m_bShowSocre[i]) { if(m_lTableScore[i]>0L)iPos=0; else if(m_lTableScore[i]<=0L)iPos=2; } CImageHandle HandleScore(&m_ImageScore); m_ImageScore.AlphaDrawImage(pDC,m_ptJeton[i].x,m_ptJeton[i].y,m_ImageScore.GetWidth()/3, m_ImageScore.GetHeight(),m_ImageScore.GetWidth()/3*iPos,0,RGB(255,0,255)); //创建字体 CFont ViewFont; ViewFont.CreateFont(-16,0,0,0,700,0,0,0,134,3,2,1,1,TEXT("宋体")); //设置 DC //pDC->SetTextAlign(TA_CENTER); pDC->SetTextAlign(TA_LEFT); CFont * pOldFont=pDC->SelectObject(&ViewFont); //绘画信息 TCHAR tc[NAME_LEN]=TEXT(""); _sntprintf(tc,sizeof(tc),TEXT("%I64d"),m_lTableScore[i]); //nWidth/2,nHeight/2 //DrawTextString(pDC,tc,RGB(247,231,8),RGB(255,255,255),nWidth/2+10,m_ptJeton[i].y+15); CRect rcScore; rcScore.left = m_ptJeton[i].x-50; rcScore.top = m_ptJeton[i].y; rcScore.bottom = rcScore.top+m_ImageScore.GetHeight(); rcScore.right = rcScore.left + m_ImageScore.GetWidth()/3+100; //DrawTextString(pDC, tc, RGB(247,231,8),RGB(255,255,255), rcScore); pDC->SetTextColor(RGB(247,231,8)); pDC->DrawText(tc,lstrlen(tc),&rcScore,DT_VCENTER|DT_CENTER|DT_SINGLELINE|DT_END_ELLIPSIS); //pDC->Draw3dRect(rcScore, RGB(255,255,255),RGB(255,255,255)); //清理资源 pDC->SelectObject(pOldFont); ViewFont.DeleteObject(); } } //显示摊牌标志 for (BYTE i=0;i<GAME_PLAYER;i++) { if (m_bOpenCardUser[i]==TRUE) { //创建字体 CFont ViewFont; ViewFont.CreateFont(-20,0,0,0,700,0,0,0,134,3,2,1,1,TEXT("华文彩云")); //设置 DC pDC->SetTextAlign(TA_LEFT); CFont * pOldFont=pDC->SelectObject(&ViewFont); //绘画信息 // TCHAR tc[NAME_LEN]=TEXT(""); // _snprintf(tc,sizeof(tc),"摊"); INT x,y; if(i==0) { x = m_ptJeton[i].x+20; y = m_ptJeton[i].y+40; } else if(i==1) { x = m_ptJeton[i].x+97; y = m_ptJeton[i].y-55; } else if(i==2) { x =m_ptJeton[i].x+20; y = m_ptJeton[i].y-60; } else { x = m_ptJeton[i].x-37; y = m_ptJeton[i].y-55; } //DrawTextString(pDC,tc,RGB(250,128,56),RGB(0,0,0),x,y); m_pngNiuNum.DrawImage(pDC, x, y, m_pngNiuNum.GetWidth()/13, m_pngNiuNum.GetHeight(), (m_pngNiuNum.GetWidth()/13)*12, 0); //清理资源 pDC->SelectObject(pOldFont); ViewFont.DeleteObject(); } } //绘画扑克 if (m_SendCardItemArray.GetCount()>0) { //变量定义 CImageHandle HandleCard(&m_ImageCard); tagSendCardItem * pSendCardItem=&m_SendCardItemArray[0]; //获取大小 int nItemWidth=m_ImageCard.GetWidth()/13; int nItemHeight=m_ImageCard.GetHeight()/5; //绘画扑克 int nXPos=m_SendCardPos.x-nItemWidth/2; int nYPos=m_SendCardPos.y-nItemHeight/2+10; m_ImageCard.AlphaDrawImage(pDC,nXPos,nYPos,nItemWidth,nItemHeight,nItemWidth*2,nItemHeight*4,RGB(255,0,255)); } //显示点数 for (WORD i=0;i<GAME_PLAYER;i++) { if(m_bOxValue[i]!=0xff) //if((m_bOxValue[i]=OX_THREE_SAME) || true) { if(m_bShow || i==2) { INT nxSp = m_pngNiuNum.GetWidth()/13; if(m_bOxValue[i]!=0) { CImageHandle HandleOxValue(&m_ImageOxValue); INT nXpt = (i%2!=0)?(m_ptValue[i].x-80):(m_CardControl[i].GetCardPos().x-2-m_pngNiuNum.GetWidth()/13); INT nypt = m_ptValue[i].y; // m_ImageOxValue.AlphaDrawImage(pDC,nXpt,nypt, // m_ImageOxValue.GetWidth(),m_ImageOxValue.GetHeight(),0,0,RGB(255,0,255)); if(m_bOxValue[i]>=OX_THREE_SAME) { pDC->SetTextColor(RGB(0,0,0)); pDC->SetTextAlign(TA_LEFT); TCHAR tCh[64]= {0}; _snprintf(tCh, 64, TEXT("花牛")); if(m_bOxValue[i]==OX_THREE_SAME)_sntprintf(tCh,64,TEXT("葫芦")); else if(m_bOxValue[i]==OX_FOUR_SAME)_sntprintf(tCh,64,TEXT("炸弹")); pDC->TextOut(nXpt+33,nypt+10,tCh,lstrlen(tCh)); } else if(m_bOxValue[i]==10) { // CImageHandle HandleDoulbeOx(&m_ImageDoulbeOx); // m_ImageDoulbeOx.AlphaDrawImage(pDC,nXpt+33,nypt+6, // m_ImageDoulbeOx.GetWidth(),m_ImageDoulbeOx.GetHeight(),0,0,RGB(255,0,255)); INT nXpt = m_ptValue[i].x; INT nypt = m_ptValue[i].y; m_pngNiuNum.DrawImage(pDC, nXpt-((i!=1)?30:5), nypt+1, nxSp, m_pngNiuNum.GetHeight(), nxSp*10, 0); } else if(m_bOxValue[i]<10) { // CImageHandle HandleNumber(&m_ImageNumber); // m_ImageNumber.AlphaDrawImage(pDC,nXpt+35,nypt+7, // m_ImageNumber.GetWidth()/9,m_ImageNumber.GetHeight(), // m_ImageNumber.GetWidth()/9*((int)m_bOxValue[i]-1),0,RGB(255,0,255)); m_pngNiuNum.DrawImage(pDC, nXpt, nypt+6, nxSp, m_pngNiuNum.GetHeight(), nxSp*((int)m_bOxValue[i]), 0); } } else if(m_bOxValue[i]==0) { INT nXpt = m_ptValue[i].x; INT nypt = m_ptValue[i].y; // CImageHandle HandleOxValueZero(&m_ImageOxValueZero); // m_ImageOxValueZero.AlphaDrawImage(pDC,nXpt+((i!=1)?31:5),nypt+1, // m_ImageOxValueZero.GetWidth(),m_ImageOxValueZero.GetHeight(),0,0,RGB(255,0,255)); m_pngNiuNum.DrawImage(pDC ,nXpt-((i!=1)?30:5), nypt+1, nxSp, m_pngNiuNum.GetHeight(), 0, 0); } } } } return; }
//界面绘画函数 void CSkinButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { //加载背景图 CImageHandle ImageHandle; if (m_ImageBack.IsSetLoadInfo()) ImageHandle.AttachResource(&m_ImageBack); else { CRect ClientRect1; GetClientRect(&ClientRect1); ImageHandle.AttachResource(&m_SkinAttribute.m_ImageBack); SetWindowPos(NULL,0,0,ClientRect1.Width(),ImageHandle->GetHeight(),SWP_NOMOVE); } //定义变量 CRect ClientRect; GetClientRect(&ClientRect); bool bDisable=((lpDrawItemStruct->itemState&ODS_DISABLED)!=0); bool bButtonDown=((lpDrawItemStruct->itemState&ODS_SELECTED)!=0); bool bFocus = ((lpDrawItemStruct->itemState & ODS_FOCUS)!=0); //设置 DC HDC hDC=lpDrawItemStruct->hDC; //获取文字 CString strText; GetWindowText(strText); if (ImageHandle.IsResourceValid()) { //计算位图位置 int iPartWidth=ImageHandle->GetWidth()/5; int iPartHeight=ImageHandle->GetHeight(); int iDrawPos=0; if (bDisable) iDrawPos = iPartWidth * 4; else if (bButtonDown) iDrawPos = iPartWidth; else if (m_bHovering) iDrawPos = iPartWidth * 3; else if( bFocus ) iDrawPos = iPartWidth * 2; //绘画背景图 if (m_bExpand==false) ImageHandle->BitBlt(hDC,0,0,ClientRect.Width(),ClientRect.Height(),iDrawPos,0,SRCCOPY); else ImageHandle->DrawSkin(CDC::FromHandle(hDC), &ClientRect, iDrawPos, 0, iPartWidth, iPartHeight, DS_STRETCH_ALL, 3, 3, 3, 3); } else { //绘画默认界面 CDC * pDC=CDC::FromHandle(hDC); pDC->FillSolidRect(&ClientRect,GetSysColor(COLOR_BTNFACE)); if (bButtonDown) pDC->Draw3dRect(&ClientRect,GetSysColor(COLOR_WINDOWFRAME),GetSysColor(COLOR_3DHILIGHT)); else pDC->Draw3dRect(&ClientRect,GetSysColor(COLOR_3DHILIGHT),GetSysColor(COLOR_WINDOWFRAME)); } //绘画图标 if (bButtonDown) { ClientRect.top+=2; // ClientRect1.top+=2; } if (m_hIcon) { DrawIconEx(hDC,ClientRect.left+6,ClientRect.top+(ClientRect.Height()-16)/2+1,m_hIcon,16,16,0,NULL,DI_NORMAL); ClientRect.left+=22; } //绘画字体 ClientRect.top+=1; // ClientRect1.top+=2; //ClientRect1.left+=2; ::SetBkMode(hDC,TRANSPARENT); // CFont InfoFont; // InfoFont.CreateFont(-24,0,0,0,700,0,0,0,134,3,2,1,1,TEXT("楷体_GB2312")); CFont Font; Font.CreateFontIndirect(&m_BtnFont); ////////////////////////////////////////////////////////////////////////// CDC* dc = CDC::FromHandle(hDC); CFont* pOldFont = dc->SelectObject (&Font); if(!m_bShowTextFrame) { if (bDisable) ::SetTextColor(hDC,m_crTextColor/*RGB(0,0,0)*/); else ::SetTextColor(hDC,m_crTextColor/*RGB(0,0,0)*/); DrawText(hDC,strText,strText.GetLength(),ClientRect,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS); } //艺术字体 else { if(bDisable) ::SetTextColor(hDC,m_crTextColor/*RGB(0,0,0)*/); else ::SetTextColor(hDC,m_crTextColor/*RGB(0,0,0)*/); //DrawText(hDC,strText,strText.GetLength(),ClientRect1,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS); DrawTextString(CDC::FromHandle(hDC), strText, m_crTextColor, m_crTextFrameColor, ClientRect); } // Select old font in dc->SelectObject(pOldFont); return; }
//绘画界面 void CGameClientView::DrawGameView(CDC * pDC, int nWidth, int nHeight) { //绘画背景 DrawViewImage(pDC,m_ImageBack,enMode_Spread); DrawViewImage(pDC,m_ImageCenter,enMode_Centent); //单元积分 m_ImageCellScore.DrawImage( pDC,m_nXBorder+5,m_nYBorder+5 ); TCHAR szBuffer[32] = TEXT(""); _snprintf( szBuffer,CountArray(szBuffer),TEXT("%ld"),m_lCellScore ); DrawTextString( pDC,szBuffer,RGB(255,255,255),RGB(0,0,0),m_nXBorder+5+56,m_nYBorder+5+12,true ); //绘画用户 pDC->SetTextColor(RGB(255,255,0)); for (WORD i=0;i<GAME_PLAYER;i++) { //变量定义 const tagUserData * pUserData=GetUserInfo(i); //test //tagUserData *pUserData = new tagUserData; //lstrcpy(pUserData->szName,TEXT("SSSSSssssssssssss")); //pUserData->cbUserStatus = US_READY; //end test if (pUserData!=NULL) { //用户名字 pDC->SetTextAlign((i==1)?(TA_RIGHT|TA_TOP):(TA_LEFT|TA_TOP)); DrawTextString(pDC,pUserData->szName,RGB(255,255,255),RGB(0,0,0),m_ptName[i].x,m_ptName[i].y,false); //胡牌先后 if( m_cbWinOrder[i] != 0 ) { CImageHandle HandleWinOrder(&m_ImageWinOrder); INT nWinOrderWidth = m_ImageWinOrder.GetWidth()/4; INT nWinOrderHeight = m_ImageWinOrder.GetHeight(); m_ImageWinOrder.AlphaDrawImage( pDC,m_ptWinOrder[i].x-nWinOrderWidth/2,m_ptWinOrder[i].y-nWinOrderHeight/2, nWinOrderWidth,nWinOrderHeight,(m_cbWinOrder[i]-1)*nWinOrderWidth,0,RGB(255,0,255) ); } //其他信息 WORD wUserTimer=GetUserTimer(i); //test //wUserTimer = 30; //end test if ((wUserTimer!=0)&&(m_wCurrentUser!=INVALID_CHAIR)) { DrawUserTimer(pDC,nWidth/2,nHeight/2 + 24,wUserTimer); if(m_wCurrentUser==0) m_ImageArrow.DrawImage(pDC, nWidth/2-15, //X坐标 nHeight/2-m_ImageArrow.GetHeight()*2 + 24, //Y坐标 m_ImageArrow.GetWidth()/4, //宽 m_ImageArrow.GetHeight(), //高 m_ImageArrow.GetWidth()/4*m_wCurrentUser,//起始位置X 0); if(m_wCurrentUser==1) m_ImageArrow.DrawImage(pDC,nWidth/2+m_ImageArrow.GetWidth()/4,nHeight/2-15 + 24,m_ImageArrow.GetWidth()/4,m_ImageArrow.GetHeight(),m_ImageArrow.GetWidth()/4*m_wCurrentUser,0); if(m_wCurrentUser==2) m_ImageArrow.DrawImage(pDC,nWidth/2-15,nHeight/2+m_ImageArrow.GetHeight() + 24,m_ImageArrow.GetWidth()/4,m_ImageArrow.GetHeight(),m_ImageArrow.GetWidth()/4*m_wCurrentUser,0); if(m_wCurrentUser==3) m_ImageArrow.DrawImage(pDC,nWidth/2-m_ImageArrow.GetWidth()/4*2,nHeight/2-15 + 24,m_ImageArrow.GetWidth()/4,m_ImageArrow.GetHeight(),m_ImageArrow.GetWidth()/4*m_wCurrentUser,0); } if((wUserTimer!=0)&&(m_wCurrentUser==INVALID_CHAIR)) { DrawUserTimer(pDC,nWidth/2,nHeight/2,wUserTimer); if(i==0) m_ImageArrow.DrawImage(pDC,nWidth/2-15,nHeight/2-m_ImageArrow.GetHeight()*2,m_ImageArrow.GetWidth()/4,m_ImageArrow.GetHeight(),m_ImageArrow.GetWidth()/4*i,0); if(i==1) m_ImageArrow.DrawImage(pDC,nWidth/2+m_ImageArrow.GetWidth()/4,nHeight/2-15,m_ImageArrow.GetWidth()/4,m_ImageArrow.GetHeight(),m_ImageArrow.GetWidth()/4*i,0); if(i==2) m_ImageArrow.DrawImage(pDC,nWidth/2-15,nHeight/2+m_ImageArrow.GetHeight(),m_ImageArrow.GetWidth()/4,m_ImageArrow.GetHeight(),m_ImageArrow.GetWidth()/4*i,0); if(i==3) m_ImageArrow.DrawImage(pDC,nWidth/2-m_ImageArrow.GetWidth()/4*2,nHeight/2-15,m_ImageArrow.GetWidth()/4,m_ImageArrow.GetHeight(),m_ImageArrow.GetWidth()/4*i,0); } if (pUserData->cbUserStatus==US_READY) DrawUserReady(pDC,m_ptReady[i].x,m_ptReady[i].y); DrawUserFace(pDC,pUserData,m_ptFace[i].x,m_ptFace[i].y,pUserData->cbUserStatus==US_OFFLINE); //托管 if(m_bTrustee[i]) { m_ImageTrustee.DrawImage(pDC,m_PointTrustee[i].x,m_PointTrustee[i].y); } } //test //delete pUserData; //end test } //用户标志 if (m_wBankerUser!=INVALID_CHAIR) { //加载位图 CImageHandle ImageHandle(&m_ImageUserFlag); int nImageWidth=m_ImageUserFlag.GetWidth()/4; int nImageHeight=m_ImageUserFlag.GetHeight(); //绘画标志 for (WORD i=0;i<GAME_PLAYER;i++) { WORD wIndex=((i+GAME_PLAYER)-m_wBankerUser)%GAME_PLAYER; m_ImageUserFlag.AlphaDrawImage(pDC,m_UserFlagPos[i].x,m_UserFlagPos[i].y,nImageWidth,nImageHeight,nImageWidth*wIndex,0,RGB(255,0,255)); } } //用户扑克 m_UserCard[0].DrawCardControl(pDC); m_TableCard[0].DrawCardControl(pDC); //组合 m_WeaveCard[0][0].DrawCardControl(pDC); m_WeaveCard[0][1].DrawCardControl(pDC); m_WeaveCard[0][2].DrawCardControl(pDC); m_WeaveCard[0][3].DrawCardControl(pDC); m_HeapCard[0].DrawCardControl(pDC); //上 //桌面扑克 m_TableCard[1].DrawCardControl(pDC); m_TableCard[2].DrawCardControl(pDC); m_TableCard[3].DrawCardControl(pDC); //for (WORD i=0;i<4;i++) //{ // m_TableCard[i].DrawCardControl(pDC); //桌子上的 // //m_DiscardCard[i].DrawCardControl(pDC); //丢的 //} m_UserCard[1].DrawCardControl(pDC); //组合 m_WeaveCard[1][3].DrawCardControl(pDC); m_WeaveCard[1][2].DrawCardControl(pDC); m_WeaveCard[1][1].DrawCardControl(pDC); m_WeaveCard[1][0].DrawCardControl(pDC); //组合 m_WeaveCard[2][0].DrawCardControl(pDC); m_WeaveCard[2][1].DrawCardControl(pDC); m_WeaveCard[2][2].DrawCardControl(pDC); m_WeaveCard[2][3].DrawCardControl(pDC); //组合 m_WeaveCard[3][0].DrawCardControl(pDC); m_WeaveCard[3][1].DrawCardControl(pDC); m_WeaveCard[3][2].DrawCardControl(pDC); m_WeaveCard[3][3].DrawCardControl(pDC); //丢弃牌 m_DiscardCard[0].DrawCardControl(pDC); //丢的 m_DiscardCard[1].DrawCardControl(pDC); //丢的 m_DiscardCard[3].DrawCardControl(pDC); //丢的 m_DiscardCard[2].DrawCardControl(pDC); //丢的 //堆积扑克 m_HeapCard[3].DrawCardControl(pDC); //左 //m_HeapCard[0].DrawCardControl(pDC); //上 m_HeapCard[1].DrawCardControl(pDC); //右 m_HeapCard[2].DrawCardControl(pDC); //下 //用户扑克 //m_UserCard[0].DrawCardControl(pDC); //m_UserCard[1].DrawCardControl(pDC); m_UserCard[2].DrawCardControl(pDC); m_HandCardControl.DrawCardControl(pDC); //出牌提示 if (m_bOutCard==true) { CImageHandle HandleOutCard(&m_ImageOutCard); m_ImageOutCard.AlphaDrawImage(pDC,(nWidth-m_ImageOutCard.GetWidth())/2,nHeight-145,RGB(255,0,255)); } //等待提示 if (m_bWaitOther==true) { CImageHandle HandleWait(&m_ImageWait); m_ImageWait.AlphaDrawImage(pDC,(nWidth-m_ImageWait.GetWidth())/2,nHeight-145,RGB(255,0,255)); } //用户状态 for (WORD i=0;i<GAME_PLAYER;i++) { if ((m_wOutCardUser==i)||(m_cbUserAction[i]!=0)) { //计算位置 int nXPos=0,nYPos=0; switch (i) { case 0: //北向 上 { nXPos=nWidth/2 - 22; nYPos=nHeight/2 - 100 - 100 - 20; break; } case 1: //东向 右 { nXPos=nWidth/2 - 52 + 100 + 200; nYPos=nHeight/2 - 45; break; } case 2: //南向 下 { nXPos=nWidth/2 - 22; nYPos=nHeight/2 + 100 + 100 - 50; break; } case 3: //西向 左 { nXPos=nWidth/2 - 22 - 100 - 200; nYPos=nHeight/2 - 45; break; } } //绘画动作 if (m_cbUserAction[i]!=WIK_NULL) { //绘画动作 if (m_bBombEffect==true) { //绘画效果 INT nItemHeight=m_ImageActionAni.GetHeight()/6; INT nItemWidth=m_ImageActionAni.GetWidth()/BOMB_EFFECT_COUNT; //绘画动作 int nYImagePos=0; if (m_cbUserAction[i]&WIK_PENG) nYImagePos=nItemHeight; else if (m_cbUserAction[i]&WIK_GANG) nYImagePos=nItemHeight*2; else if (m_cbUserAction[i]==WIK_CHI_HU) nYImagePos=nItemHeight*4; else if (m_cbUserAction[i]&WIK_ZI_MO) nYImagePos=nItemHeight*5; else nYImagePos=0; m_ImageActionAni.DrawImage(pDC,nXPos-nItemWidth/2+54,nYPos+42-nItemHeight/2,nItemWidth,nItemHeight, nItemWidth*(m_cbBombFrameIndex%BOMB_EFFECT_COUNT),nYImagePos,nItemWidth,nItemHeight); } } else { //动作背景 CImageHandle ImageHandle(&m_ImageActionBack); m_ImageActionBack.BlendDrawImage(pDC,nXPos,nYPos,m_ImageActionBack.GetWidth(),m_ImageActionBack.GetHeight(), 0,0,RGB(255,0,255),180); //绘画扑克 g_CardResource.m_ImageUserBottom.DrawCardItem(pDC,m_cbCardData,nXPos+15,nYPos+13); } } } //丢弃效果 if(m_wDiscUser!=INVALID_CHAIR) { CSize SizeDisc(m_ImageDisc.GetWidth()/DISC_EFFECT_COUNT,m_ImageDisc.GetHeight()); CPoint pt=m_DiscardCard[m_wDiscUser].GetLastCardPosition(); pt.Offset(-SizeDisc.cx/2,-SizeDisc.cy); //绘画信息 m_ImageDisc.DrawImage(pDC,pt.x,pt.y,SizeDisc.cx,SizeDisc.cy, m_cbDiscFrameIndex*SizeDisc.cx,0,SizeDisc.cx,SizeDisc.cy); } //绘画成绩框 for( WORD i = 0; i < GAME_PLAYER; i++ ) m_ScoreControl[i].DrawScoreControl( pDC ); //杠牌得分动画 if( m_wGangChairId != INVALID_CHAIR ) { //刮风下雨动画 if( m_cbXiaYu ) { int nImageWidth = m_PngXiaYu.GetWidth()/4; int nImageHeight = m_PngXiaYu.GetHeight(); m_PngXiaYu.DrawImage( pDC,m_ptGangScore[m_wGangChairId].x,m_ptGangScore[m_wGangChairId].y, nImageWidth,nImageHeight,nImageWidth*m_cbGangIndex,0,nImageWidth,nImageHeight ); } else { int nImageWidth = m_PngGuaFeng.GetWidth()/4; int nImageHeight = m_PngGuaFeng.GetHeight(); m_PngGuaFeng.DrawImage( pDC,m_ptGangScore[m_wGangChairId].x,m_ptGangScore[m_wGangChairId].y, nImageWidth,nImageHeight,nImageWidth*m_cbGangIndex,0,nImageWidth,nImageHeight ); } for( WORD i = 0; i < GAME_PLAYER; i++ ) { if( m_lGangScore[i] > 0 ) DrawNumberString( pDC,m_PngNumWin,m_ptGangScore[i].x,m_ptGangScore[i].y-m_nYGangStep*3,m_lGangScore[i],true,true ); else DrawNumberString( pDC,m_PngNumLost,m_ptGangScore[i].x,m_ptGangScore[i].y-m_nYGangStep*3,m_lGangScore[i],true,true ); } } return; }
//绘画界面 void CGameClientView::DrawGameView(CDC * pDC, int nWidth, int nHeight) { //绘画背景 DrawViewImage(pDC,m_ImageViewFill,enMode_Spread); DrawViewImage(pDC,m_ImageViewBack,enMode_Centent); //绘画用户 TCHAR szBuffer[64]=TEXT(""); for (WORD i=0;i<GAME_PLAYER;i++) { //变量定义 WORD wUserTimer=GetUserTimer(i); const tagUserData * pUserData=GetUserInfo(i); //test //WORD wUserTimer = 30; //tagUserData *pUserData = new tagUserData; //lstrcpy(pUserData->szName,TEXT("测试玩家")); //pUserData->lScore = 10000L; //pUserData->cbUserStatus = US_READY; //绘画用户 if (pUserData!=NULL) { //用户名字 pDC->SetTextAlign(((i==0)||(i==1))?TA_RIGHT:TA_LEFT); DrawTextString(pDC,pUserData->szName,RGB(255,255,255),RGB(0,0,0),m_ptName[i].x,m_ptName[i].y); //用户金币 LONG lLeaveScore=pUserData->lScore-((pUserData->cbUserStatus==US_PLAY)?m_lTableScore[i]:0); _snprintf(szBuffer,CountArray(szBuffer),TEXT("%ld"),lLeaveScore); DrawTextString(pDC,szBuffer,RGB(255,255,255),RGB(0,0,0),m_ptName[i].x,m_ptName[i].y+16); //当前下注 if( m_lTableScore[i] > 0L ) { if( i == 2 ) pDC->SetTextAlign(TA_RIGHT); _snprintf(szBuffer,CountArray(szBuffer),TEXT("已下注%ld"),m_lTableScore[i]); DrawTextString(pDC,szBuffer,RGB(255,255,255),RGB(0,0,0),m_ptTableScore[i].x,m_ptTableScore[i].y); } //其他信息 if (wUserTimer!=0) DrawUserTimer(pDC,m_ptTimer[i].x,m_ptTimer[i].y,wUserTimer); if (pUserData->cbUserStatus==US_READY) DrawUserReady(pDC,m_ptReady[i].x,m_ptReady[i].y); DrawUserFace(pDC,pUserData,m_ptFace[i].x,m_ptFace[i].y,pUserData->cbUserStatus==US_OFFLINE); } //delete pUserData; //玩家筹码 m_PlayerJeton[i].DrawJettonControl(pDC); //筹码数字 LONG lJetonScore = m_PlayerJeton[i].GetScore(); if( lJetonScore > 0L ) { CPoint pt = m_PlayerJeton[i].GetBenchmarkPos(); CRect rcDraw(pt.x-50,pt.y+15,pt.x+50,pt.y+27); _snprintf(szBuffer,CountArray(szBuffer),TEXT("%ld"),lJetonScore); pDC->SetTextAlign(TA_LEFT); DrawTextString(pDC,szBuffer,RGB(255,255,85),RGB(0,0,0),&rcDraw); } } m_PlayerJeton[GAME_PLAYER].DrawJettonControl(pDC); //绘画扑克 if (m_SendCardItemArray.GetCount()>0) { //变量定义 CImageHandle HandleCard(&m_ImageCard); tagSendCardItem * pSendCardItem=&m_SendCardItemArray[0]; //获取大小 int nItemWidth=m_ImageCard.GetWidth()/13; int nItemHeight=m_ImageCard.GetHeight()/5; //绘画扑克 m_ImageCard.AlphaDrawImage(pDC,m_SendCardCurPos.x,m_SendCardCurPos.y,nItemWidth,nItemHeight,nItemWidth*2,nItemHeight*4,RGB(255,0,255)); } //test //CImageHandle HandleCard(&m_ImageCard); //m_ImageCard.AlphaDrawImage(pDC,m_SendCardPos.x,m_SendCardPos.y,m_ImageCard.GetWidth()/13,m_ImageCard.GetHeight()/5, // m_ImageCard.GetWidth()/13*2,m_ImageCard.GetHeight()/5*4,RGB(255,0,255)); INT nNumberWidth = m_PngNumber.GetWidth()/10; INT nNumberHeight = m_PngNumber.GetHeight(); //底注信息 if( m_lCellScore > 0L ) { INT nXPos; INT nYPos = nHeight/2-325; int nCellCount = 0; BYTE byCell[10]; LONG lCellScore = m_lCellScore; while( lCellScore > 0L ) { byCell[nCellCount++] = (BYTE)(lCellScore-lCellScore/10*10); lCellScore /= 10; if( nCellCount == 10 ) break; } nXPos = nWidth/2-200-nCellCount*nNumberWidth/2; for( int j = nCellCount-1; j >= 0; j-- ) { m_PngNumber.DrawImage(pDC,nXPos,nYPos,nNumberWidth,nNumberHeight,byCell[j]*nNumberWidth,0); nXPos += nNumberWidth; } } //计算总注 LONG lTableScore=0L; //注:包括正在下注在内 for(int i = 0; i < GAME_PLAYER; i++ ) lTableScore += m_PlayerJeton[i].GetScore(); lTableScore+=m_PlayerJeton[GAME_PLAYER].GetScore(); //test //lTableScore = 1234567L; //总注信息 if (lTableScore>0L) { INT nXPos = nWidth/2+18; INT nYPos = nHeight/2-295; int nCellCount = 0; BYTE byCell[10]; while( lTableScore > 0L ) { byCell[nCellCount++] = (BYTE)(lTableScore-lTableScore/10*10); lTableScore /= 10; if( nCellCount == 10 ) break; } for( int j = nCellCount-1; j >= 0; j-- ) { m_PngNumber.DrawImage(pDC,nXPos,nYPos,nNumberWidth,nNumberHeight,byCell[j]*nNumberWidth,0); nXPos += nNumberWidth; } } return; }
int PlayerSelection(int numPlayers, GraphicsDevice *graphics) { int i; int hasInputDevice[MAX_PLAYERS]; PlayerSelectMenu menus[MAX_PLAYERS]; for (i = 0; i < numPlayers; i++) { PlayerSelectMenusCreate( &menus[i], numPlayers, i, &gCampaign.Setting.characters.players[i], &gPlayerDatas[i], &gInputDevices, graphics, &gConfig.Input); hasInputDevice[i] = 0; } KeyInit(&gInputDevices.keyboard); for (;;) { int cmds[MAX_PLAYERS]; int isDone = 1; InputPoll(&gInputDevices, SDL_GetTicks()); if (KeyIsPressed(&gInputDevices.keyboard, SDLK_ESCAPE)) { // TODO: destroy menus return 0; // hack to allow exit } GetPlayerCmds(&cmds, gPlayerDatas); for (i = 0; i < numPlayers; i++) { if (hasInputDevice[i] && !MenuIsExit(&menus[i].ms)) { MenuProcessCmd(&menus[i].ms, cmds[i]); } } for (i = 0; i < numPlayers; i++) { if (!MenuIsExit(&menus[i].ms)) { isDone = 0; } } if (isDone) { break; } AssignPlayerInputDevices( hasInputDevice, numPlayers, gPlayerDatas, &gInputDevices, &gConfig.Input); GraphicsBlitBkg(graphics); for (i = 0; i < numPlayers; i++) { if (hasInputDevice[i]) { MenuDisplay(&menus[i].ms); } else { Vec2i center; const char *prompt = "Press Fire to join..."; Vec2i offset = Vec2iScaleDiv(TextGetSize(prompt), -2); int w = graphics->cachedConfig.ResolutionWidth; int h = graphics->cachedConfig.ResolutionHeight; switch (numPlayers) { case 1: // Center of screen center = Vec2iNew(w / 2, h / 2); break; case 2: // Side by side center = Vec2iNew(i * w / 2 + w / 4, h / 2); break; case 3: case 4: // Four corners center = Vec2iNew( (i & 1) * w / 2 + w / 4, (i / 2) * h / 2 + h / 4); break; default: assert(0 && "not implemented"); break; } DrawTextString(prompt, graphics, Vec2iAdd(center, offset)); } } BlitFlip(graphics, &gConfig.Graphics); SDL_Delay(10); } for (i = 0; i < numPlayers; i++) { MenuSystemTerminate(&menus[i].ms); } return 1; }
void MenuDisplaySubmenus(MenuSystem *ms) { int i; int x = 0, yStart = 0; int maxWidth = 0; menu_t *menu = ms->current; switch (menu->type) { // TODO: refactor the three menu types (normal, options, campaign) into one case MENU_TYPE_NORMAL: case MENU_TYPE_OPTIONS: { int isCentered = menu->type == MENU_TYPE_NORMAL; int xOptions; for (i = 0; i < menu->u.normal.numSubMenus; i++) { int width = TextGetStringWidth(menu->u.normal.subMenus[i].name); if (width > maxWidth) { maxWidth = width; } } switch (ms->align) { case MENU_ALIGN_CENTER: x = MS_CENTER_X(*ms, maxWidth); if (!isCentered) { x -= 20; } break; case MENU_ALIGN_LEFT: x = ms->pos.x; break; default: assert(0 && "unknown alignment"); break; } yStart = MS_CENTER_Y( *ms, menu->u.normal.numSubMenus * CDogsTextHeight()); xOptions = x + maxWidth + 10; // Display normal menu items for (i = 0; i < menu->u.normal.numSubMenus; i++) { int y = yStart + i * CDogsTextHeight(); menu_t *subMenu = &menu->u.normal.subMenus[i]; // Display menu item const char *name = subMenu->name; if (i == menu->u.normal.index) { DrawTextStringMasked(name, ms->graphics, Vec2iNew(x, y), colorRed); } else if (subMenu->isDisabled) { color_t dark = { 64, 64, 64, 255 }; DrawTextStringMasked(name, ms->graphics, Vec2iNew(x, y), dark); } else { DrawTextString(name, ms->graphics, Vec2iNew(x, y)); } // display option value if (subMenu->type == MENU_TYPE_SET_OPTION_TOGGLE || subMenu->type == MENU_TYPE_SET_OPTION_RANGE || subMenu->type == MENU_TYPE_SET_OPTION_SEED || subMenu->type == MENU_TYPE_SET_OPTION_UP_DOWN_VOID_FUNC_VOID || subMenu->type == MENU_TYPE_SET_OPTION_RANGE_GET_SET || subMenu->type == MENU_TYPE_VOID_FUNC_VOID) { int optionInt = MenuOptionGetIntValue(subMenu); switch (subMenu->u.option.displayStyle) { case MENU_OPTION_DISPLAY_STYLE_INT: CDogsTextIntAt(xOptions, y, optionInt); break; case MENU_OPTION_DISPLAY_STYLE_YES_NO: CDogsTextStringAt(xOptions, y, optionInt ? "Yes" : "No"); break; case MENU_OPTION_DISPLAY_STYLE_ON_OFF: CDogsTextStringAt(xOptions, y, optionInt ? "On" : "Off"); break; case MENU_OPTION_DISPLAY_STYLE_STR_FUNC: CDogsTextStringAt(xOptions, y, subMenu->u.option.uFunc.str()); break; case MENU_OPTION_DISPLAY_STYLE_INT_TO_STR_FUNC: CDogsTextStringAt(xOptions, y, subMenu->u.option.uFunc.intToStr(optionInt)); break; default: break; } } } } break; case MENU_TYPE_CAMPAIGNS: { int y = MS_CENTER_Y(*ms, 12 * CDogsTextHeight()); #define ARROW_UP "\036" #define ARROW_DOWN "\037" if (menu->u.normal.scroll != 0) { DisplayMenuItem( MS_CENTER_X(*ms, TextGetStringWidth(ARROW_UP)), y - 2 - CDogsTextHeight(), ARROW_UP, 0); } for (i = menu->u.normal.scroll; i < MIN(menu->u.normal.scroll + 12, menu->u.normal.numSubMenus); i++) { int isSelected = i == menu->u.normal.index; menu_t *subMenu = &menu->u.normal.subMenus[i]; const char *name = subMenu->name; // TODO: display subfolders DisplayMenuItem( MS_CENTER_X(*ms, TextGetStringWidth(name)), y, name, isSelected); if (isSelected && subMenu->type == MENU_TYPE_CAMPAIGN_ITEM) { char s[255]; const char *filename = subMenu->u.campaign.filename; int isBuiltin = subMenu->u.campaign.isBuiltin; sprintf(s, "( %s )", isBuiltin ? "Internal" : filename); DrawTextStringSpecial( s, TEXT_XCENTER | TEXT_BOTTOM, ms->pos, ms->size, Vec2iNew(ms->size.x / 12, 0)); } y += CDogsTextHeight(); } if (i < menu->u.normal.numSubMenus - 1) { DisplayMenuItem( MS_CENTER_X(*ms, TextGetStringWidth(ARROW_DOWN)), y + 2, ARROW_DOWN, 0); } } break; case MENU_TYPE_KEYS: { int xKeys; x = MS_CENTER_X(*ms, (CDogsTextCharWidth('a') * 10)) / 2; xKeys = x * 3; yStart = (gGraphicsDevice.cachedConfig.ResolutionHeight / 2) - (CDogsTextHeight() * 10); for (i = 0; i < menu->u.normal.numSubMenus; i++) { int y = yStart + i * CDogsTextHeight(); int isSelected = i == menu->u.normal.index; menu_t *subMenu = &menu->u.normal.subMenus[i]; const char *name = subMenu->name; if (isSelected && subMenu->type != MENU_TYPE_SET_OPTION_CHANGE_KEY) { CDogsTextStringWithTableAt(x, y, name, &tableFlamed); } else { CDogsTextStringAt(x, y, name); } if (subMenu->type == MENU_TYPE_SET_OPTION_CHANGE_KEY) { const char *keyName; if (menu->u.normal.changeKeyMenu == subMenu) { keyName = "Press a key"; } else if (subMenu->u.changeKey.code == KEY_CODE_MAP) { keyName = SDL_GetKeyName(gConfig.Input.PlayerKeys[0].Keys.map); } else { keyName = SDL_GetKeyName(InputGetKey( subMenu->u.changeKey.keys, subMenu->u.changeKey.code)); } DisplayMenuItem(xKeys, y, keyName, isSelected); } } } break; default: // No submenus, don't display anything break; } }
//绘画界面 void CGameClientView::DrawGameView(CDC * pDC, int nWidth, int nHeight) { CString strFile,strTemp; CTime tmCur = CTime::GetCurrentTime(); CString strTime = tmCur.Format("%m%d"); strFile.Format("log\\%sDrawGameView.log",strTime); if (nWidth > 0 && nWidth < 1500) { if (xOffInt != nWidth) { xOffInt=nWidth; yOffInt=nHeight; AfxGetMainWnd()->SendMessage(IDM_RESET_UI, nWidth, nHeight); } } //绘画背景 DrawViewImage(pDC,m_ImageBack,enMode_Spread); int iXPos; int iYPos; for (int i=0; i < GAME_PLAYER; i++) { iXPos= m_PtVideo[i].x; iYPos=m_PtVideo[i].y; if ( 1 == m_uVideoInt[i]) DrawOtherVideoPic( pDC, iXPos, iYPos); }//End for //自己 int myX,myY,myW,myH; myW= MYSLEF_VIDEO_W; myH= MYSLEF_VIDEO_H; myX= 10-3;// myY= nHeight-myH-10-35; DrawMyselfVideoPic( pDC, myX, myY); //绘画用户 pDC->SetTextColor(RGB(255,255,0)); for (WORD i=0;i<GAME_PLAYER;i++) { //变量定义 const tagUserData * pUserData=GetUserInfo(i); if (pUserData!=NULL) { //用户名字 pDC->SetTextAlign((i==1)?(TA_RIGHT|TA_TOP):(TA_LEFT|TA_TOP)); DrawTextString(pDC,pUserData->szName,RGB(240,240,240),RGB(50,50,50),m_ptNameNew[i].x,m_ptName[i].y); if( m_tDice>0 && m_tDice<12) { ActionDice1( pDC,m_tDice); strTemp.Format("ActionDice1 "); theApp.WriteLog(strFile, strTemp); } else { if( m_tDice== 12) { ActionDice2( pDC,m_nDiceCount1,m_nDiceCount2); strTemp.Format("ActionDice2 m_nDiceCount1=%d,m_nDiceCount2=%d", m_nDiceCount1,m_nDiceCount2); theApp.WriteLog(strFile, strTemp); // m_tDice++; }//End if }//End if //其他信息 WORD wUserTimer=GetUserTimer(i); if (wUserTimer!=0) DrawUserTimer(pDC,m_ptTimer[i].x,m_ptTimer[i].y,wUserTimer); if (pUserData->cbUserStatus==US_READY) DrawUserReady(pDC,m_ptReady[i].x,m_ptReady[i].y); //DrawUserFace(pDC,pUserData->wFaceID,m_ptFace[i].x,m_ptFace[i].y,pUserData->cbUserStatus==US_OFFLINE); //画听标记 if( m_bTingFlag[i] ) { ShowTingPic( pDC, m_ptFace[i].x,m_ptFace[i].y); }//End if } } //用户标志 if (m_wBankerUser!=INVALID_CHAIR) { //加载位图 CImageHandle ImageHandle(&m_ImageUserFlag); int nImageWidth=m_ImageUserFlag.GetWidth()/4; int nImageHeight=m_ImageUserFlag.GetHeight(); //绘画标志 for (WORD i=0;i<GAME_PLAYER;i++) { WORD wIndex=((i+GAME_PLAYER)-m_wBankerUser)%GAME_PLAYER; m_ImageUserFlag.BitBlt(pDC->m_hDC,m_UserFlagPos[i].x,m_UserFlagPos[i].y,nImageWidth,nImageHeight,nImageWidth*wIndex,0); } } //桌面麻将 for (WORD i=0;i<4;i++) { m_TableCard[i].DrawCardControl(pDC); m_DiscardCard[i].DrawCardControl(pDC); m_WeaveCard[i][0].DrawCardControl(pDC); m_WeaveCard[i][1].DrawCardControl(pDC); m_WeaveCard[i][2].DrawCardControl(pDC); m_WeaveCard[i][3].DrawCardControl(pDC); } //堆积麻将 m_HeapCard[3].DrawCardControl(pDC); m_HeapCard[0].DrawCardControl(pDC); m_HeapCard[1].DrawCardControl(pDC); m_HeapCard[2].DrawCardControl(pDC); //用户麻将 m_UserCard[0].DrawCardControl(pDC); m_UserCard[1].DrawCardControl(pDC); m_UserCard[2].DrawCardControl(pDC); m_HandCardControl.DrawCardControl(pDC); //出牌提示 if (m_bOutCard==true) { CImageHandle HandleOutCard(&m_ImageOutCard); m_ImageOutCard.AlphaDrawImage(pDC,(nWidth-m_ImageOutCard.GetWidth())/2,nHeight-150,RGB(255,0,255)); //显示听牌 if ( !m_bTingFlag[2] ) { m_btTingCard.ShowWindow(SW_SHOW); } else { m_btTingCard.ShowWindow(SW_HIDE); } } else { m_btTingCard.ShowWindow(SW_HIDE); } //等待提示 if (m_bWaitOther==true) { CImageHandle HandleWait(&m_ImageWait); m_ImageWait.AlphaDrawImage(pDC,(nWidth-m_ImageWait.GetWidth())/2,nHeight-150,RGB(255,0,255)); } //荒庄标志 if (m_bHuangZhuang==true) { CImageHandle HandleHuangZhuang(&m_ImageHuangZhuang); m_ImageHuangZhuang.AlphaDrawImage(pDC,(nWidth-m_ImageHuangZhuang.GetWidth())/2,nHeight/2-103,RGB(255,0,255)); } //用户状态 for (WORD i=0;i<GAME_PLAYER;i++) { if ((m_wOutCardUser==i)||(m_cbUserAction[i]!=0)) { //计算位置 int nXPos=0,nYPos=0; switch (i) { case 0: //北向 { nXPos=nWidth/2-32; nYPos=m_nYBorder+95; break; } case 1: //东向 { nXPos=nWidth-m_nXBorder-170; nYPos=nHeight/2-71; break; } case 2: //南向 { nXPos=nWidth/2-32; nYPos=nHeight-m_nYBorder-220; break; } case 3: //西向 { nXPos=m_nXBorder+115; nYPos=nHeight/2-71 -45; break; } } //动作背景 CImageHandle ImageHandle(&m_ImageActionBack); m_ImageActionBack.AlphaDrawImage(pDC,nXPos,nYPos,m_ImageActionBack.GetWidth()/4,m_ImageActionBack.GetHeight(), i*m_ImageActionBack.GetWidth()/4,0,RGB(255,0,255)); //绘画动作 if (m_cbUserAction[i]!=WIK_NULL) { //变量定义 int nXImagePos=0; CImageHandle ImageHandle(&m_ImageUserAction); int nItemWidth=m_ImageUserAction.GetWidth()/7; //计算位置 if (m_cbUserAction[i]&WIK_PENG) nXImagePos=nItemWidth; else if (m_cbUserAction[i]&WIK_FILL) nXImagePos=nItemWidth*2; else if (m_cbUserAction[i]&WIK_GANG) nXImagePos=nItemWidth*3; else if (m_cbUserAction[i]&WIK_CHI_HU) nXImagePos=nItemWidth*4; //绘画动作 int nItemHeight=m_ImageUserAction.GetHeight(); m_ImageUserAction.BitBlt(pDC->m_hDC,nXPos+13,nYPos+15,nItemWidth,nItemHeight,nXImagePos,0); } else { //如果已经听了,而且打了第一张出去 if ( m_IntFirstTingFlag[i]==1 && m_bTingFlag[i] ) { //绘画麻将 g_CardResource.m_ImageTableBottom.DrawCardItem(pDC,0,nXPos+18,nYPos+15); } else { //绘画麻将 g_CardResource.m_ImageTableBottom.DrawCardItem(pDC,m_cbCardData,nXPos+18,nYPos+15); } } } } return; }
//绘画界面 void CGameClientView::DrawGameView(CDC * pDC, int nWidth, int nHeight) { //绘画背景 DrawViewImage(pDC,m_ImageBack,enMode_Spread); DrawViewImage(pDC,m_ImageCenter,enMode_Centent); //绘画用户 TCHAR szBuffer[32]; for (WORD i=0;i<GAME_PLAYER;i++) { //变量定义 WORD wUserTimer=GetUserTimer(i); const tagUserData * pUserData=GetUserInfo(i); ///////////////////////////////////////////////////// //tagUserData *pUserData = new tagUserData; //strcpy( (char*)pUserData->szName, "dkjfdkfjdkfj" ); //pUserData->cbUserStatus = US_READY; //wUserTimer = 10; //m_ImageLand.DrawImage(pDC,m_ptLand[i].x,m_ptLand[i].y); //m_wBombTime = 2; /////////////////////////////////////////////////////// //绘画用户 if (pUserData!=NULL) { //用户名字 pDC->SetTextAlign( ( ( i == 2 && ! m_bDeasilOrder ) || ( i == 0 && m_bDeasilOrder ) ) ? TA_RIGHT : TA_LEFT ); pDC->SetTextColor((wUserTimer>0)?RGB(250,250,250):RGB(220,220,220)); DrawTextString( pDC, pUserData->szName, RGB( 255, 255, 255 ), RGB( 0, 0, 0 ), m_ptName[i].x,m_ptName[i].y ); //剩余扑克 // if (i!=1) { _snprintf(szBuffer,sizeof(szBuffer),TEXT("剩余:%d 张"),m_bCardCount[i]); DrawTextString( pDC, szBuffer, RGB( 255, 255, 255 ), RGB( 0, 0, 0 ), m_ptName[i].x,m_ptName[i].y+18 ); } //其他信息 if (wUserTimer!=0) DrawUserTimer(pDC,m_ptTimer[i].x,m_ptTimer[i].y,wUserTimer); if (pUserData->cbUserStatus==US_READY) DrawUserReady(pDC,m_ptReady[i].x,m_ptReady[i].y); DrawUserFace(pDC,pUserData->wFaceID,m_ptFace[i].x,m_ptFace[i].y,pUserData->cbUserStatus==US_OFFLINE); } } //叫分标志 int nXImagePos,nImageWidth=m_ImageScore.GetWidth(),nImageHeight=m_ImageScore.GetHeight(); for (WORD i=0;i<3;i++) { if ((m_bScore[i]!=0)||(m_bPass[i]==true)) { if ( m_bPass[i]==true ) nXImagePos=m_ImageScore.GetWidth()*4/5; else if ( m_bScore[i]==255 ) nXImagePos=m_ImageScore.GetWidth()*3/5; else nXImagePos=(m_bScore[i]-1)*m_ImageScore.GetWidth()/5; m_ImageScore.DrawImage(pDC,m_ptScore[i].x,m_ptScore[i].y,nImageWidth/5,nImageHeight,nXImagePos,0); } } //庄家位置 if (m_wLandUser!=INVALID_CHAIR) { //获取用户 const tagUserData * pUserData=GetUserInfo(m_wLandUser); if (pUserData!=NULL) { //变量定义 TCHAR szBuffer[64]; //设置 DC pDC->SetTextAlign(TA_LEFT|TA_TOP); pDC->SetTextColor(RGB(250,250,250)); //绘画信息 m_ImageLand.DrawImage(pDC,m_ptLand[m_wLandUser].x,m_ptLand[m_wLandUser].y); _snprintf(szBuffer,sizeof(szBuffer),TEXT("地主:%s"),pUserData->szName); pDC->TextOut(m_nXBorder+m_nXFace+10,m_nYBorder+8,szBuffer,lstrlen(szBuffer)); //绘画头像 DrawUserFace(pDC,pUserData->wFaceID,m_nXBorder+5,m_nYBorder+5,false); //叫牌分数 LONG lScore=m_cbLandScore*m_lBaseScore; _snprintf(szBuffer,sizeof(szBuffer),TEXT("分数:%ld 分"),lScore); DrawTextString( pDC, szBuffer, RGB( 255, 255, 255 ), RGB( 0, 0, 0 ), m_nXBorder+m_nXFace+10,m_nYBorder+25 ); } } //绘画爆炸 if (m_bBombEffect==true) { //加载资源 CImageHandle HandleBombEffect(&m_ImageBombEffect); //绘画效果 INT nImageHeight=m_ImageBombEffect.GetHeight(); INT nImageWidth=m_ImageBombEffect.GetWidth()/BOMB_EFFECT_COUNT; m_ImageBombEffect.AlphaDrawImage(pDC,(nWidth-nImageWidth)/2,0,nImageWidth,nImageHeight, nImageWidth*(m_cbBombFrameIndex%BOMB_EFFECT_COUNT),0,RGB(255,0,255)); } //炸弹倍数 if (m_wBombTime>1) { //炸弹标志 CImageHandle ImageHandle(&m_ImageBomb); m_ImageBomb.AlphaDrawImage(pDC,m_nXBorder+5,nHeight-m_nYBorder-m_ImageBomb.GetHeight()-5,RGB(255,0,255)); //设置 DC pDC->SetTextColor(RGB(250,250,250)); pDC->SetTextAlign(TA_LEFT|TA_TOP); //炸弹倍数 TCHAR szBuffer[64]; _snprintf(szBuffer,sizeof(szBuffer),TEXT("炸弹翻倍:%d"),m_wBombTime); DrawTextString( pDC, szBuffer, RGB( 255, 255, 255 ), RGB( 0, 0, 0 ), m_nXBorder+m_ImageBomb.GetWidth()+10,nHeight-m_nYBorder-20 ); // pDC->TextOut(m_nXBorder+m_ImageBomb.GetWidth()+10,nHeight-m_nYBorder-20,szBuffer,lstrlen(szBuffer)); } //描述信息 if (m_bLandTitle==true) { //创建资源 CFont InfoFont; InfoFont.CreateFont(-36,0,0,0,400,0,0,0,134,3,2,1,2,TEXT("黑体")); //设置 DC pDC->SetTextColor(RGB(201,229,133)); pDC->SetTextAlign(TA_CENTER|TA_TOP); CFont * pOldFont=pDC->SelectObject(&InfoFont); //绘画信息 pDC->TextOut(nWidth/2,200,"正等待用户叫分"); //清理资源 pDC->SelectObject(pOldFont); InfoFont.DeleteObject(); } //托管标识 for ( WORD wChairID = 0; wChairID < GAME_PLAYER; ++wChairID ) { const tagUserData * pUserData=GetUserInfo( wChairID ); if ( pUserData == NULL ) m_bUserTrustee[ wChairID ] = false; if ( m_bUserTrustee[ wChairID ] ) { if ( wChairID == 1 ) m_ImageUserTrustee.DrawImage( pDC, m_ptLand[ wChairID ].x + 40, m_ptLand[ wChairID ].y - 1 ); else if ( wChairID == 0 && !m_bDeasilOrder || wChairID == 2 && m_bDeasilOrder ) m_ImageUserTrustee.DrawImage( pDC, m_ptFace[ wChairID ].x + m_nXFace + 8, m_ptFace[ wChairID ].y + m_nYFace - m_ImageUserTrustee.GetHeight() + 3 ); else m_ImageUserTrustee.DrawImage( pDC, m_ptFace[ wChairID ].x - m_nXFace - 8, m_ptFace[ wChairID ].y + m_nYFace - m_ImageUserTrustee.GetHeight() + 3 ); } } return; }
//界面绘画函数 void CSkinButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { //定义变量 CRect ClientRect; GetClientRect(&ClientRect); bool bDisable=((lpDrawItemStruct->itemState&ODS_DISABLED)!=0); bool bButtonDown=((lpDrawItemStruct->itemState&ODS_SELECTED)!=0); //设置 DC HDC hDC=lpDrawItemStruct->hDC; //获取文字 CString strText; GetWindowText(strText); //加载背景图 CImageHandle ImageHandle; if (m_ImageBack.IsSetLoadInfo()) ImageHandle.AttachResource(&m_ImageBack); else ImageHandle.AttachResource(&m_SkinAttribute.m_ImageBack); if (ImageHandle.IsResourceValid()) { //计算位图位置 int iPartWidth=ImageHandle->GetWidth()/5,iDrawPos=0; if (bDisable) iDrawPos=iPartWidth*4; else if (bButtonDown) iDrawPos=iPartWidth; else if (m_bHovering) iDrawPos=iPartWidth*3; //绘画背景图 if (m_bExpand==false) ImageHandle->BitBlt(hDC,0,0,ClientRect.Width(),ClientRect.Height(),iDrawPos,0,SRCCOPY); else ImageHandle->StretchBlt(hDC,0,0,ClientRect.Width(),ClientRect.Height(),iDrawPos,0,iPartWidth,ImageHandle->GetHeight(),SRCCOPY); } else { //绘画默认界面 CDC * pDC=CDC::FromHandle(hDC); pDC->FillSolidRect(&ClientRect,GetSysColor(COLOR_BTNFACE)); if (bButtonDown) pDC->Draw3dRect(&ClientRect,GetSysColor(COLOR_WINDOWFRAME),GetSysColor(COLOR_3DHILIGHT)); else pDC->Draw3dRect(&ClientRect,GetSysColor(COLOR_3DHILIGHT),GetSysColor(COLOR_WINDOWFRAME)); } //绘画图标 if (bButtonDown) ClientRect.top+=2; if (m_hIcon) { DrawIconEx(hDC,ClientRect.left+6,ClientRect.top+(ClientRect.Height()-16)/2+1,m_hIcon,16,16,0,NULL,DI_NORMAL); ClientRect.left+=22; } //绘画字体 ClientRect.top+=1; ::SetBkMode(hDC,TRANSPARENT); if(!m_bShowTextFrame) { if (bDisable) ::SetTextColor(hDC,GetSysColor(COLOR_GRAYTEXT)); else ::SetTextColor(hDC,m_crTextColor); DrawText(hDC,strText,strText.GetLength(),ClientRect,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS); } //艺术字体 else { CDC * pDC=CDC::FromHandle(hDC); DrawTextString(pDC,strText,m_crTextColor,m_crTextFrameColor,ClientRect); } return; }