Exemplo n.º 1
0
void DrawPlayScreen (void)
{
	int	i,j,p,m;
	unsigned	temp;

	VW_FadeOut ();

	temp = bufferofs;

	CA_CacheGrChunk (STATUSBARPIC);

	for (i=0;i<3;i++)
	{
		bufferofs = screenloc[i];
		DrawPlayBorder ();
		VWB_DrawPic (0,200-STATUSLINES,STATUSBARPIC);
	}

	bufferofs = temp;

	UNCACHEGRCHUNK (STATUSBARPIC);

	DrawFace ();
	DrawHealth ();
	DrawLives ();
	DrawLevel ();
	DrawAmmo ();
	DrawKeys ();
	DrawWeapon ();
	DrawScore ();
}
Exemplo n.º 2
0
void Window_SaveFile::Refresh() {
	contents->Clear();

	std::ostringstream out;
	out << Data::terms.file << std::setw(2) << std::setfill(' ') << index + 1;
	contents->TextDraw(4, 2, Font::ColorDefault, out.str());

	if (corrupted) {
		contents->TextDraw(4, 16 + 2, Font::ColorKnockout, "Savegame corrupted");
		return;
	}

	if (party.empty())
		return;

	contents->TextDraw(8, 16 + 2, Font::ColorDefault, hero_name);

	contents->TextDraw(8, 32 + 2, 1, Data::terms.lvl_short);

	int lx = Font::Default()->GetSize(Data::terms.lvl_short).width;
	out.str("");
	out << std::setw(2) << std::setfill(' ') << hero_level;
	contents->TextDraw(8 + lx, 32 + 2, Font::ColorDefault, out.str());

	contents->TextDraw(42, 32 + 2, 1, Data::terms.hp_short);

	int hx = Font::Default()->GetSize(Data::terms.hp_short).width;
	out.str("");
	out << hero_hp;
	contents->TextDraw(42 + hx, 32 + 2, Font::ColorDefault, out.str());

	for (int i = 0; i < 4 && (size_t) i < party.size(); i++) {
		DrawFace(party[i].second, party[i].first, 88 + i * 56, 0);
	}
}
Exemplo n.º 3
0
//DRAWING FUNCTIONS
//Draw all faces marked as visible
void BSP::Draw()
{
	glFrontFace(GL_CW);

	//enable vertex arrays
	glEnableClientState(GL_VERTEX_ARRAY);
	glEnableClientState(GL_TEXTURE_COORD_ARRAY);

	glClientActiveTextureARB(GL_TEXTURE1_ARB);
	glEnableClientState(GL_TEXTURE_COORD_ARRAY);
	glClientActiveTextureARB(GL_TEXTURE0_ARB);

	//loop through faces
	for(int i=0; i<numTotalFaces; ++i)
	{
		//if this face is to be drawn, draw it
		if(facesToDraw.IsSet(i))
			DrawFace(i);
	}
	
	//disable vertex arrays
	glClientActiveTextureARB(GL_TEXTURE1_ARB);
	glDisableClientState(GL_TEXTURE_COORD_ARRAY);
	glClientActiveTextureARB(GL_TEXTURE0_ARB);

	glDisableClientState(GL_TEXTURE_COORD_ARRAY);
	glDisableClientState(GL_VERTEX_ARRAY);

	glFrontFace(GL_CCW);
}
Exemplo n.º 4
0
/*
============
idAASLocal::DrawArea
============
*/
void idAASLocal::DrawArea( int areaNum ) const
{
	int i, numFaces, firstFace;
	const aasArea_t* area;
	idReachability* reach;
	
	if( !file )
	{
		return;
	}
	
	area = &file->GetArea( areaNum );
	numFaces = area->numFaces;
	firstFace = area->firstFace;
	
	for( i = 0; i < numFaces; i++ )
	{
		DrawFace( abs( file->GetFaceIndex( firstFace + i ) ), file->GetFaceIndex( firstFace + i ) < 0 );
	}
	
	for( reach = area->reach; reach; reach = reach->next )
	{
		DrawReachability( reach );
	}
}
Exemplo n.º 5
0
void CFace::GetTriangles(void(*callbackfunc)(const double* x, const double* n), double cusp, bool just_one_average_normal){
	if(GetParentBody()) {
		// using existing BRepMesh::Mesh
	}
	else {
		MeshFace(m_topods_face,1/cusp);
	}

	DrawFace(m_topods_face,callbackfunc,just_one_average_normal);
}
void Window_Message::InsertNewPage() {
	// Cancel pending face requests for async
	// Otherwise they render on the wrong page
	face_request_ids.clear();

	contents->Clear();

	y = Game_Message::GetRealPosition() * 80;

	if (Game_Message::IsTransparent()) {
		SetOpacity(0);
	} else {
		SetOpacity(255);
	}

	if (!Game_Message::GetFaceName().empty()) {
		if (!Game_Message::IsFaceRightPosition()) {
			contents_x = LeftMargin + FaceSize + RightFaceMargin;
			DrawFace(Game_Message::GetFaceName(), Game_Message::GetFaceIndex(), LeftMargin, TopMargin, Game_Message::IsFaceFlipped());
		} else {
			contents_x = 0;
			DrawFace(Game_Message::GetFaceName(), Game_Message::GetFaceIndex(), 248, TopMargin, Game_Message::IsFaceFlipped());
		}
	} else {
		contents_x = 0;
	}

	if (Game_Message::choice_start == 0 && Game_Message::choice_max > 0) {
		contents_x += 12;
	}

	contents_y = 2;
	line_count = 0;
	text_color = Font::ColorDefault;
	speed_modifier = 0;

	if (Game_Message::num_input_start == 0 && Game_Message::num_input_variable_id > 0) {
		// If there is an input window on the first line
		StartNumberInputProcessing();
	}
}
Exemplo n.º 7
0
void UpdateFace()
{
	if (SD_SoundPlaying() == GETGATLINGSND)
		return;

	facecount += tics;
	if (facecount > US_RndT())
	{
		gamestate.faceframe = (US_RndT()>>6);
		if (gamestate.faceframe==3)
			gamestate.faceframe = 1;

		facecount = 0;
		DrawFace();
	}
Exemplo n.º 8
0
void CFace::GetBox(CBox &box){
//	if(!m_box.m_valid)
	{
		// there must be a better way than re-using the render code
		// Get triangulation
		if(GetParentBody() == NULL){
			MeshFace(m_topods_face,.01);
		}

		FaceForBoxCallback = this;
		DrawFace(m_topods_face,box_callback,false);
	}

	box.Insert(m_box);
}
Exemplo n.º 9
0
int main(int argc, char** argv){
  int fbfd, status, offset;
  unsigned short pixel;
  fbfd = open(FBDEVICE, O_RDWR);
  if(fbfd<0){
	perror("error");
	return -1;
  }

  DrawFace(fbfd, 0,0,0,0, makepixel(255,255,0));

  close(fbfd);

  return 0;
}
Exemplo n.º 10
0
void CSceneNodeAABB::Render() const{
	if(!GetSingleton<CProgram>()->IsInWireFrameMode())
	{
		//glPushAttrib(GL_ALL_ATTRIB_BITS);
		////glBegin();
		//glEnable(GL_MAP2_VERTEX_3);
		//vector3 r[4] = { 
		//	m_aabb.first , 
		//	vector3(m_aabb.first.x,m_aabb.second.y,m_aabb.first.z) ,
		//	vector3(m_aabb.second.x,m_aabb.first.y,m_aabb.first.z) , 
		//	vector3(m_aabb.second.x,m_aabb.second.y,m_aabb.first.z)
		//};
		//glMap2f( GL_MAP2_VERTEX_3,0.0f,1.0f,6,2,0.0f,1.0f,3,2,(GLfloat*)r);
		//glMapGrid2f(10,0,1,20,0,1);
		//glEvalMesh2(GL_FILL,0,10,0,20);
		////glEnd();
		//glPopAttrib();
		vector3 dim(GetDim(m_aabb));
		vector3 dx(dim.x,0,0);
		vector3 dy(0,dim.y,0);
		vector3 dz(0,0,dim.z);
		unsigned int nx(dim.x*0.02+1);
		unsigned int ny(dim.y*0.02+1);
		unsigned int nz(dim.z*0.02+1);
		DrawFace(m_aabb.first,dy,dx,ny,nx);
		DrawFace(m_aabb.first,dx,dz,nx,nz);
		DrawFace(m_aabb.first,dz,dy,nz,ny);
		DrawFace(m_aabb.second,-dx,-dy,nx,ny);
		DrawFace(m_aabb.second,-dy,-dz,ny,nz);
		DrawFace(m_aabb.second,-dz,-dx,nz,nx);
		return;
	}
	glPushAttrib(GL_TEXTURE_BIT);
	glPushMatrix();
	vector3 center(GetCenter(m_aabb)),dim(GetDim(m_aabb));
	glTranslatef(center.x,center.y,center.z);
	{
		GLenum coord[2]={GL_S,GL_T};
		for(int iCoord(0); iCoord<2; ++iCoord)
		{
			float f[4];
			glGetTexGenfv(coord[iCoord],GL_OBJECT_PLANE,f);
			f[0]*=dim.x*0.001f;
			f[1]*=dim.y*0.001f;
			f[2]*=dim.z*0.001f;
			//f[2]*=1000;
			glTexGenfv(coord[iCoord],GL_OBJECT_PLANE,f);
		}
	}
	glScalef(dim.x,dim.y,dim.z);
	glutSolidCube(1.0);
	glPopMatrix();
	glPopAttrib();
}
Exemplo n.º 11
0
// детектирование лиц
bool DetectFace(TVAInitParams& params, CvCapture* capture, bool save = false)
{
	TVAFace* faces = new TVAFace[cNumObjects];
	char buf[256];
	params.SaveLog = false;
	params.Path = "D:\\_alt\\database\\log\\";
	HANDLE face = faceCreate(&params, 1, 256, 1.1, true, cNumObjects);
	if (!face)
	{
		printf("%s\n", "Cannot open detect engine.");
		return false;
	}
	for (;;)
	{
		IplImage* frame = NULL;
		frame = cvQueryFrame(capture);
		if (!frame)
			break;
		int num = 0;
		DWORD t = GetTickCount();
		faceProcess(face, frame->width, frame->height, frame->nChannels, (unsigned char*)frame->imageData, faces, &num);
		t = GetTickCount() - t;
		if (num > 0)
		{
			for (int i = 0; i < num; i++)
			{
				DrawFace(frame, faces[i]);
			}
		}
		CvScalar color = CV_RGB(255, 0, 0);
		char buf[32];
		sprintf(buf, "proc time = %d", t);
		cvPutText(frame, buf, cvPoint(10, 10), &g_font, color);
		cvShowImage(_MODULE_, frame);

		int c;
		c = cvWaitKey(10);
		if ((char)c == 27)
			break;
	}
	faceRelease(&face);
	free(faces);
	return true;
}
Exemplo n.º 12
0
/* ------------------------------------------------------------------------------------ */
void DrawBoundBox(geWorld *World, const geVec3d *Pos, const geVec3d *Min, const geVec3d *Max)
{
	geFloat	dx;
	geFloat	dy;
	geFloat	dz;
	static	geVec3d		Verts[8];
	static	geVec3d *	Faces[6][4] =
	{
		{&Verts[0], &Verts[1], &Verts[2], &Verts[3]},	//Top
		{&Verts[4], &Verts[5], &Verts[6], &Verts[7]},	//Bottom
		{&Verts[3], &Verts[2], &Verts[6], &Verts[7]},	//Side
		{&Verts[1], &Verts[0], &Verts[4], &Verts[5]},	//Side
		{&Verts[0], &Verts[3], &Verts[7], &Verts[4]},	//Front
		{&Verts[2], &Verts[1], &Verts[5], &Verts[6]},	//Back
	};

	int	i;

	for(i=0; i<8; i++)
		geVec3d_Add(Pos, Min, &Verts[i]);

	dx = Max->X - Min->X;
	dy = Max->Y - Min->Y;
	dz = Max->Z - Min->Z;

	Verts[0].Y += dy;
	Verts[3].Y += dy;
	Verts[3].X += dx;
	Verts[7].X += dx;

	Verts[1].Y += dy;
	Verts[1].Z += dz;
	Verts[5].Z += dz;
	Verts[6].Z += dz;
	Verts[6].X += dx;

	Verts[2].X += dx;
	Verts[2].Y += dy;
	Verts[2].Z += dz;

	for(i=0; i<6; i++)
		DrawFace(World, &Faces[i][0]);
}
Exemplo n.º 13
0
	Dvoid RenderModule::Render( )
	{			
		if( m_pMesh == nullptr )
			return;

		vector<BaseFace>* pvecFace = m_pMesh->GetVectorFace();
		for( Dint faceNum = 0; faceNum < (Dint)pvecFace->size(); ++faceNum )
		{			
			BaseFace currentFace = (*pvecFace)[ faceNum ];
						
			//projection frustum culling
			if( cc_use_frustumcull.Bool() && FrustumCulling(currentFace) )
			{
				continue;
			}			

			m_vecLine.clear();
			m_edgeTable.clear();
			m_activeTable.clear();

			CreatePointsToLines(pvecFace, faceNum, m_vecLine);

			//backspace culling
			if( cc_use_backspacecull.Bool() && !BackSpaceCulling(m_vecLine) )
			{
				continue;
			}

			auto unusualValue = STD_FIND_IF(m_vecLine, [] (const Line& line)
			{	//모든 요소의 y 값이 같은지 체크
				return line.beginVertex.y != line.endVertex.y;
			});

			if( unusualValue != end(m_vecLine) )
			{
				CreateEdgeTable(m_vecLine, m_edgeTable);
				CreateChainTable(m_vecLine, m_activeTable);
				DrawFace(m_activeTable, m_edgeTable, MixDotColor( currentFace.color ));
			}
		}	
		
	}
Exemplo n.º 14
0
Arquivo: main.c Projeto: iamfil/wine
void DrawBoard( HDC hdc, HDC hMemDC, PAINTSTRUCT *ps, BOARD *p_board )
{
    RECT tmp_rect;

    if( IntersectRect( &tmp_rect, &ps->rcPaint, &p_board->counter_rect ) )
        DrawLeds( hdc, hMemDC, p_board, p_board->mines - p_board->num_flags,
                  p_board->counter_rect.left,
                  p_board->counter_rect.top );

    if( IntersectRect( &tmp_rect, &ps->rcPaint, &p_board->timer_rect ) )
        DrawLeds( hdc, hMemDC, p_board, p_board->time,
                  p_board->timer_rect.left,
                  p_board->timer_rect.top );

    if( IntersectRect( &tmp_rect, &ps->rcPaint, &p_board->face_rect ) )
        DrawFace( hdc, hMemDC, p_board );

    if( IntersectRect( &tmp_rect, &ps->rcPaint, &p_board->mines_rect ) )
        DrawMines( hdc, hMemDC, p_board );
}
Exemplo n.º 15
0
void CSmiley::Draw(const TRect& aRect) const
	{
	CWindowGc& gc = SystemGc();
	if (IsFocused())
		{
		gc.SetPenColor(KRgbBlack);
		}
	else
		{
		gc.SetPenColor(KRgbWhite);
		}
	gc.SetBrushColor(KRgbWhite);
	gc.Clear(Rect());
	gc.DrawRect(Rect());

	gc.SetClippingRect(aRect);

	DrawFace(gc);
	DrawEyes(gc);
	DrawEyebrow(gc, IsSmiling());
	DrawMouth(gc, IsSmiling());
	}
Exemplo n.º 16
0
void CRulerBar::DoPaint(CDC* pDC)
{
    CControlBar::DoPaint(pDC); // CControlBar::DoPaint -- draws border
    if (m_unit.m_nTPU != 0)
    {
        pDC->SaveDC();
        // offset coordinate system
        CPoint pointOffset(0,0);
        RulerToClient(pointOffset);
        pDC->SetViewportOrg(pointOffset);

        DrawFace(*pDC);
        DrawTickMarks(*pDC);

        DrawTabs(*pDC);
        m_leftmargin.Draw(*pDC);
        m_indent.Draw(*pDC);
        m_rightmargin.Draw(*pDC);

        pDC->RestoreDC(-1);
    }
    // Do not call CControlBar::OnPaint() for painting messages
}
void UpdateFace (void)
{
    // don't make demo depend on sound playback
    if(demoplayback || demorecord)
    {
        if(facetimes > 0)
        {
            facetimes--;
            return;
        }
    }
    else if(SD_SoundPlaying() == GETGATLINGSND)
        return;

    facecount += tics;
    if (facecount > US_RndT())
    {
        gamestate.faceframe = (US_RndT()>>6);
        if (gamestate.faceframe==3)
            gamestate.faceframe = 1;

        facecount = 0;
        DrawFace ();
    }
Exemplo n.º 18
0
bool wxBitmapButton::MSWOnDraw(WXDRAWITEMSTRUCT *item)
{
#ifndef __WXWINCE__
    long style = GetWindowLong((HWND) GetHWND(), GWL_STYLE);
    if (style & BS_BITMAP)
    {
        // Let default procedure draw the bitmap, which is defined
        // in the Windows resource.
        return false;
    }
#endif

    LPDRAWITEMSTRUCT lpDIS = (LPDRAWITEMSTRUCT) item;
    HDC hDC                = lpDIS->hDC;
    UINT state             = lpDIS->itemState;
    bool isSelected        = (state & ODS_SELECTED) != 0;
    bool autoDraw          = (GetWindowStyleFlag() & wxBU_AUTODRAW) != 0;


    // choose the bitmap to use depending on the button state
    wxBitmap *bitmap;

    if ( isSelected && m_bmpSelected.Ok() )
        bitmap = &m_bmpSelected;
    else if ( m_bmpHover.Ok() && IsMouseInWindow() )
        bitmap = &m_bmpHover;
    else if ((state & ODS_FOCUS) && m_bmpFocus.Ok())
        bitmap = &m_bmpFocus;
    else if ((state & ODS_DISABLED) && m_bmpDisabled.Ok())
        bitmap = &m_bmpDisabled;
    else
        bitmap = &m_bmpNormal;

    if ( !bitmap->Ok() )
        return false;

    // centre the bitmap in the control area
    int x      = lpDIS->rcItem.left;
    int y      = lpDIS->rcItem.top;
    int width  = lpDIS->rcItem.right - x;
    int height = lpDIS->rcItem.bottom - y;
    int wBmp   = bitmap->GetWidth();
    int hBmp   = bitmap->GetHeight();

#if wxUSE_UXTHEME
    if ( autoDraw && wxUxThemeEngine::GetIfActive() )
    {
        MSWDrawXPBackground(this, item);
        wxUxThemeHandle theme(this, L"BUTTON");

        // calculate content area margins
        // assuming here that each state is the same size
        MARGINS margins;
        wxUxThemeEngine::Get()->GetThemeMargins(theme, NULL,
                                                BP_PUSHBUTTON, PBS_NORMAL,
                                                TMT_CONTENTMARGINS, NULL,
                                                &margins);
        int marginX = margins.cxLeftWidth + 1;
        int marginY = margins.cyTopHeight + 1;
        int x1,y1;

        if ( m_windowStyle & wxBU_LEFT )
        {
            x1 = x + marginX;
        }
        else if ( m_windowStyle & wxBU_RIGHT )
        {
            x1 = x + (width - wBmp) - marginX;
        }
        else
        {
            x1 = x + (width - wBmp) / 2;
        }

        if ( m_windowStyle & wxBU_TOP )
        {
            y1 = y + marginY;
        }
        else if ( m_windowStyle & wxBU_BOTTOM )
        {
            y1 = y + (height - hBmp) - marginY;
        }
        else
        {
            y1 = y + (height - hBmp) / 2;
        }

        // draw the bitmap
        wxDCTemp dst((WXHDC)hDC);
        dst.DrawBitmap(*bitmap, x1, y1, true);

        return true;
    }
#endif // wxUSE_UXTHEME

    int x1,y1;

    if(m_windowStyle & wxBU_LEFT)
        x1 = x + (FOCUS_MARGIN+1);
    else if(m_windowStyle & wxBU_RIGHT)
        x1 = x + (width - wBmp) - (FOCUS_MARGIN+1);
    else
        x1 = x + (width - wBmp) / 2;

    if(m_windowStyle & wxBU_TOP)
        y1 = y + (FOCUS_MARGIN+1);
    else if(m_windowStyle & wxBU_BOTTOM)
        y1 = y + (height - hBmp) - (FOCUS_MARGIN+1);
    else
        y1 = y + (height - hBmp) / 2;

    if ( isSelected && autoDraw )
    {
        x1++;
        y1++;
    }

    // draw the face, if auto-drawing
    if ( autoDraw )
    {
        DrawFace((WXHDC) hDC,
                 lpDIS->rcItem.left, lpDIS->rcItem.top,
                 lpDIS->rcItem.right, lpDIS->rcItem.bottom,
                 isSelected);
    }

    // draw the bitmap
    wxDCTemp dst((WXHDC)hDC);
    dst.DrawBitmap(*bitmap, x1, y1, true);

    // draw focus / disabled state, if auto-drawing
    if ( (state & ODS_DISABLED) && autoDraw )
    {
        DrawButtonDisable((WXHDC) hDC,
                          lpDIS->rcItem.left, lpDIS->rcItem.top,
                          lpDIS->rcItem.right, lpDIS->rcItem.bottom,
                          true);
    }
    else if ( (state & ODS_FOCUS) && autoDraw )
    {
        DrawButtonFocus((WXHDC) hDC,
                        lpDIS->rcItem.left,
                        lpDIS->rcItem.top,
                        lpDIS->rcItem.right,
                        lpDIS->rcItem.bottom,
                        isSelected);
    }

    return true;
}
Exemplo n.º 19
0
void Window_Message::InsertNewPage() {
	contents->Clear();

	if (Game_Message::fixed_position) {
		y = Game_Message::position * 80;
	} else {
		// Move Message Box to prevent player hiding
		int disp = Main_Data::game_player->GetScreenY();

		switch (Game_Message::position) {
		case 0: // Up
			y = disp > (16 * 7) ? 0 : 2 * 80;
			break;
		case 1: // Center
			if (disp <= 16 * 7) {
				y = 2 * 80;
			} else if (disp >= 16 * 10) {
				y = 0;
			} else {
				y = 80;
			}
			break;
		case 2: // Down
			y = disp >= (16 * 10) ? 0 : 2 * 80;
			break;
		};
	}


	if (Game_Message::background) {
		opacity = 255;
	} else {
		opacity = 0;
	}

	if (!Game_Message::face_name.empty()) {
		if (Game_Message::face_left_position) {
			contents_x = LeftMargin + FaceSize + RightFaceMargin;
			DrawFace(Game_Message::face_name, Game_Message::face_index, LeftMargin, TopMargin, Game_Message::face_flipped);
		} else {
			contents_x = 0;
			DrawFace(Game_Message::face_name, Game_Message::face_index, 248, TopMargin, Game_Message::face_flipped);
		}
	} else {
		contents_x = 0;
	}

	if (Game_Message::choice_start == 0 && Game_Message::choice_max > 0) {
		contents_x += 12;
	}

	contents_y = 2;
	line_count = 0;
	text_color = Font::ColorDefault;
	speed_modifier = 0;

	if (Game_Message::num_input_start == 0 && Game_Message::num_input_variable_id > 0) {
		// If there is an input window on the first line
		StartNumberInputProcessing();
	}
}
void Window_Base::DrawActorFace(Game_Actor* actor, int cx, int cy) {
	DrawFace(actor->GetFaceName(), actor->GetFaceIndex(), cx, cy);
}
Exemplo n.º 21
0
bool wxBitmapButton::MSWOnDraw(WXDRAWITEMSTRUCT *item)
{
#ifndef __WXWINCE__
    long style = GetWindowLong((HWND) GetHWND(), GWL_STYLE);
    if (style & BS_BITMAP)
    {
        // Let default procedure draw the bitmap, which is defined
        // in the Windows resource.
        return false;
    }
#endif

    LPDRAWITEMSTRUCT lpDIS = (LPDRAWITEMSTRUCT) item;
    HDC hDC                = lpDIS->hDC;
    UINT state             = lpDIS->itemState;
    bool isSelected        = (state & ODS_SELECTED) != 0;
    bool autoDraw          = (GetWindowStyleFlag() & wxBU_AUTODRAW) != 0;


    // choose the bitmap to use depending on the button state
    wxBitmap* bitmap;

    if ( isSelected && m_bmpSelected.Ok() )
        bitmap = &m_bmpSelected;
    else if ((state & ODS_FOCUS) && m_bmpFocus.Ok())
        bitmap = &m_bmpFocus;
    else if ((state & ODS_DISABLED) && m_bmpDisabled.Ok())
        bitmap = &m_bmpDisabled;
    else
        bitmap = &m_bmpNormal;

    if ( !bitmap->Ok() )
        return false;

    // centre the bitmap in the control area
    int x      = lpDIS->rcItem.left;
    int y      = lpDIS->rcItem.top;
    int width  = lpDIS->rcItem.right - x;
    int height = lpDIS->rcItem.bottom - y;
    int wBmp   = bitmap->GetWidth();
    int hBmp   = bitmap->GetHeight();

    int x1,y1;

    if(m_windowStyle & wxBU_LEFT)
        x1 = x + (FOCUS_MARGIN+1);
    else if(m_windowStyle & wxBU_RIGHT)
        x1 = x + (width - wBmp) - (FOCUS_MARGIN+1);
    else
        x1 = x + (width - wBmp) / 2;

    if(m_windowStyle & wxBU_TOP)
        y1 = y + (FOCUS_MARGIN+1);
    else if(m_windowStyle & wxBU_BOTTOM)
        y1 = y + (height - hBmp) - (FOCUS_MARGIN+1);
    else
        y1 = y + (height - hBmp) / 2;

    if ( isSelected && autoDraw )
    {
        x1++;
        y1++;
    }

    // draw the face, if auto-drawing
    if ( autoDraw )
    {
        DrawFace((WXHDC) hDC,
                 lpDIS->rcItem.left, lpDIS->rcItem.top,
                 lpDIS->rcItem.right, lpDIS->rcItem.bottom,
                 isSelected);
    }

    // draw the bitmap
    wxDC dst;
    dst.SetHDC((WXHDC) hDC, false);
    dst.DrawBitmap(*bitmap, x1, y1, true);

    // draw focus / disabled state, if auto-drawing
    if ( (state & ODS_DISABLED) && autoDraw )
    {
        DrawButtonDisable((WXHDC) hDC,
                          lpDIS->rcItem.left, lpDIS->rcItem.top,
                          lpDIS->rcItem.right, lpDIS->rcItem.bottom,
                          true);
    }
    else if ( (state & ODS_FOCUS) && autoDraw )
    {
        DrawButtonFocus((WXHDC) hDC,
                        lpDIS->rcItem.left,
                        lpDIS->rcItem.top,
                        lpDIS->rcItem.right,
                        lpDIS->rcItem.bottom,
                        isSelected);
    }

    return true;
}
Exemplo n.º 22
0
void CSceneNodeAABB::DrawFace(const vector3 &from, const vector3 &d0,const vector3 &d1, int div0, int div1) const{
	DrawFace( FixedArray<vector3,4>( from,from+d0,from+d1,from+d0+d1 ),div0,div1 );
}
Exemplo n.º 23
0
void Window_Base::DrawActorFace(const Game_Actor& actor, int cx, int cy) {
	DrawFace(actor.GetFaceName(), actor.GetFaceIndex(), cx, cy);
}
Exemplo n.º 24
0
/**
*
* \name Died()
*
* Died
* This function perfoms the process of animation the character's death and restart the level 
* if you still have lives.
* 
*/
void Died (void)
{
	float	fangle;
	long	dx,dy;
	int		iangle,curangle,clockwise,counter,change;

	/* -1 means the player has no weapon */
	gamestate.weapon = -1;			// take away weapon

        /* We need another way to play sounds */
	SD_PlaySound (PLAYERDEATHSND);
//
// swing around to face attacker
//
/* 
         could be a function for this animation 
	 like:  died_animation() or died_rotated_animation()
*/
	dx = killerobj->x - player->x;
	dy = player->y - killerobj->y;

	fangle = atan2(dy,dx);			// returns -pi to pi
	if (fangle<0)
		fangle = M_PI*2+fangle;

	iangle = fangle/(M_PI*2)*ANGLES;

	if (player->angle > iangle)
	{
		counter = player->angle - iangle;
		clockwise = ANGLES-player->angle + iangle;
	}
	else
	{
		clockwise = iangle - player->angle;
		counter = player->angle + ANGLES-iangle;
	}

	curangle = player->angle;

	if (clockwise<counter)
	{
	//
	// rotate clockwise
	//
		if (curangle>iangle)
			curangle -= ANGLES;
		do
		{
			change = tics*DEATHROTATE;
			if (curangle + change > iangle)
				change = iangle-curangle;

			curangle += change;
			player->angle += change;
			if (player->angle >= ANGLES)
				player->angle -= ANGLES;

			ThreeDRefresh ();
			CalcTics ();
		} while (curangle != iangle);
	}
	else
	{
	//
	// rotate counterclockwise
	//
		if (curangle<iangle)
			curangle += ANGLES;
		do
		{
			change = -tics*DEATHROTATE;
			if (curangle + change < iangle)
				change = iangle-curangle;

			curangle += change;
			player->angle += change;
			if (player->angle < 0)
				player->angle += ANGLES;

			ThreeDRefresh ();
			CalcTics ();
		} while (curangle != iangle);
	}
	/* FINISH of rotation animation */

//
// fade to red
//
	FinishPaletteShifts ();

	bufferofs += screenofs;
	VW_Bar (0,0,viewwidth,viewheight,4);
	IN_ClearKeysDown ();
	FizzleFade(bufferofs,displayofs+screenofs,viewwidth,viewheight,70,false);
	bufferofs -= screenofs;
	IN_UserInput(100);
	SD_WaitSoundDone ();

	if (tedlevel == false)	// SO'S YA DON'T GET KILLED WHILE LAUNCHING!
	  gamestate.lives--;

	if (gamestate.lives > -1) //if the character has lives, set a new level
	{
		gamestate.health = 100;
		gamestate.weapon = gamestate.bestweapon
			= gamestate.chosenweapon = wp_pistol;
		gamestate.ammo = STARTAMMO;
		gamestate.keys = 0;
		gamestate.attackframe = gamestate.attackcount =
		gamestate.weaponframe = 0;

		/* We need to change those Draw function
		   to Draw3D functions. */
		DrawKeys ();
		DrawWeapon ();
		DrawAmmo ();
		DrawHealth ();
		DrawFace ();
		DrawLives ();
	}

}
Exemplo n.º 25
0
void Died (void)
{
	float	fangle;
	long	dx,dy;
	int		iangle,curangle,clockwise,counter,change;

	gamestate.weapon = (weapontype)-1;			// take away weapon
	SD_PlaySound (PLAYERDEATHSND);
//
// swing around to face attacker
//
	dx = killerobj->x - player->x;
	dy = player->y - killerobj->y;

	fangle = atan2((float)dy,(float)dx);			// returns -pi to pi // PORT add float cast
	if (fangle<0)
		fangle = M_PI*2+fangle;

	iangle = fangle/(M_PI*2)*ANGLES;

	if (player->angle > iangle)
	{
		counter = player->angle - iangle;
		clockwise = ANGLES-player->angle + iangle;
	}
	else
	{
		clockwise = iangle - player->angle;
		counter = player->angle + ANGLES-iangle;
	}

	curangle = player->angle;

	if (clockwise<counter)
	{
	//
	// rotate clockwise
	//
		if (curangle>iangle)
			curangle -= ANGLES;
		do
		{
			change = tics*DEATHROTATE;
			if (curangle + change > iangle)
				change = iangle-curangle;

			curangle += change;
			player->angle += change;
			if (player->angle >= ANGLES)
				player->angle -= ANGLES;

			ThreeDRefresh ();
			CalcTics ();
		} while (curangle != iangle);
	}
	else
	{
	//
	// rotate counterclockwise
	//
		if (curangle<iangle)
			curangle += ANGLES;
		do
		{
			change = -tics*DEATHROTATE;
			if (curangle + change < iangle)
				change = iangle-curangle;

			curangle += change;
			player->angle += change;
			if (player->angle < 0)
				player->angle += ANGLES;

			ThreeDRefresh ();
			CalcTics ();
		} while (curangle != iangle);
	}

//
// fade to red
//
	FinishPaletteShifts ();

	bufferofs += screenofs;
	VW_Bar (0,0,viewwidth,viewheight,4);
	IN_ClearKeysDown ();
	FizzleFade(bufferofs,displayofs+screenofs,viewwidth,viewheight,70,False);
	bufferofs -= screenofs;
	IN_UserInput(100);
	SD_WaitSoundDone ();

	if (tedlevel == False)	// SO'S YA DON'T GET KILLED WHILE LAUNCHING!
	  gamestate.lives--;

	if (gamestate.lives > -1)
	{
		gamestate.health = 100;
		gamestate.weapon = gamestate.bestweapon
			= gamestate.chosenweapon = wp_pistol;
		gamestate.ammo = STARTAMMO;
		gamestate.keys = 0;
		gamestate.attackframe = gamestate.attackcount =
		gamestate.weaponframe = 0;

		DrawKeys ();
		DrawWeapon ();
		DrawAmmo ();
		DrawHealth ();
		DrawFace ();
		DrawLives ();
	}

}
Exemplo n.º 26
0
bool wxBitmapButton::OS2OnDraw( WXDRAWITEMSTRUCT* pItem)
{
    PUSERBUTTON  pUser     = (PUSERBUTTON)pItem;
    bool         bAutoDraw = (GetWindowStyleFlag() & wxBU_AUTODRAW) != 0;

    if (!pUser)
        return false;

    wxBitmap   bitmap;
    bool       bIsSelected = pUser->fsState & BDS_HILITED;
    wxClientDC vDc(this);

    if (bIsSelected)
        bitmap = GetBitmapPressed();
    else if (pUser->fsState & BDS_DEFAULT)
        bitmap = GetBitmapFocus();
    else if (pUser->fsState & BDS_DISABLED)
        bitmap = GetBitmapDisabled();

    if (!bitmap.IsOk() )
    {
        bitmap = GetBitmapLabel();
        if (!bitmap.IsOk() )
            return false;
    }


    //
    // Centre the bitmap in the control area
    //
    int                             nX1        = 0;
    int                             nY1        = 0;
    wxPMDCImpl                      *impl = (wxPMDCImpl*) vDc.GetImpl();
    int                             nWidth     = impl->m_vRclPaint.xRight - impl->m_vRclPaint.xLeft;
    int                             nHeight    = impl->m_vRclPaint.yTop - impl->m_vRclPaint.yBottom;
    int                             nBmpWidth  = bitmap.GetWidth();
    int                             nBmpHeight = bitmap.GetHeight();

    nX1 = (nWidth - nBmpWidth) / 2;
    nY1 = (nHeight - nBmpHeight) / 2;

    if (bIsSelected && bAutoDraw)
    {
        nX1++;
        nY1++;
    }

    //
    // Draw the button face
    //
    DrawFace( vDc, bIsSelected );

    //
    // Draw the bitmap
    //
    vDc.DrawBitmap( bitmap, nX1, nY1, true );

    //
    // Draw focus / disabled state, if auto-drawing
    //
    if ((pUser->fsState == BDS_DISABLED) && bAutoDraw)
    {
        DrawButtonDisable( vDc, bitmap );
    }
    else if ((pUser->fsState == BDS_DEFAULT) && bAutoDraw)
    {
        DrawButtonFocus(vDc);
    }
    return true;
} // end of wxBitmapButton::OS2OnDraw
Exemplo n.º 27
0
void DrawFaceWithCommands(TopoDS_Face face)
{
	glBegin(GL_TRIANGLES);
	DrawFace(face,command_callback,false);
	glEnd();
}
Exemplo n.º 28
0
bool wxBitmapButton::OS2OnDraw(
  WXDRAWITEMSTRUCT*                 pItem
)
{
    PUSERBUTTON                     pUser     = (PUSERBUTTON)pItem;
    bool                            bAutoDraw = (GetWindowStyleFlag() & wxBU_AUTODRAW) != 0;

    if (!pUser)
        return FALSE;

    wxBitmap*                       pBitmap;
    bool                            bIsSelected = pUser->fsState & BDS_HILITED;
    wxClientDC                      vDc(this);

    if (bIsSelected && m_bmpSelected.Ok())
        pBitmap = &m_bmpSelected;
    else if ((pUser->fsState & BDS_DEFAULT) && m_bmpFocus.Ok())
        pBitmap = &m_bmpFocus;
    else if ((pUser->fsState & BDS_DISABLED) && m_bmpDisabled.Ok())
        pBitmap = &m_bmpDisabled;
    else
        pBitmap = &m_bmpNormal;

    if (!pBitmap->Ok() )
        return FALSE;


    //
    // Centre the bitmap in the control area
    //
    int                             nX         = 0;
    int                             nX1        = 0;
    int                             nY1        = 0;
    int                             nWidth     = vDc.m_vRclPaint.xRight - vDc.m_vRclPaint.xLeft;
    int                             nHeight    = vDc.m_vRclPaint.xRight - vDc.m_vRclPaint.xLeft;
    int                             nBmpWidth  = pBitmap->GetWidth();
    int                             nBmpHeight = pBitmap->GetHeight();

    nX1 = nX + (nWidth - nBmpWidth) / 2;
    nY1 = nX + (nHeight - nBmpHeight) / 2;

    if (bIsSelected && bAutoDraw)
    {
        nX1++;
        nY1++;
    }

    //
    // Draw the button face
    //
    {
        DrawFace( vDc
                 ,bIsSelected
                );
    }

    //
    // Draw the bitmap
    //
    vDc.DrawBitmap( *pBitmap
                   ,nX1
                   ,nY1
                   ,TRUE
                  );

    //
    // Draw focus / disabled state, if auto-drawing
    //
    if ((pUser->fsState == BDS_DISABLED) && bAutoDraw)
    {
        DrawButtonDisable( vDc
                          ,*pBitmap
                         );
    }
    else if ((pUser->fsState == BDS_DEFAULT) && bAutoDraw)
    {
        DrawButtonFocus(vDc);
    }
    return TRUE;
} // end of wxBitmapButton::OS2OnDraw