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 |
#ifndef COLOR_H #define COLOR_H #include <windows.h> class Color { public: DWORD red; DWORD green; DWORD blue; Color(); }; #endif |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 |
#include "Color.h" Color::Color() { red = 0x00ff0000; green = 0x0000ff00; blue = 0x000000ff; } |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
#ifndef VEKTOR3D_H #define VEKTOR3D_H class CUSTOMVERTEX { public: float x,y,z; CUSTOMVERTEX(){} CUSTOMVERTEX(const CUSTOMVERTEX &customvertex) : x(customvertex.x),y(customvertex.y) {} CUSTOMVERTEX(float x,float y,float z) : x(x),y(y),z(z) {} }; #endif |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
#ifndef VEKTOR2D_H #define VEKTOR2D_H class Vektor2D { public: float x,y,z; Vektor2D(){} Vektor2D(const Vektor2D &vektor2D) : x(vektor2D.x),y(vektor2D.y) {} Vektor2D(float x,float y) : x(x),y(y) {} }; #endif |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 |
struct STitleVertex { CUSTOMVERTEX vPosition; float fRHW; D3DCOLOR Color; Vektor2D vTex0; static const DWORD dwFVF; }; |
C-/C++-Quelltext |
|
1 |
const DWORD STitleVertex::dwFVF = D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1; |
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 32 33 34 35 36 37 38 39 40 41 42 43 44 |
void SetBackgroundImage() { STitleVertex aVertex[4]; id3d.pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET, color.red, 1.0f, 0); id3d.pd3dDevice->BeginScene(); id3d.pd3dDevice->SetFVF(STitleVertex::dwFVF); id3d.pd3dDevice->SetTexture(0, m_pTexture); id3d.pd3dDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE); // Die vier Vertizes des Titelbilds erstellen (Rechteck) // Links unten aVertex[0].vPosition = CUSTOMVERTEX(0.0f, 0.0f, 0.5f); aVertex[0].fRHW = 1.0f; aVertex[0].Color = color.red; aVertex[0].vTex0 = Vektor2D(0.0f, 1.0f); // Links oben aVertex[1].vPosition = CUSTOMVERTEX(0.0f, 0.0f, 0.0f); aVertex[1].fRHW = 1.0f; aVertex[1].Color = color.red; aVertex[1].vTex0 = Vektor2D(0.0f, 0.0f); // Rechts unten aVertex[2].vPosition = CUSTOMVERTEX(0.0f, 0.0f, 0.5f); aVertex[2].fRHW = 1.0f; aVertex[2].Color = color.red; aVertex[2].vTex0 = Vektor2D(1.0f, 1.0f); // Rechts oben aVertex[3].vPosition = CUSTOMVERTEX(0.0f, 0.0f, 0.5f); aVertex[3].fRHW = 1.0f; aVertex[3].Color = color.red; aVertex[3].vTex0 = Vektor2D(1.0f, 0.0f); // Als Dreiecksfolge zeichnen id3d.pd3dDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, aVertex, sizeof(STitleVertex)); id3d.pd3dDevice->EndScene(); } ... ir->SetBackgroundImage(); id3d.pd3dDevice->Present(NULL,NULL,NULL,NULL); |
C-/C++-Quelltext |
|
1 2 3 4 |
aVertex[0].vPosition = CUSTOMVERTEX(0.0f, 0.0f, 0.5f);// Position des Pixels oben links aVertex[1].vPosition = CUSTOMVERTEX(0.0f, 0.0f, 0.0f);// Position des Pixels oben links aVertex[2].vPosition = CUSTOMVERTEX(0.0f, 0.0f, 0.5f);// Position des Pixels oben links aVertex[3].vPosition = CUSTOMVERTEX(0.0f, 0.0f, 0.5f);// Position des Pixels oben links |
idontknow
unregistriert
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
// Die vier Vertizes des Titelbilds erstellen (Rechteck) // Links unten aVertex[0].vPosition = CUSTOMVERTEX(0.0f, 0.0f, 0.5f); aVertex[0].vTex0 = Vektor2D(0.0f, 1.0f); // Links oben aVertex[1].vPosition = CUSTOMVERTEX(0.0f, 0.0f, 0.0f); aVertex[1].vTex0 = Vektor2D(0.0f, 0.0f); // Rechts unten aVertex[2].vPosition = CUSTOMVERTEX(1.0f, 0.0f, 0.5f); aVertex[2].vTex0 = Vektor2D(1.0f, 1.0f); // Rechts oben aVertex[3].vPosition = CUSTOMVERTEX(1.0f, 0.0f, 0.0f); aVertex[3].vTex0 = Vektor2D(1.0f, 0.0f); |
idontknow
unregistriert
C-/C++-Quelltext |
|
1 |
Vektor2D vTex0; |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 |
class Vektor2D { public: float x,y,z; Vektor2D(){} Vektor2D(const Vektor2D &vektor2D) : x(vektor2D.x),y(vektor2D.y) {} Vektor2D(float x,float y) : x(x),y(y) {} }; |
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 32 33 34 35 36 37 |
STitleVertex aVertex[4]; id3d.pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET,0xFF00FF00, 1.0f, 0); id3d.pd3dDevice->BeginScene(); id3d.pd3dDevice->SetFVF(STitleVertex::dwFVF); id3d.pd3dDevice->SetTexture(0, m_pTexture); id3d.pd3dDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE); // Die vier Vertizes des Titelbilds erstellen (Rechteck) // Links unten aVertex[0].vPosition = CUSTOMVERTEX(0.0f, 0.0f, 0.5f); aVertex[0].fRHW = 1.0f; aVertex[0].color = Color(1.0f,0.0f,0.0f); aVertex[0].vTex0 = Vektor2D(0.0f, 1.0f); // Links oben aVertex[1].vPosition = CUSTOMVERTEX(0.0f, 0.0f, 0.0f); aVertex[1].fRHW = 1.0f; aVertex[1].color = Color(1.0f,0.0f,0.0f); aVertex[1].vTex0 = Vektor2D(0.0f, 0.0f); // Rechts unten aVertex[2].vPosition = CUSTOMVERTEX(1.0f, 0.0f, 0.5f); aVertex[2].fRHW = 1.0f; aVertex[2].color = Color(1.0f,0.0f,0.0f); aVertex[2].vTex0 = Vektor2D(1.0f, 1.0f); // Rechts oben aVertex[3].vPosition = CUSTOMVERTEX(1.0f, 0.0f, 0.0f); aVertex[3].fRHW = 1.0f; aVertex[3].color = Color(1.0f,0.0f,0.0f); aVertex[3].vTex0 = Vektor2D(1.0f, 0.0f); // Als Dreiecksfolge zeichnen id3d.pd3dDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, aVertex, sizeof(STitleVertex)); id3d.pd3dDevice->EndScene(); |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
#ifndef COLOR_H #define COLOR_H #include <windows.h> class Color { public: float r,g,b,a; // Konstruktoren Color(){} Color(const Color& c) : r(c.r), g(c.g), b(c.b), a(c.a){} Color(const float f) : r(f), g(f), b(f), a(1.0f){} Color(const float _r, const float _g, const float _b) : r(_r), g(_g), b(_b), a(1.0f){} }; #endif |
C-/C++-Quelltext |
|
1 2 3 4 |
#define ARGB(a,r,g,b) ((((BYTE)a) << 24) | (((BYTE)r) << 16) | (((BYTE)g) << 8) | (((BYTE)b)) // Das wäre Rot DWORD color = ARGB(255, 255, 0, 0); |
Werbeanzeige