Exemplo n.º 1
0
void CTListItemParty::Draw(){
	if(!IsVision())	return;
	
	POINT pt = GetPosition();
	ResetTransform((float)pt.x, (float)pt.y);

	tagRECT pos;
	SetRect(&pos, 4, 0, 174, 20);

	unsigned int colour = 0xFF0000FF;

	if(!IsSelected())
		colour = (mParty.mMemberCount < MaxMembers(mParty.mPartyLevel)) ? 0xFF000000 : 0xFFFF0000;

	drawFont(GameDATA->m_hFONT[FONT_SMALL], 1, &pos, colour, FONT_POS_LEFT, mParty.mLeaderName);
	drawFont(GameDATA->m_hFONT[FONT_SMALL], 1, &pos, colour, FONT_POS_RIGHT, String("Lev: %1").arg(mParty.mPartyLevel));

	if(IsInside(mMouse.x, mMouse.y)){
		if(!gPartyToolTip)
			gPartyToolTip = new Tooltip();
		
		gPartyToolTip->Clear();
		gPartyToolTip->AddString(String("Leader: %1").arg(mParty.mLeaderName));
		gPartyToolTip->AddString(String("Party Level: %1").arg(mParty.mPartyLevel));
		gPartyToolTip->AddString(String("Players: %1/%2").arg(mParty.mMemberCount).arg(MaxMembers(mParty.mPartyLevel)));
		gPartyToolTip->AddString(String("Average Level: %1").arg(mParty.mAverageLevel));
		gPartyToolTip->AddString(String("Zone: %1").arg(StringManager::Instance()->GetZoneName(mParty.mZoneNO)));
		mMouse.x += 20;
		gPartyToolTip->SetPosition(mMouse);

		gDrawToolTip = true;
	}
}
Exemplo n.º 2
0
void CMemoViewDlg::Draw()
{
	if(!IsVision() ) return;
	CTDialog::Draw();

#ifdef __PRIVATECHAT2
#else
	D3DXMATRIX mat;	
	D3DXMatrixTranslation( &mat, (float)m_sPosition.x, (float)m_sPosition.y,0.0f);
	::setTransformSprite( mat );

	drawFont( g_GameDATA.m_hFONT[ FONT_NORMAL_BOLD ], true, 40, 8, g_dwORANGE, 
		CStr::Printf("From:%s", m_strName.c_str() ) );

	RECT rcDraw ={ 10, 30, 200, 100 };
	drawFont( g_GameDATA.m_hFONT[ FONT_NORMAL], true, &rcDraw, g_dwWHITE, DT_WORDBREAK ,m_strContent.c_str() );
#endif
}
Exemplo n.º 3
0
void CTFontImpl::Draw( int iFont, bool bUseSprite, RECT* pRect, D3DCOLOR Color, DWORD dwFormat, const char * pMsg )
{
	if( pMsg == NULL )
		return;
	int iFontIndex = iFont;
	if( iFont < 0 || iFont >= MAX_FONT )
		iFontIndex = 0;

	drawFont( g_GameDATA.m_hFONT[ iFontIndex ], bUseSprite, pRect, Color, dwFormat, pMsg );
}
Exemplo n.º 4
0
void CFont::drawFontCentered(SDL_Surface* dst, const std::string& text, Uint16 x, Uint16 width, Uint16 yoff, bool highlight)
{
	Uint16 xmidpos = 0;

	for( unsigned int i=0 ; i<text.size() ; i++)
		xmidpos += m_widthtable[text[i]];

	xmidpos = (width-xmidpos)/2+x;

	drawFont(dst, text, xmidpos, yoff, highlight);
}
Exemplo n.º 5
0
void CTFontImpl::Draw( int iFont, bool bUseSprite, int x, int y, D3DCOLOR Color,  const char * pMsg )
{
	if( pMsg == NULL || iFont < 0 || iFont >= MAX_FONT )
		return;

	int iFontIndex = iFont;
	if( iFont < 0 || iFont >= MAX_FONT )
		iFontIndex = 0;

	drawFont( g_GameDATA.m_hFONT[ iFontIndex  ], bUseSprite, x, y, Color, pMsg );
}
Exemplo n.º 6
0
void RunAchievementPopup(){
	static int alpha;

	if(gDrawAchievementPopup == 2){
		alpha = 0xFFFF;
		gDrawAchievementPopup = 1;
	}

	if(alpha > 0){
		const char* nameText = gNewAchievement->mName;
		const char* descText = gNewAchievement->mDescription;

		int drawIcon = gNewAchievement->mIcon;
		int drawX = (getScreenWidth() / 2) - (388 / 2);
		int fade = (alpha & 0xFF);
		int colour = fade << 24 | 0xFFFFFF;

		ResetTransform(0,0);
		DrawImpl::Instance()->Draw2D(drawX, 70, IMAGE_RES_UI, gUnlockedGUI, colour);
		ResetTransform(0,0);
		DrawImpl::Instance()->Draw2D(drawX + 2, 70 + 3, IMAGE_RES_ITEM, drawIcon, colour);
		ResetTransform(0,0);

		tagRECT pos;
		colour = fade << 24 | 0xFFFF00;
		SetRect(&pos, drawX + 43, 75, drawX + 357, 91);
		drawFont(GameDATA->m_hFONT[FONT_NORMAL], 1, &pos, colour, 1, nameText);

		colour = fade << 24 | 0xFFFFFF;
		SetRect(&pos, drawX + 43, 97, drawX + 357, 114);
		drawFont(GameDATA->m_hFONT[FONT_SMALL], 1, &pos, colour, 1, descText);

		if(alpha > 0xFF){
			alpha -= 0x200;
			if(alpha < 0xFF) alpha = 0xFF;
		}else
			alpha -= 4;
	}else
		gDrawAchievementPopup = 0;
}
Exemplo n.º 7
0
void RunBossScript(){
	int bossIcon = gCurrentInstance->mGame->mBossIcon;
	if(!bossIcon) return;

	int monsterID1;

	if(gCurrentInstance->mID == 1)
		monsterID1 = 2029;
	else if(gCurrentInstance->mID == 2)
		monsterID1 = 2037;
	else if(gCurrentInstance->mID == 3)
		monsterID1 = 2019;

	for(int i = 1; i <= 65535; i++){
		CObjCHAR* boss = CObjMGR::Instance()->Get_ClientCharOBJ(i, false);

		if(!boss || ((boss->GetCharNO() != monsterID1) && (boss->GetCharNO() != (monsterID1 + 1))))
			continue;

		if(boss->GetCharNO() == monsterID1) 
			bossIcon++;

		int hp = boss->GetHP();
		if(hp <= 0) continue;

		int maximumHP = boss->GetMaxHP();
		float percentage = (100.0f * hp / maximumHP);
		int leftPosition = 235 + 20;
		int topPosition = 75;

		tagRECT pos;
		SetRect(&pos, leftPosition + 56, topPosition + 19, leftPosition + 309, topPosition + 42);

		ResetTransform(0, 0);
		DrawImpl::Instance()->Draw2DW(leftPosition + 56.0f, topPosition + 19.0f, 0.0f, 260, IMAGE_RES_UI, gBossGUI);
		ResetTransform(0, 0);
		DrawImpl::Instance()->Draw2DW(leftPosition + 58.0f, topPosition + 22.0f, 0.0f, 249 * hp / maximumHP, IMAGE_RES_UI, gBossGUI + 1);		
		ResetTransform(0, 0);
		DrawImpl::Instance()->Draw2D(leftPosition, topPosition, IMAGE_RES_UI, bossIcon, 0xFFFFFFFF);
		ResetTransform(0, 0);
		drawFont(GameDATA->m_hFONT[FONT_NORMAL_OUTLINE], 1, &pos, 0xFFFFFFFF, DT_CENTER | DT_VCENTER, String("%1%2").arg(percentage).arg("%"));

		return;
	}
}
Exemplo n.º 8
0
void RunScoreDisplay(){
	ResetTransform(0, 0);

	int centerX = (getScreenWidth() / 2);
	int centerY = (getScreenHeight() / 2);
	
	switch(gCurrentInstance->mGame->mType){
		case DRAGON_HUNT:
			return;
		case CONQUEST:
			{
				for(int i = 0; i < 4; ++i){
					int icon = 0;

					if(gCurrentInstance->mData[i] == 0)
						icon = 14;
					else if(gCurrentInstance->mData[i] == 3)
						icon = 24 + i;
					else if(gCurrentInstance->mData[i] == 4)
						icon = 18 + i;

					DrawImpl::Instance()->Draw2D(centerX + ((i - 2) * 22), 55, IMAGE_RES_TARGETMARK, icon, 0xFFFFFFFF);
					ResetTransform(0, 0);
				}
			}
			break;
		case KOTH:
			{
				int icon = 0;

				if(gCurrentInstance->mData[0] == 0)
					icon = 14;
				else if(gCurrentInstance->mData[0] == 3)
					icon = 13;
				else if(gCurrentInstance->mData[0] == 4)
					icon = 12;

				DrawImpl::Instance()->Draw2D(centerX - 10, 55, IMAGE_RES_TARGETMARK, icon, 0xFFFFFFFF);
				ResetTransform(0, 0);
			}
			break;
		case CTF:
			{
				int red = gFlagRedGUI;
				int blue = gFlagRedGUI + 1;

				if(gFlagRedStatus == 0)
					red += 2;

				if(gFlagBlueStatus == 0)
					blue += 2;
		
				DrawImpl::Instance()->Draw2D(centerX - 100, 60, IMAGE_RES_UI, red, 0xFFFFFFFF);
				ResetTransform(0, 0);

				DrawImpl::Instance()->Draw2D(centerX + 50, 60, IMAGE_RES_UI, blue, 0xFFFFFFFF);
				ResetTransform(0, 0);
			}
			break;
	}

	SIZE sizeRed = ::getFontTextExtent(GameDATA->m_hFONT[FONT_NORMAL_OUTLINE], "Red: ");
	SIZE sizeBlue = ::getFontTextExtent(GameDATA->m_hFONT[FONT_NORMAL_OUTLINE], "Blue: ");
	SIZE fullSizeRed = ::getFontTextExtent(GameDATA->m_hFONT[FONT_NORMAL_OUTLINE], String("Red: %1").arg(gCurrentInstance->mScoreRed));
	SIZE fullSizeBlue = ::getFontTextExtent(GameDATA->m_hFONT[FONT_NORMAL_OUTLINE], String("Blue: %1").arg(gCurrentInstance->mScoreBlue));

	drawFont(GameDATA->m_hFONT[FONT_NORMAL_OUTLINE], 1, centerX - (fullSizeRed.cx / 2), 80, 0xFFFF5555, "Red:");
	drawFont(GameDATA->m_hFONT[FONT_NORMAL_OUTLINE], 1, centerX - (fullSizeBlue.cx / 2), 82 + sizeRed.cy, 0xFF77AAFF, "Blue:");

	drawFont(GameDATA->m_hFONT[FONT_NORMAL_OUTLINE], 1, centerX - (fullSizeRed.cx / 2) + sizeRed.cx, 80, 0xFFFFFFFF, String("%1").arg(gCurrentInstance->mScoreRed));
	drawFont(GameDATA->m_hFONT[FONT_NORMAL_OUTLINE], 1, centerX - (fullSizeBlue.cx / 2) + sizeBlue.cx, 82 + sizeRed.cy, 0xFFFFFFFF, String("%1").arg(gCurrentInstance->mScoreBlue));
}
Exemplo n.º 9
0
void CSeparateDlg::Draw()
{
	if( !IsVision() ) return;

	CTDialog::Draw();

	m_pCurrState->Draw();


	m_MaterialItemSlot.Draw();

	CIcon* pIcon = NULL;

	CWinCtrl * pCtrl = NULL;
	CWinCtrl * pCtrl2 = NULL;

	RECT rcDraw, rcDrawCount;
	int		iGapY = 0;

	///필요 MP or 줄리
	D3DXMATRIX mat;	
	D3DXMatrixTranslation( &mat, (float)m_sPosition.x, (float)m_sPosition.y,0.0f);
	::setTransformSprite( mat );

	if( pIcon = m_MaterialItemSlot.GetIcon() )
	{
		if( pCtrl = Find("DEST_ITEM_NAME") )
		{
			((CTImage*)pCtrl)->SetAlign(DT_CENTER | DT_VCENTER);
			((CTImage*)pCtrl)->SetText(pIcon->GetName());//대상 아이템
		}
	}
//05. 12. 23 - 김주현 : 분해가.. 기본스킬에 등록됨에 따라 기존에 뺏어오던 돈이랑 mp는 삭제되었다
//하지만 UI 작업이 아직 안된 관계로 찍는 부분만 삭제하고 나중에 UI 수정 작업을 해줘야 한다.
/*
	if(pCtrl = Find("REQ_MP_NUM"))
	{
		SetRect( &rcDraw,
			pCtrl->GetOffset().x, 
			pCtrl->GetOffset().y, 
			pCtrl->GetOffset().x+pCtrl->GetWidth(), 
			pCtrl->GetOffset().y+pCtrl->GetHeight() );

		CSeparate& Separate = CSeparate::GetInstance();
		switch( Separate.GetType() )
		{
		case CSeparate::TYPE_SKILL:
			drawFontf( g_GameDATA.m_hFONT[ FONT_NORMAL ], true, &rcDraw ,g_dwWHITE,DT_RIGHT,"%d", Separate.GetRequireMp() );
			break;
		case CSeparate::TYPE_NPC:
			drawFontf( g_GameDATA.m_hFONT[ FONT_NORMAL ], true, &rcDraw ,g_dwWHITE,DT_RIGHT,"%d", Separate.GetRequireMoney() );
			break;
		default:
			break;

		}		
	}
*/
	if(pCtrl = Find( "MATERIAL_00" ))
	{
		SetRect( &rcDraw,
			pCtrl->GetOffset().x,
			pCtrl->GetOffset().y + 2,
			pCtrl->GetOffset().x + pCtrl->GetWidth(),
			pCtrl->GetOffset().y + pCtrl->GetHeight() + 2);
		if( pCtrl2 = Find( "MATERIAL_01" ) )
		{
			iGapY = pCtrl2->GetPosition().y - pCtrl->GetPosition().y;
		}

	}
	if(pCtrl = Find( "MATERIAL_NUM_00" ))
	{
		SetRect( &rcDrawCount,
			pCtrl->GetOffset().x,
			pCtrl->GetOffset().y,
			pCtrl->GetOffset().x + pCtrl->GetWidth(),
			pCtrl->GetOffset().y + pCtrl->GetHeight() );
	}


	int j= 0;

	m_ResultItemSet = CSeparate::GetInstance().GetResultItemSet();

	std::vector< CSlot >::iterator iter;

	CSeparateDlgStateResult* pSeparateStateResult = CSeparateDlgStateResult::GetInstance();

	if(!pSeparateStateResult->GetStartSeparateState())
	{
		m_vecSingleString.clear();
	}
	else
	{

		if( pSeparateStateResult == NULL) return;

		if(pSeparateStateResult->GetViewNum() > 4)
		{
			iViewItem = -1;
		}
		else
		{
			iViewItem = pSeparateStateResult->GetViewNum();
		}




		for( int i = 0; i < CSeparate::GetInstance().GetResultCnt() - 1 && i <= iViewItem; i++)
		{
			m_OutputItemSlots[i].Draw();

			D3DXMatrixTranslation( &mat, (float)m_sPosition.x, (float)m_sPosition.y,0.0f);
			::setTransformSprite( mat );

			if( pIcon = m_OutputItemSlots[i].GetIcon() )
			{
				CSinglelineString sStrBuf;
				sStrBuf.set_color(g_dwBLACK);
				sStrBuf.set_format(DT_CENTER | DT_VCENTER);
				sStrBuf.set_string( pIcon->GetName() , rcDraw );
				sStrBuf.draw();

				if( sStrBuf.is_ellipsis() )
				{
					m_vecSingleString.push_back( sStrBuf );
				}			

				char Temp[125] = "";
				sprintf( Temp, "%d",CSeparate::GetInstance().GetOutputItemQuantity(i) );

				drawFont( g_GameDATA.m_hFONT[ FONT_NORMAL ], true, &rcDrawCount, g_dwWHITE, DT_CENTER , Temp );
			}
			rcDraw.top		+= iGapY;
			rcDraw.bottom	+= iGapY;
			rcDrawCount.top += iGapY;
			rcDrawCount.bottom += iGapY;

		}

	}
}
Exemplo n.º 10
0
Arquivo: xdemo.c Projeto: cuzz/xrdp
int main(int argc, char **argv)
{
    XEvent          evt;
    Colormap        colormap;
    struct timeval  tv;
    int             screenNumber;
    long            eventMask;
    unsigned long   white;
    unsigned long   black;
    Status          rc;
    int             iters;
    int             opt;
    int             draw_lines;
    int             draw_rects;
    int             draw_stipples;
    int             draw_fonts;
    int             draw_image;
    int             zero_counters;
    int             scroll_type;
    char            image_file[256];
    char            proxy_app[256];
    char            msg[4096];

    // set some defaults
    g_winWidth = 640;
    g_winHeight = 480;
    iters = 5000;
    draw_lines = 1;
    draw_rects = 1;
    draw_stipples = 1;
    draw_fonts = 1;
    draw_image = 1;
    g_delay_dur = 1000;
    scroll_type = SCROLL_SMOOTH1;
    zero_counters = 0;
    strcpy(image_file, "yosemite.bmp");
    strcpy(msg, "To be or not to be!");

    // process cmd line args
    opterr = 0;
    while ((opt = getopt(argc, argv, "lrsg:c:f:i:d:o:z:")) != -1)
    {
        switch (opt)
        {
        case 'g':
            if (sscanf(optarg, "%dx%d", &g_winWidth, &g_winHeight) != 2) {
                fprintf(stderr, "\nerror: invalid geometry specified\n\n");
                usage();
                return -1;
            }
            break;

        case 'c':
            if (sscanf(optarg, "%d", &iters) != 1) {
                fprintf(stderr, "\nerror: invalid count specified\n\n");
                usage();
                return -1;
            }
            break;

        case 'l':
            draw_lines = 1;
            draw_rects = 0;
            draw_stipples = 0;
            draw_fonts = 0;
            draw_image = 0;
            break;

        case 'r':
            draw_rects = 1;
            draw_lines = 0;
            draw_stipples = 0;
            draw_fonts = 0;
            draw_image = 0;
            break;

        case 's':
            draw_stipples = 1;
            draw_lines = 0;
            draw_rects = 0;
            draw_fonts = 0;
            draw_image = 0;
            break;

        case 'f':
            if (strlen(optarg) <= 0) {
                fprintf(stderr, "\nerror: -f option requires an argument\n\n");
                usage();
                return -1;
            }
            draw_fonts = 1;
            strncpy(msg, optarg, 4096);
            draw_lines = 0;
            draw_rects = 0;
            draw_stipples = 0;
            draw_image = 0;
            break;

        case 'i':
            if (strlen(optarg) <= 0) {
                fprintf(stderr, "\nerror: -i option requires an argument\n\n");
                usage();
                return -1;
            }
            draw_image = 1;
            strncpy(image_file, optarg, 255);
            draw_lines = 0;
            draw_rects = 0;
            draw_stipples = 0;
            draw_fonts = 0;
            break;

        case 'h':
            usage();
            return 0;
            break;

        case 'v':
            printf("xdemo Ver 1.0\n");
            return 0;
            break;

        case 'd':
            if (sscanf(optarg, "%d", &g_delay_dur) != 1) {
                fprintf(stderr, "\nerror: -d option requires an argument\n\n");
                usage();
                return -1;
            }
            break;

        case 'z':
            if (strlen(optarg) <= 0) {
                fprintf(stderr, "\nerror: invalid proxy application specified\n\n");
                usage();
                return -1;
            }
            strcpy(proxy_app, optarg);
	    printf("##### LK_TODO: proxy_app=%s\n", proxy_app);
            zero_counters = 1;
            break;

        case 'o':
            if (strcmp(optarg, "jump") == 0) {
                scroll_type = SCROLL_JUMP;
            }
            else if (strcmp(optarg, "smooth1") == 0) {
                scroll_type = SCROLL_SMOOTH1;
            }
            else if (strcmp(optarg, "smooth2") == 0) {
                scroll_type = SCROLL_SMOOTH2;
            }
            else if (strcmp(optarg, "smooth3") == 0) {
                scroll_type = SCROLL_SMOOTH3;
            }
            else if (strcmp(optarg, "smooth4") == 0) {
                scroll_type = SCROLL_SMOOTH4;
            }
            else {
                fprintf(stderr, "\ninvalid scroll type specified\n\n");
                usage();
                return -1;
            }
            break;

        default:
            usage();
            return -1;
        }
    }

    // must have at least one operation
    if ((!draw_lines) && (!draw_rects) && (!draw_stipples) &&
        (!draw_fonts) && (!draw_image)) {
        usage();
        return -1;
    }

    g_disp = XOpenDisplay(NULL);
    if (!g_disp) {
        dprint("error opening X display\n");
        exit(-1);
    }

    screenNumber = DefaultScreen(g_disp);
    white = WhitePixel(g_disp, screenNumber);
    black = BlackPixel(g_disp, screenNumber);

    g_win = XCreateSimpleWindow(g_disp,
                                DefaultRootWindow(g_disp),
                                50, 50,                  // origin
                                g_winWidth, g_winHeight, // size
                                0, black,                // border
                                white );                 // backgd

    XMapWindow(g_disp, g_win);
    //eventMask = StructureNotifyMask | MapNotify | VisibilityChangeMask;
    eventMask = StructureNotifyMask | VisibilityChangeMask;
    XSelectInput(g_disp, g_win, eventMask);

    g_gc = XCreateGC(g_disp, g_win,
        0,                       // mask of values
        NULL );                  // array of values
    #if 0
    do
    {
        dprint("about to call XNextEvent(...)\n");
        XNextEvent(g_disp, &evt);// calls XFlush
        dprint("returned from XNextEvent(...)\n");
    }
    //while(evt.type != MapNotify);
    while(evt.type != VisibilityNotify);
    #endif

    // get access to the screen's color map
    colormap = DefaultColormap(g_disp, screenNumber);

    // alloc red color
    rc = XAllocNamedColor(g_disp, colormap, "red", &g_colors[0], &g_colors[0]);
    if (rc == 0) {
        printf("XAllocNamedColor - failed to allocated 'red' color.\n");
        exit(1);
    }

    rc = XAllocNamedColor(g_disp, colormap, "green", &g_colors[1], &g_colors[1]);
    if (rc == 0) {
        printf("XAllocNamedColor - failed to allocated 'green' color.\n");
        exit(1);
    }

    rc = XAllocNamedColor(g_disp, colormap, "blue", &g_colors[2], &g_colors[2]);
    if (rc == 0) {
        printf("XAllocNamedColor - failed to allocated 'blue' color.\n");
        exit(1);
    }
    rc = XAllocNamedColor(g_disp, colormap, "yellow", &g_colors[3], &g_colors[3]);
    if (rc == 0) {
        printf("XAllocNamedColor - failed to allocated 'yellow' color.\n");
        exit(1);
    }
    rc = XAllocNamedColor(g_disp, colormap, "orange", &g_colors[4], &g_colors[4]);
    if (rc == 0) {
        printf("XAllocNamedColor - failed to allocated 'orange' color.\n");
        exit(1);
    }

    if (zero_counters) {
        signal_tcp_proxy(proxy_app);
    }

    if (draw_lines) {
        start_timer(&tv);
        drawLines(iters);
        printf("drew %d lines in %d ms\n", iters, time_elapsed_ms(tv));
    }

    if (draw_rects) {
        start_timer(&tv);
        drawRectangles(iters);
        printf("drew %d rects in %d ms\n", iters, time_elapsed_ms(tv));
    }

    if (draw_stipples) {
        start_timer(&tv);
        // LK_TODO
    }

    if (draw_fonts) {
        start_timer(&tv);
    	drawFont(iters, msg);
        printf("drew %d strings in %d ms\n", iters, time_elapsed_ms(tv));
    }

    if (draw_image) {
        start_timer(&tv);
        drawBMP(image_file, scroll_type);
        printf("drew BMP in %d ms\n", time_elapsed_ms(tv));
    }

    if (zero_counters) {
        signal_tcp_proxy(proxy_app);
    }

    eventMask = ButtonPressMask|ButtonReleaseMask;

    XSelectInput(g_disp, g_win, eventMask);

    do
    {
        XNextEvent(g_disp, &evt); // calls XFlush()
    }
    while(evt.type != ButtonRelease);

    XDestroyWindow(g_disp, g_win);
    XCloseDisplay(g_disp);

    return 0;
}