Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
void CSprite::Load(string sFilename) { D3DXCreateTextureFromFile(g_App.GetDevice(), sFilename.c_str(), &m_Sprite); m_Sprite->GetLevelDesc(0, &m_Surface); m_fHeight = m_Surface.Height; m_fWidth = m_Surface.Width; D3DVERTEX Rect[4]; Rect[0].init( 0 , 0 , 10 , 1, 1); Rect[1].init( m_fWidth, 0 , 10, 0, 1); Rect[2].init( 0, m_fHeight, 10, 1, 0); Rect[3].init( m_fWidth , m_fHeight, 10,0,0); g_App->CreateVertexBuffer(sizeof(Rect), D3DUSAGE_WRITEONLY, D3DFVF_CUSTOMVERTEX, D3DPOOL_MANAGED, &m_VBf, NULL); //lock buffer m_VBf->Lock(0,sizeof(Rect),(void**)&pData,0); //copy data to buffer memcpy(pData,Rect,sizeof(Rect)); //unlock buffer m_VBf->Unlock(); vRot = D3DXVECTOR3(0,0,0); m_dRotation = 0; } |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 |
D3DXMATRIX tmp; D3DXMATRIX tmp2; D3DXMatrixScaling(&tmp2, 1.0f, -1.0f, 1.0f); D3DXMatrixOrthoOffCenterLH(&tmp, 0, (float)800, 0, (float)600, 0.0f, 1.0f); D3DXMatrixMultiply(&tmp, &tmp, &tmp2); ct::Graphics::Inst()->SetTransform(D3DTS_WORLD, (D3DMATRIX*)&wolrd); ct::Graphics::Inst()->SetTransform(D3DTS_VIEW, (D3DMATRIX*)&identy); ct::Graphics::Inst()->SetTransform(D3DTS_PROJECTION, (D3DMATRIX*)&tmp); |
C-/C++-Quelltext |
|
1 2 |
m_Device->SetFVF(D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1); m_Device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); |
C-/C++-Quelltext |
|
1 2 3 4 |
D3DXMATRIX tmp; D3DXMatrixOrthoOffCenterLH(&tmp, 0, (float)800, 0, (float)600, 0.0f, 1.0f); m_pDirect3DDevice->SetTransform(D3DTS_PROJECTION,&tmp); m_pDirect3DDevice->SetTransform(D3DTS_VIEW,D3DXMatrixIdentity(&tmp)); |
C-/C++-Quelltext |
|
1 |
rechts = NewPlayer(40.0f,200.0f,10,0.4f, true, 1); // ( xpos, ypos, width, height , unwichtige parameter...) |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
void CSprite::Load(string sFilename,float height, float width, sColor clColorkey) { D3DLOCKED_RECT m_lockedRect; D3DXCreateTextureFromFile(g_App.GetDevice(), sFilename.c_str(), &m_pSprite); m_pSprite->GetLevelDesc(0, &m_Surface); m_fHeight = height; m_fWidth = width; D3DVERTEX Rect[4]; Rect[0].init( 0 , 0 , 0 ,D3DCOLOR_RGBA(0,0,0,0), 0, 0);// ( xpod,ypos,zpos,farbe,texurkoordinaten u, v) Rect[1].init( 0, m_fHeight , 0,D3DCOLOR_RGBA(0,0,0,0), 0, 1); Rect[2].init( m_fWidth, 0, 0,D3DCOLOR_RGBA(0,0,0,0), 1, 0); Rect[3].init( m_fWidth , m_fHeight, 0,D3DCOLOR_RGBA(0,0,0,0),1,1); g_App->CreateVertexBuffer(sizeof(Rect), D3DUSAGE_WRITEONLY, D3DFVF_CUSTOMVERTEX, D3DPOOL_MANAGED, &m_VBf, NULL); //lock buffer m_VBf->Lock(0,sizeof(Rect),(void**)&pData,0); //copy data to buffer memcpy(pData,Rect,sizeof(Rect)); //unlock buffer m_VBf->Unlock(); vRot = D3DXVECTOR3(0,0,0); m_dRotation = 0; } |
Werbeanzeige