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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
| #include <d3d9.h>
#include <d3dx9.h>
#include <d3dx9tex.h>
#include <d3dx9math.h>
#include <d3dx9math.inl>
#include <windows.h>
#include <windowsx.h>
#include <iostream>
#include <string>
#include "GWindowClass.h"
#include "VertexBufferFAIL.h"
using namespace std;
#pragma comment (lib, "d3d9.lib")
#pragma comment (lib, "d3dx9.lib")
/**************************************************************************************************************************************/
LPDIRECT3DTEXTURE9 *ppTexture=NULL;
LPD3DXSPRITE sprite = NULL;
D3DXVECTOR3 pos(10.0f,10.0f,0.0f);
LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){
GWindow Fenetre;
Fenetre.initialization("Ma Fenêtre",10,10,1000,1000,hInstance);
Fenetre.D3DInit();
// SPRITE
if (D3DXCreateTextureFromFile(Fenetre.d3ddev,"Axi.bmp",ppTexture) != 0){
MessageBox(NULL,
"PB Texture",
"Texture!",
MB_ICONEXCLAMATION | MB_OK);
}
if (D3DXCreateSprite(Fenetre.d3ddev,&sprite ) != 0){
MessageBox(NULL,
"PB Sprite",
"Sprite!",
MB_ICONEXCLAMATION | MB_OK);
}
Fenetre.d3ddev->SetTexture(0,*ppTexture);
MSG msg;
while( 1 ){
while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)){
TranslateMessage(&msg);
DispatchMessage(&msg);
}
if(msg.message == WM_QUIT){
break;
}
Fenetre.beginRender();
/*
sprite->Begin(D3DXSPRITE_ALPHABLEND);
sprite->Draw(*ppTexture,NULL,NULL,&pos,0xFFFFFFFF);
sprite->End();
*/
Fenetre.endRender();
}
return 0;
}
LRESULT CALLBACK GWindow::WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ){
switch (msg){
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
return DefWindowProc(hWnd, msg, wParam, lParam);
}
} |
Partager