Пример #1
0
/// Malt den Arbeiter beim Arbeiten
void nofWoodcutter::DrawWorking(int x,int y)
{
	unsigned short i = GAMECLIENT.Interpolate(118,current_ev);


	if(i < 10)
	{
		// 1. Ein Stück vom Baum nach links laufen
		LOADER.GetBobN("jobs")->Draw(5,0,false,i%8,x-i,y,COLORS[gwg->GetPlayer(player)->color]);
		DrawShadow(x-i,y,static_cast<unsigned char>(i%8),dir);
	}
	else if(i < 82)
	{
		// 2. Hacken
		LOADER.GetImageN("rom_bobs", 24+(i-10)%8)->Draw(x-9,y,0,0,0,0,0,0, COLOR_WHITE, COLORS[gwg->GetPlayer(player)->color]);

		if((i-10)%8 == 3)
		{
			SoundManager::inst().PlayNOSound(53,this,i);
			was_sounding = true;
		}
		
	}
	else if(i<105)
	{
		// 3. Warten bis Baum umfällt
		LOADER.GetImageN("rom_bobs", 24)->Draw(x-9,y,0,0,0,0,0,0, COLOR_WHITE, COLORS[gwg->GetPlayer(player)->color]);

		if(i == 90)
		{
			SoundManager::inst().PlayNOSound(85,this,i);
			was_sounding = true;
		}
	}
	else if(i<115)
	{
		// 4. Wieder zurückgehen nach rechts
		LOADER.GetBobN("jobs")->Draw(5,3,false,(i-105)%8,x-(9-(i-105)),y,COLORS[gwg->GetPlayer(player)->color]);
		DrawShadow(x-(9-(i-95)),y,static_cast<unsigned char>((i-105)%8),dir);
	}
	else
	{
		// 5. kurz am Baum warten (quasi Baumstamm in die Hand nehmen)
		LOADER.GetBobN("jobs")->Draw(5,3,false,1,x,y,COLORS[gwg->GetPlayer(player)->color]);
		DrawShadow(x,y,1,dir);

	}


}
Пример #2
0
void CEditValue::Draw()
{
    if ( (m_state & STATE_VISIBLE) == 0 )  return;

    if ( m_state & STATE_SHADOW )
    {
        DrawShadow(m_pos, m_dim);
    }

    if (m_edit != nullptr)
    {
        m_edit->SetState(STATE_ENABLE, TestState(STATE_ENABLE));
        m_edit->Draw();
    }
    if (m_buttonUp != nullptr)
    {
        m_buttonUp->SetState(STATE_DEAD, TestState(STATE_DEAD));
        m_buttonUp->Draw();
    }
    if (m_buttonDown != nullptr)
    {
        m_buttonDown->SetState(STATE_DEAD, TestState(STATE_DEAD));
        m_buttonDown->Draw();
    }
}
Пример #3
0
/*******************************************************************************
関数名:	void DrawGame(void)
引数:	なし
戻り値:	なし
説明:	ゲームの描画関数
*******************************************************************************/
void DrawGame(void)
{
	//カメラの設置
	SetCamera();

	//ステージの描画処理
	DrawStageManager();
	DrawMeshDome();
	
	//DrawModel();
	DrawParticle();
	DrawEnemy();
	DrawEnemyBullet();
	DrawItemBullet();

	if( IsDebugMode()) DrawPlayer();
	
	DrawPlayerBullet();
	DrawGun();
	DrawShadow();
	//DrawBillBoard();	

	DrawTime();
	DrawGunSight();
	DrawNumBullet();
	DrawNumLife();
	DrawClock();
	DrawEnemyNum();
}
Пример #4
0
/************************************************************************
 *
 *  ChangeManaged
 *	Process a changed in managed state of the child.  If its
 *	size is out of sync with the frame, make a resize request
 *	to change the size of the frame.
 *	Note: called before ConstraintDestroy.
 *
 ************************************************************************/
static void 
ChangeManaged(
        Widget wid )
{
   XmFrameWidget fw = (XmFrameWidget) wid ;

   Widget title_area = (fw->frame.title_area &&
			XtIsManaged(fw->frame.title_area)) ?
			fw->frame.title_area : (Widget) NULL;
   Dimension t_w = 0;
   Dimension t_h = 0;
   Dimension t_bw = (title_area) ? title_area->core.border_width : 0;

   Widget work_area = (fw->frame.work_area &&
			XtIsManaged(fw->frame.work_area)) ?
			fw->frame.work_area : (Widget) NULL;

   Dimension w_w = (work_area) ? work_area->core.width : 0;
   Dimension w_h = (work_area) ? work_area->core.height : 0;
   Dimension w_bw = (work_area) ? work_area->core.border_width : 0;
   Dimension fwWidth, fwHeight;

   if (title_area) 
   {                                          
	/* We don't want the current size of the title object -- width/height
	** may have been set on it. Because we'll be forcing it to the size we
	** want (see ConfigureChildren), we must use the "natural" size here,
	** so query its value now. (Use current border_width.)
        */
	XtWidgetGeometry title_reply;                           
	XtQueryGeometry (title_area, NULL, &title_reply);      
	t_w = (title_reply.request_mode & CWWidth) ?          
		title_reply.width : title_area->core.width;   
	t_h = (title_reply.request_mode & CWHeight) ?       
		title_reply.height : title_area->core.height;
   }                             

   /* need to  check on initial sizing (not null) */
   if (XtIsRealized((Widget)fw) || (XtWidth(fw) == 0) || (XtHeight(fw) == 0)) {
       CalcFrameSize (fw, t_w, t_h, t_bw, w_w, w_h, w_bw,
		      &fwWidth, &fwHeight);

       while (XtMakeResizeRequest ((Widget) fw, 
				   fwWidth, fwHeight,
				   &fwWidth, &fwHeight) == XtGeometryAlmost) 
	 /*EMPTY*/;
       ClearShadow(fw);
   }
 
   ConfigureChildren(fw, NULL, NULL);

   DrawShadow(fw);

   XmeNavigChangeManaged((Widget) fw);
}
Пример #5
0
void DrawActorPics(
	const ActorPics *pics, const Vec2i picPos, const direction_e d)
{
	if (pics->IsDead)
	{
		if (pics->IsDying)
		{
			DrawBody(&gGraphicsDevice, pics, picPos);
		}
	}
	else
	{
		// Draw shadow
		if (!pics->IsTransparent)
		{
			DrawShadow(&gGraphicsDevice, picPos, Vec2iNew(8, 6));
		}
		for (int i = 0; i < 3; i++)
		{
			const Pic *picp = NULL;
			switch (pics->DrawOrder[i])
			{
			case BODY_PART_HEAD:
				picp = pics->Head;
				break;
			case BODY_PART_BODY:
				picp = pics->Body;
				break;
			case BODY_PART_GUN:
				picp = pics->Gun;
				break;
			}
			if (picp == NULL)
			{
				continue;
			}
			const Vec2i drawPos = GetActorDrawOffset(
				picPos, picp, pics->DrawOrder[i], d);
			if (pics->IsTransparent)
			{
				BlitBackground(
					&gGraphicsDevice, picp, drawPos, pics->Tint, true);
			}
			else if (pics->Mask != NULL)
			{
				BlitMasked(&gGraphicsDevice, picp, drawPos, *pics->Mask, true);
			}
			else
			{
				BlitCharMultichannel(
					&gGraphicsDevice, picp, drawPos, pics->Colors);
			}
		}
	}
}
Пример #6
0
void	PutParts(void)
{
	PARTTL	*part = in_parts_hd;
	
	XSetForeground(display, gc, back);
	XFillRectangle(display, scratchmap, gc, 0, 0, WINW, WINH);
	if (NULL == part) return;
	while (NULL != part->n) part = part->n;
	while (NULL != part) {
		int	px = 0, py = 0, pw = 0, ph = 0;
		
		CalcView(part, &px, &py, &pw, &ph);
		XSetForeground(display, gc, black);
		switch (part->stat) {
		    case	RAISED:
			XFillRectangle(display, scratchmap, gc,
				       px - RWAKU - RUP, py - RWAKU - RUP,
				       pw + RWAKU * 2, ph + RWAKU * 2);
			DrawShadow(scratchmap, px + 8 - 1 - RWAKU, py + 8 - 1 - RWAKU,
				   pw + RWAKU * 2, ph + RWAKU * 2, 8 + RUP);
			PUTPART(px - RUP, py - RUP);
			break;
		    case 	POINT:
			XFillRectangle(display, scratchmap, gc, px - PWAKU, py - PWAKU,
				       pw + PWAKU * 2, ph + PWAKU * 2);
			DrawShadow(scratchmap, px + 8 - 1 - PWAKU, py + 8 - 1 - PWAKU,
				   pw + PWAKU * 2, ph + PWAKU * 2, 8);
			PUTPART(px, py);
			break;
		    default:
			XDrawRectangle(display, scratchmap, gc, px - 1, py - 1,
				       pw + 2, ph + 2);
			DrawShadow(scratchmap, px + 8 - 1, py + 8 - 1,
				   pw + 2, ph + 2, 8);
			PUTPART(px, py);
			break;
		}
		part = part->p;
	}
	XCopyArea(display, scratchmap, scratch, gc, 0, 0, WINW, WINH, 0, 0);
}
Пример #7
0
/// Zeichnet standardmäßig die Figur, wenn sie läuft aus einem bestimmten normalen LST Archiv
void noFigure::DrawWalking(int x, int y, const char* const file, unsigned int id)
{
    // Wenn wir warten, ani-step 2 benutzen
    unsigned ani_step = waiting_for_free_node ? 2 : GAMECLIENT.Interpolate(ASCENT_ANIMATION_STEPS[ascent], current_ev) % 8;

    // Wenn man wartet, stehend zeichnen, es sei denn man wartet mittem auf dem Weg!
    if(!waiting_for_free_node || pause_walked_gf)
        CalcFigurRelative(x, y);

    LOADER.GetImageN(file, id + ((GetCurMoveDir() + 3) % 6) * 8 + ani_step)->Draw(x, y, 0, 0, 0, 0, 0, 0, COLOR_WHITE, COLORS[gwg->GetPlayer(player).color]);
    DrawShadow(x, y, ani_step, GetCurMoveDir());
}
Пример #8
0
/************************************************************************
 *
 *  Resize 
 *  	Calculate the size of the children and resize.
 *
 ************************************************************************/
static void 
Resize(
        Widget wid )
{
   XmFrameWidget fw = (XmFrameWidget) wid ;

   ClearShadow(fw);

   ConfigureChildren(fw, NULL, NULL);

   DrawShadow(fw);
}
Пример #9
0
void CCharShape::Draw () {
    TCharNode *node;
    float dummy_color[]  = {0.0, 0.0, 0.0, 1.0};

    glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, dummy_color);
    set_gl_options (TUX);
	glEnable (GL_NORMALIZE);
	
	if (!GetNode (0, &node)) return;
	DrawNodes (node);
	glDisable (GL_NORMALIZE);
	if (param.perf_level > 2 && g_game.argument == 0) DrawShadow ();
 	highlighted = false;
} 
Пример #10
0
static void DrawThing(DrawBuffer *b, const TTileItem *t, const Vec2i offset)
{
	const Vec2i picPos = Vec2iNew(
		t->x - b->xTop + offset.x, t->y - b->yTop + offset.y);

	if (!Vec2iIsZero(t->ShadowSize))
	{
		DrawShadow(&gGraphicsDevice, picPos, t->ShadowSize);
	}

	if (t->CPicFunc)
	{
		CPicDrawContext c = t->CPicFunc(t->id);
		CPicDraw(b->g, &t->CPic, picPos, &c);
	}
	else if (t->getPicFunc)
	{
		Vec2i picOffset;
		const Pic *pic = t->getPicFunc(t->id, &picOffset);
		Blit(&gGraphicsDevice, pic, Vec2iAdd(picPos, picOffset));
	}
	else if (t->kind == KIND_CHARACTER)
	{
		TActor *a = CArrayGet(&gActors, t->id);
		ActorPics pics = GetCharacterPicsFromActor(a);
		DrawActorPics(&pics, picPos);
		// Draw weapon indicators
		DrawLaserSight(&pics, a, picPos);
	}
	else
	{
		(*(t->drawFunc))(picPos, &t->drawData);
	}

#ifdef DEBUG_DRAW_HITBOXES
	const int pulsePeriod = ConfigGetInt(&gConfig, "Game.FPS");
	int alphaUnscaled =
		(gMission.time % pulsePeriod) * 255 / (pulsePeriod / 2);
	if (alphaUnscaled > 255)
	{
		alphaUnscaled = 255 * 2 - alphaUnscaled;
	}
	color_t color = colorPurple;
	color.a = (Uint8)alphaUnscaled;
	DrawRectangle(
		&gGraphicsDevice, Vec2iMinus(picPos, Vec2iScaleDiv(t->size, 2)),
		t->size, color, DRAW_FLAG_LINE);
#endif
}
Пример #11
0
/// Malt den Arbeiter beim Arbeiten
void nofFisher::DrawWorking(int x, int y)
{
    unsigned short id = GAMECLIENT.Interpolate(232, current_ev);
    unsigned short draw_id;

    if(id < 16)
    {
        // Angel reinlassen
        if(fishing_dir < 3)
            draw_id = 1566 + 8 * fishing_dir + (id / 2);
        else
            draw_id = 108 + 8 * (fishing_dir - 3) + (id / 2);

        if(id / 2 == 1)
        {
            SOUNDMANAGER.PlayNOSound(62, this, 0);
            was_sounding = true;
        }
    }
    else if(id < 216)
    {
        // Angel im Wasser hängen lassen und warten
        draw_id = 1590 + 8 * ((fishing_dir + 3) % 6) + (id % 8);
    }
    else
    {
        // Angel wieder rausholn
        if(successful)
            // Mit Fisch an der Angel
            draw_id = 1638 + 8 * ((fishing_dir + 3) % 6) + (id - 216) / 2;
        else
        {
            // Ohne Fisch (wie das Reinlassen, bloß umgekehrt)
            if(fishing_dir < 3)
                draw_id = 1566 + 8 * fishing_dir + 7 - +(id - 216) / 2;
            else
                draw_id = 108 + 8 * (fishing_dir - 3) + 7 - (id - 216) / 2;
        }

        if((id - 216) / 2 == 1)
        {
            SOUNDMANAGER.PlayNOSound(62, this, 1);
            was_sounding = true;
        }
    }

    LOADER.GetImageN("rom_bobs", draw_id)->Draw(x, y, 0, 0, 0, 0, 0, 0, COLOR_WHITE, COLORS[gwg->GetPlayer(player)->color]);
    DrawShadow(x, y, 0, fishing_dir);
}
Пример #12
0
void CImage::Draw()
{
    Math::Point     uv1,uv2, corner, pos, dim;
    float       dp;

    if ( (m_state & STATE_VISIBLE) == 0 )  return;

    if ( m_state & STATE_SHADOW )
    {
        DrawShadow(m_pos, m_dim);
    }

    dp = 0.5f/256.0f;

    if ( m_icon == 0 )  // hollow frame?
    {
        m_engine->SetTexture("button2.png");
        m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
        uv1.x = 160.0f / 256.0f;
        uv1.y = 192.0f / 256.0f;  // u-v texture
        uv2.x = 192.0f / 256.0f;
        uv2.y = 224.0f / 256.0f;
        uv1.x += dp;
        uv1.y += dp;
        uv2.x -= dp;
        uv2.y -= dp;
        corner.x = 10.0f / 640.0f;
        corner.y = 10.0f / 480.0f;
        DrawIcon(m_pos, m_dim, uv1, uv2, corner, 8.0f/256.0f);
    }

    if ( m_filename[0] != 0 )  // displays an image?
    {
        m_engine->LoadTexture(m_filename);
        m_engine->SetTexture(m_filename);
        m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
        pos = m_pos;
        dim = m_dim;
        pos.x +=  5.0f / 640.0f;
        pos.y +=  5.0f / 480.0f;
        dim.x -= 10.0f / 640.0f;
        dim.y -= 10.0f / 480.0f;
        uv1.x = 0.0f;
        uv1.y = 0.0f;
        uv2.x = 1.0f;
        uv2.y = 1.0f;
        DrawIcon(pos, dim, uv1, uv2);
    }
}
Пример #13
0
void CCharShape::Draw () {
    static const float dummy_color[] = {0.0, 0.0, 0.0, 1.0};

    glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, dummy_color);
    ScopedRenderMode rm(TUX);
    glEnable (GL_NORMALIZE);

    TCharNode *node = GetNode(0);
    if (node == NULL) return;

    DrawNodes (node);
    glDisable (GL_NORMALIZE);
    if (param.perf_level > 2 && g_game.argument == 0) DrawShadow ();
    highlighted = false;
}
Пример #14
0
void nofHunter::DrawWorking(int x,int y)
{
	switch(state)
	{
	default:
		break;
	case STATE_HUNTER_SHOOTING:
		{
			if(shooting_dir == 3)
			{
				// die Animation in dieser Richtung ist etwas anders als die in den restlichen
				unsigned short id = GAMECLIENT.Interpolate(13,current_ev);
				LOADER.GetImageN("rom_bobs", 219+id)->Draw(x,y,0,0,0,0,0,0, COLOR_WHITE, COLORS[gwg->GetPlayer(player)->color]);

				if(id == 12)
				{
					SoundManager::inst().PlayNOSound(74,this,0);
					was_sounding = true;
				}
			}
			else
			{
				unsigned short id = GAMECLIENT.Interpolate(8,current_ev);
				LOADER.GetImageN("rom_bobs", 1686+((shooting_dir+2)%6)*8+id)->Draw(x,y,0,0,0,0,0,0, COLOR_WHITE, COLORS[gwg->GetPlayer(player)->color]);

				if(id == 7)
				{
					SoundManager::inst().PlayNOSound(74,this,0);
					was_sounding = true;
				}
			}

			DrawShadow(x,y,0,shooting_dir);

		} break;
	case STATE_HUNTER_EVISCERATING:
		{
			unsigned short id = GAMECLIENT.Interpolate(45,current_ev);
			unsigned short draw_id;

			if(id < 4) draw_id = 232+id;
			else if(id < 36) draw_id = 236+(id-4)%8;
			else draw_id = 244+id-36;

			LOADER.GetImageN("rom_bobs", draw_id)->Draw(x,y,0,0,0,0,0,0, COLOR_WHITE, COLORS[gwg->GetPlayer(player)->color]);
		} break;
	}
}
Пример #15
0
void noFigure::DrawWalking(int x, int y, glArchivItem_Bob* file, unsigned int id, bool fat, bool waitingsoldier)
{
    // Wenn wir warten auf ein freies Plätzchen, müssen wir den stehend zeichnen!
    unsigned ani_step = waiting_for_free_node || waitingsoldier ? 2 : GAMECLIENT.Interpolate(ASCENT_ANIMATION_STEPS[ascent], current_ev) % 8;

    // Wenn man wartet, stehend zeichnen, es sei denn man wartet mittem auf dem Weg!
    if(!waitingsoldier && (!waiting_for_free_node || pause_walked_gf))
        CalcFigurRelative(x, y);
    if(file)
        file->Draw(id, GetCurMoveDir(), fat, ani_step, x, y, COLORS[gwg->GetPlayer(player).color]);
    DrawShadow(x, y, ani_step, GetCurMoveDir());

    /*char number[256];
    sprintf(number,"%u",obj_id);
    NormalFont->Draw(x,y,number,0,0xFFFF0000);*/
}
// -----------------------------------------------------------------------------
// CFepUiLayoutRootCtrl::Draw
// Draw the control
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//    
void CFepUiLayoutRootCtrl::Draw()
    {

	if(!AbleToDraw())
        return;
	
    CControlGroup::Draw();

    if(!iShadowRect.IsEmpty())        
        {
        iShadowShown = ETrue;
        DrawShadow();        
        }
    
    UpdateArea(iRect, EFalse);    
    }
Пример #17
0
void CLayerMap::Draw(PCImg32 pDst)
{
	int y;
	PCInfoMapBase pMap;
	PCLayerBase pLayer;

	pMap = m_pMgrData->GetMap ();
	if (pMap == NULL) {
		return;
	}

	if (pMap->m_byLevel != 0) {
		RenewLevel ();
	}

	DrawPartsBase	(pDst);
	DrawMapPile		(pDst);
	DrawItem		(pDst, 0);
	for (y = -1; y < DRAW_PARTS_Y + 2; y ++) {
		DrawMapObject	(pDst, y);
		DrawChar		(pDst, y);
		DrawPartsPile	(pDst, y);
		DrawMapPile		(pDst, y);
	}
	DrawPartsPile	(pDst);
	DrawMapPile		(pDst, -98);
	DrawShadow		(pDst);

	pLayer = NULL;
	switch (pMap->m_dwWeatherType) {
	case WEATHERTYPE_CLOUD:		pLayer = m_pLayerCould;		break;
	case WEATHERTYPE_MISTY:		pLayer = m_pLayerMisty;		break;
	case WEATHERTYPE_SNOW:		pLayer = m_pLayerSnow;		break;
	}
	if (pLayer) {
		pLayer->Draw (pDst);
	}
	if (pMap->m_byLevel != 0) {
		pDst->SetLevel (m_pDibLevel);
	}
	DrawItem (pDst, 1);
	DrawCharText		(pDst);
	DrawGauge			(pDst);
	DrawSystemIcon		(pDst);
	DrawMapName			(pDst);
}
Пример #18
0
static void DrawThing(
	DrawBuffer *b, const Thing *t, const struct vec2i offset)
{
	const struct vec2i picPos = svec2i_add(
		svec2i_subtract(
			svec2i_floor(svec2_add(t->Pos, t->drawShake)),
			svec2i(b->xTop, b->yTop)),
		offset);

	if (!svec2i_is_zero(t->ShadowSize))
	{
		DrawShadow(&gGraphicsDevice, picPos, t->ShadowSize);
	}

	if (t->CPicFunc)
	{
		t->CPicFunc(b->g, t->id, picPos);
	}
	else if (t->kind == KIND_CHARACTER)
	{
		TActor *a = CArrayGet(&gActors, t->id);
		ActorPics pics = GetCharacterPicsFromActor(a);
		DrawActorPics(&pics, picPos, false);
		// Draw weapon indicators
		DrawLaserSight(&pics, a, picPos);
	}
	else
	{
		(*(t->drawFunc))(picPos, &t->drawData);
	}

#ifdef DEBUG_DRAW_HITBOXES
	const int pulsePeriod = ConfigGetInt(&gConfig, "Game.FPS");
	int alphaUnscaled =
		(gMission.time % pulsePeriod) * 255 / (pulsePeriod / 2);
	if (alphaUnscaled > 255)
	{
		alphaUnscaled = 255 * 2 - alphaUnscaled;
	}
	color_t color = colorPurple;
	color.a = (Uint8)alphaUnscaled;
	DrawRectangle(
		&gGraphicsDevice, svec2i_subtract(picPos, svec2i_scale_divide(t->size, 2)),
		t->size, color, DRAW_FLAG_LINE);
#endif
}
Пример #19
0
/*----------------------------------------------------------------------*/
/* extern */ void
XfeComboBoxAddItem(Widget w,XmString item,int position)
{
    XfeComboBoxPart *		cp = _XfeComboBoxPart(w);
/*     XmListPart *			lp = _XfeXmListPart(w); */

	assert( _XfeIsAlive(w) );
	assert( XfeIsComboBox(w) );

	XmListAddItem(cp->list,item,position);


#if 0
    DtComboBoxWidget combo = (DtComboBoxWidget)combo_w;
    DtComboBoxPart *combo_p = (DtComboBoxPart*)&(combo->combo_box);
    XmStringTable list_items = ((XmListWidget)combo_p->list)->list.items;
    int i;

    if (item && ((XmListWidget)combo_p->list)->list.itemCount) {
	for (i = 0; i < combo_p->item_count; i++)
	    if (XmStringCompare(item, list_items[i]))
		break;
	if ((i < combo_p->item_count) && unique)
	    return;
    }

    XmListAddItem(combo_p->list, item, pos);
    SyncWithList(combo_p);

    if (combo_p->label) {
	SetMaximumLabelSize(combo_p);
	if (combo_p->type == XmDROP_DOWN_LIST_BOX) {
	    ClearShadow(combo, TRUE);
	    if (combo_p->recompute_size)
		SetComboBoxSize(combo);
	    LayoutChildren(combo);
	    DrawShadow(combo);
	}
    }
    if (combo_p->type == XmDROP_DOWN_COMBO_BOX)
	SetTextFieldData(combo_p, NULL);
    else
	SetLabelData(combo_p, NULL, FALSE);
#endif

}
Пример #20
0
    ///////////////////////////////////////////////////////////////////////////////
    // The fillRect(x, y, w, h) method must paint the specified rectangular area
    //  using the fillStyle. If either height or width are zero, this method
    //  has no effect.
    void GdiContext2D::fillRect(double x, double y, double w, double h)
    {
        Check();
        //TODO waiting for transformations..
        RECT rect = {(LONG)x, (LONG)y, (LONG)(x + w), (LONG)(y + h)};

        if (shadowOffsetX != 0 &&
                shadowOffsetY != 0)
        {
            DrawShadow(m_hDC, rect, (int)shadowOffsetX);
        }

        if (fillStyle.fillStyleEnum == FillStyleEnumSolid)
        {
            COLORREF color = ColorToColorRef(fillStyle.m_Color);
            FillSolidRect(m_hDC, &rect, color);
        }
        else if (fillStyle.fillStyleEnum == FillStyleEnumGradient)
        {
            UINT mode = fillStyle.canvasGradient.pCanvasGradientImp->isVertical() ?
                        GRADIENT_FILL_RECT_V :
                        GRADIENT_FILL_RECT_H;
            COLORREF color1 = fillStyle.canvasGradient.pCanvasGradientImp->color1;
            COLORREF color2 = fillStyle.canvasGradient.pCanvasGradientImp->color2;

            if (mode == GRADIENT_FILL_RECT_V &&
                    fillStyle.canvasGradient.pCanvasGradientImp->y0 >
                    fillStyle.canvasGradient.pCanvasGradientImp->y1)
            {
                std::swap(color1, color2);
            }

            if (mode == GRADIENT_FILL_RECT_H &&
                    fillStyle.canvasGradient.pCanvasGradientImp->x0 >
                    fillStyle.canvasGradient.pCanvasGradientImp->x1)
            {
                std::swap(color1, color2);
            }

            FillGradientRect(m_hDC, rect, color1, color2, mode);
        }
    }
Пример #21
0
void DrawActorPics(const ActorPics *pics, const Vec2i pos)
{
	if (pics->IsDead)
	{
		if (pics->IsDying)
		{
			DrawDyingBody(&gGraphicsDevice, pics, pos);
		}
	}
	else
	{
		// Draw shadow
		if (!pics->IsTransparent)
		{
			DrawShadow(&gGraphicsDevice, pos, Vec2iNew(8, 6));
		}
		for (int i = 0; i < BODY_PART_COUNT; i++)
		{
			const Pic *pic = pics->OrderedPics[i];
			if (pic == NULL)
			{
				continue;
			}
			const Vec2i drawPos = Vec2iAdd(pos, pics->OrderedOffsets[i]);
			if (pics->IsTransparent)
			{
				BlitBackground(
					&gGraphicsDevice, pic, drawPos, pics->Tint, true);
			}
			else if (pics->Mask != NULL)
			{
				BlitMasked(&gGraphicsDevice, pic, drawPos, *pics->Mask, true);
			}
			else
			{
				BlitCharMultichannel(
					&gGraphicsDevice, pic, drawPos, pics->Colors);
			}
		}
	}
}
Пример #22
0
void CCharShape::Draw () {
	static const float dummy_color[] = {0.0, 0.0, 0.0, 1.0};

	glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, dummy_color);
	ScopedRenderMode rm(TUX);
	glEnable (GL_NORMALIZE);

	TCharNode *node = GetNode(0);
	if (node == NULL) return;

	glEnableClientState(GL_NORMAL_ARRAY);
	glNormalPointer(GL_FLOAT, 0,charvertices);
	glEnableClientState(GL_VERTEX_ARRAY);
	glVertexPointer(3, GL_FLOAT, 0,charvertices);
	DrawNodes (node);
	glDisableClientState(GL_VERTEX_ARRAY);
	glDisableClientState(GL_NORMAL_ARRAY);
	glDisable (GL_NORMALIZE);
	if (param.perf_level > 2 && g_game.argument == 0) DrawShadow ();
	highlighted = false;
}
Пример #23
0
void CEditValue::Draw()
{
    if ( (m_state & STATE_VISIBLE) == 0 )  return;

    if ( m_state & STATE_SHADOW )
    {
        DrawShadow(m_pos, m_dim);
    }

    if ( m_edit != 0 )
    {
        m_edit->Draw();
    }
    if ( m_buttonUp != 0 )
    {
        m_buttonUp->Draw();
    }
    if ( m_buttonDown != 0 )
    {
        m_buttonDown->Draw();
    }
}
Пример #24
0
void NLight::Draw(NCamera* View)
{
    //If the light isn't on the current level of the map, don't draw it! This is required because 2d lighting!
    if (GetGame()->GetMap()->GetLevel() != GetGame()->GetMap()->GetLevel(GetRealPos()))
    {
        return;
    }
    //Clear out the stencil buffer with 0's so we have a clean slate to work with.
    glClear(GL_STENCIL_BUFFER_BIT);
    glEnable(GL_STENCIL_TEST);
    //Make it so whatever we draw replaces everything it touches in the stencil to 1.
    glStencilFunc(GL_ALWAYS,0x1,0x1);
    glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
    //Draw all our shadow volumes.
    DrawShadow(View);
    //Now we make it so we can only draw on 0's, we also don't want to replace anything in the stencil buffer so we lock it up.
    glStencilFunc(GL_EQUAL,0x0,0x1);
    glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
    //Finally draw the light into whatever's not shadow.
    DrawLight(View);
    glDisable(GL_STENCIL_TEST);
}
Пример #25
0
void         Draw(GLContext	*_context)
{
	UserData      *_user = (UserData *)_context->userObject;
	Size  _size = _context->getWinSize();
#ifdef  _SHADOW_MAP_
    _user->shadowMap->bindFramebuffer();
//	glViewport(0, 0, _size.width, _size.height);
#endif
	glClear(GL_DEPTH_BUFFER_BIT);//very important
	glEnable(GL_POLYGON_OFFSET_FILL);
	glPolygonOffset(2.0f,4.0f);
	DrawShadow(_context);
	glDisable(GL_POLYGON_OFFSET_FILL);
//
#ifdef  _SHADOW_MAP_
	glBindFramebuffer(GL_DRAW_FRAMEBUFFER,0);
//	glViewport(0, 0, _size.width, _size.height);
	glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

	DrawScene(_context);
#endif
}
Пример #26
0
static void DrawThing(DrawBuffer *b, const TTileItem *t, const Vec2i offset)
{
    const Vec2i picPos = Vec2iNew(
                             t->x - b->xTop + offset.x, t->y - b->yTop + offset.y);
#ifdef DEBUG_DRAW_BOUNDS
    Draw_Box(
        picPos.x - t->size.x / 2, picPos.y - t->size.y / 2,
        picPos.x + t->size.x / 2, picPos.y + t->size.y / 2,
        colorGray);
#endif

    if (!Vec2iIsZero(t->ShadowSize))
    {
        DrawShadow(&gGraphicsDevice, picPos, t->ShadowSize);
    }

    if (t->CPicFunc)
    {
        CPicDrawContext c = t->CPicFunc(t->id);
        CPicDraw(b->g, &t->CPic, picPos, &c);
    }
    else if (t->getPicFunc)
    {
        Vec2i picOffset;
        const Pic *pic = t->getPicFunc(t->id, &picOffset);
        Blit(&gGraphicsDevice, pic, Vec2iAdd(picPos, picOffset));
    }
    else if (t->getActorPicsFunc)
    {
        DrawActorPics(t, picPos);
    }
    else
    {
        (*(t->drawFunc))(picPos, &t->drawData);
    }
}
Пример #27
0
/************************************************************************
 *
 *  Redisplay
 *     General redisplay function called on exposure events.
 *
 ************************************************************************/
static void 
Redisplay(
        Widget wid,
        XEvent *event,
        Region region )
{
   XmFrameWidget fw = (XmFrameWidget) wid;
   Widget title_area = fw->frame.title_area;

   DrawShadow(fw);

   /* since the shadow may have screw up the gadget title, while this
      one won't get refresh, we have to redraw it manually */

   if (title_area && XmIsGadget(title_area) && XtIsManaged(title_area))
   {
      XClearArea (XtDisplay(fw), XtWindow(fw),
		  title_area->core.x, title_area->core.y,
		  title_area->core.width, title_area->core.height,
		  False);
      if (region && !XRectInRegion (region, title_area->core.x,
	title_area->core.y, title_area->core.width, title_area->core.height))
      {
	 XtExposeProc expose;

	 _XmProcessLock();
	 expose = title_area->core.widget_class->core_class.expose;
	 _XmProcessUnlock();

         if (expose)
	    (*expose)(title_area, event, NULL);
      }
   }

   XmeRedisplayGadgets( (Widget) fw, event, region);
}
Пример #28
0
void CUnitDrawProxy::Draw(const CViewport *vp) const
{
	int x = this->IX + vp->Map2ViewportX(this->X);
	int y = this->IY + vp->Map2ViewportY(this->Y);

	/* FIXME: check if we have to push real type here?*/
	if (state == 1 && cframe) {
		DrawConstructionShadow(*Type, cframe, frame, x, y);
	} else {
		if (IsAlive) {
			DrawShadow(*Type, frame, x, y);
		}
	}

	//
	// Show that the unit is selected
	//
	DrawSelectionAt(x, y);

	//
	// Adjust sprite for Harvesters.
	//
	CPlayerColorGraphic *sprite = Type->Sprite;
	if (Type->Harvester && this->CurrentResource) {
		ResourceInfo *resinfo = Type->ResInfo[this->CurrentResource];
		if (this->ResourcesHeld) {
			if (resinfo->SpriteWhenLoaded) {
				sprite = resinfo->SpriteWhenLoaded;
			}
		} else {
			if (resinfo->SpriteWhenEmpty) {
				sprite = resinfo->SpriteWhenEmpty;
			}
		}
	}

	//
	// Now draw!
	// Buildings under construction/upgrade/ready.
	//
	if (state == 1) {
		if (cframe) {
			DrawConstruction(Player->Index, cframe, *Type, frame,
				x + (Type->TileWidth * TileSizeX) / 2,
				y + (Type->TileHeight * TileSizeY) / 2);
		}
	//
	// Draw the future unit type, if upgrading to it.
	//
	} else if (state == 2) {
		// FIXME: this frame is hardcoded!!!
		DrawUnitType(*Type, sprite, Player->Index, frame < 0 ? /*-1*/ - 1 : 1, x, y);
	} else {
		DrawUnitType(*Type, sprite, Player->Index, frame, x, y);
	}

	// Unit's extras not fully supported.. need to be decorations themselves.
	// FIXME: johns: ugly check here, should be removed!
	if (IsAlive /*unit->IsVisible(ThisPlayer)*/) {
		DrawDecorationAt(x, y);
	}

	//DrawInformations(this, type, x, y);
}
Пример #29
0
/**
**  Draw unit on map.
*/
void CUnit::Draw(const CViewport *vp) const
{
	int x;
	int y;
	int frame;
	int state;
	int constructed;
	CPlayerColorGraphic *sprite;
	ResourceInfo *resinfo;
	CConstructionFrame *cframe;
	CUnitType *type;

	/*
	 * Since we can draw in parallel to game logic units may be already destroyed
	 * or removed (this->Container != NULL) most dangerus is destroyed state
	 * but due existence of UnitCashe, unit memory is always valid only we need check
	 * Destroyed flag... the hack is that  this->Type == NULL but 'or' logic
	 * should secure this scenario and retir before this->Type->Revealer check
	 */
	if (this->Destroyed || this->Container || this->Type->Revealer) { // Revealers are not drawn
		return;
	}

	bool IsVisible = this->IsVisible(ThisPlayer);

	// Those should have been filtered. Check doesn't make sense with ReplayRevealMap
	Assert(ReplayRevealMap || this->Type->VisibleUnderFog || IsVisible);

	int player = this->RescuedFrom ? this->RescuedFrom->Index : this->Player->Index;
	int action = this->CurrentAction();
	if (ReplayRevealMap || IsVisible) {
		type = this->Type;
		frame = this->Frame;
		y = this->IY;
		x = this->IX;
		x += vp->Map2ViewportX(this->tilePos.x);
		y += vp->Map2ViewportY(this->tilePos.y);
		state = (action == UnitActionBuilt) |
				((action == UnitActionUpgradeTo) << 1);
		constructed = this->Constructed;
		// Reset Type to the type being upgraded to
		if (state == 2) {
			type = this->CurrentOrder()->Arg1.Type;
		}
		// This is trash unless the unit is being built, and that's when we use it.
		cframe = this->Data.Built.Frame;
	} else {
		y = this->Seen.IY;
		x = this->Seen.IX;
		x += vp->Map2ViewportX(this->Seen.X);
		y += vp->Map2ViewportY(this->Seen.Y);
		frame = this->Seen.Frame;
		type = this->Seen.Type;
		constructed = this->Seen.Constructed;
		state = this->Seen.State;
		cframe = this->Seen.CFrame;
	}

#ifdef DYNAMIC_LOAD
	if (!type->Sprite) {
		LoadUnitTypeSprite(*type);
	}
#endif

	if (!IsVisible && frame == UnitNotSeen) {
		DebugPrint("FIXME: Something is wrong, unit %d not seen but drawn time %lu?.\n" _C_
			this->Slot _C_ GameCycle);
		return;
	}


	if (state == 1 && constructed) {
		DrawConstructionShadow(*type, cframe, frame, x, y);
	} else {
		if (action != UnitActionDie) {
			DrawShadow(*type, frame, x, y);
		}
	}

	//
	// Show that the unit is selected
	//
	DrawUnitSelection(vp, *this);

	//
	// Adjust sprite for Harvesters.
	//
	sprite = type->Sprite;
	if (type->Harvester && this->CurrentResource) {
		resinfo = type->ResInfo[this->CurrentResource];
		if (this->ResourcesHeld) {
			if (resinfo->SpriteWhenLoaded) {
				sprite = resinfo->SpriteWhenLoaded;
			}
		} else {
			if (resinfo->SpriteWhenEmpty) {
				sprite = resinfo->SpriteWhenEmpty;
			}
		}
	}

	//
	// Now draw!
	// Buildings under construction/upgrade/ready.
	//
	if (state == 1) {
		if (constructed) {
			DrawConstruction(player, cframe, *type, frame,
				x + (type->TileWidth * TileSizeX) / 2,
				y + (type->TileHeight * TileSizeY) / 2);
		}
	//
	// Draw the future unit type, if upgrading to it.
	//
	} else if (state == 2) {
		// FIXME: this frame is hardcoded!!!
		DrawUnitType(*type, sprite, player, frame < 0 ? /*-1*/ - 1 : 1, x, y);
	} else {
		DrawUnitType(*type, sprite, player, frame, x, y);
	}

	// Unit's extras not fully supported.. need to be decorations themselves.
	DrawInformations(*this, type, x, y);
}
Пример #30
0
/**
**	Draw unit on map.
**
**	@param unit	Pointer to the unit.
*/
local void DrawUnit(Unit* unit)
{
    int x;
    int y;
    int r;
    UnitType* type;
    UnitStats* stats;

    type=unit->Type;

    x=Map2ScreenX(unit->X)+unit->IX;
    y=Map2ScreenY(unit->Y)+unit->IY;

    if( type->UnitType==UnitTypeFly ) {
	DrawShadow(unit,type,x,y);
    }

    DrawSelectionRectangle(unit,type,x,y);

    PlayerPixels(unit->Player);
    DrawUnitType(type,unit->Frame,x,y);

    stats=unit->Stats;

    //
    //	For debug draw sight, react and attack range!
    //
    if( NumSelected==1 && unit->Selected ) {
	if( ShowSightRange ) {
	    DrawRectangle(ColorGreen
		,x+TileSizeX/2-stats->SightRange*TileSizeX
		,y+TileSizeY/2-stats->SightRange*TileSizeY
		,stats->SightRange*TileSizeX*2
		,stats->SightRange*TileSizeY*2);
	}
	if( type->CanAttack ) {
	    if( ShowReactRange ) {
		r= (unit->Player->Type==PlayerHuman)
			? type->ReactRangeHuman
			: type->ReactRangeComputer;
		if( r ) {
		    DrawRectangle(ColorBlue
			,x+TileSizeX/2-r*TileSizeX
			,y+TileSizeY/2-r*TileSizeY
			,r*TileSizeX*2
			,r*TileSizeY*2);
		}
	    }
	    if( ShowAttackRange && stats->AttackRange ) {
		DrawRectangle(ColorRed
		    ,x+TileSizeX/2-stats->AttackRange*TileSizeX
		    ,y+TileSizeY/2-stats->AttackRange*TileSizeY
		    ,stats->AttackRange*TileSizeX*2
		    ,stats->AttackRange*TileSizeY*2);
	    }
	}
    }

    //
    //	For debug draw destination. FIXME: should become orders
    //
    if( ShowOrders && unit->Selected && (KeyModifiers&ModifierShift)) {
	DrawPath(unit);
    }

    // FIXME: johns: ugly check here should be removed!
    if( unit->Command.Action!=UnitActionDie ) {
	DrawDecoration(unit,type,x,y);
    }
}