Well, I'm stuck. I've tried learning the basics in DirectX 11 programming for about 3 weeks now, but so far, the only thing I've actually managed to do is a window. I've followed plenty of tutorials about initializing DirectX and then draw a picture on my window, but every try has just resulted in errors or crashs. I've rewritten my code so many times now that I've lost count... I've been programming in C# and XNA beore, but I never realised that it would be this huge difference between them. I would be so happy if someone could actually help me out from this swamp
As said, I've managed to write the code for a 800x600 window that successfully shows up. My goal now is just to draw i simple image in that window. I know that I have to somehow initialize DirectX and then create a sort of variable which will hold my texture, load the texture and finally draw it. I know that it isn't just that easy, for example I have to somehow create a square from 2 sets of triangles. The problem is that the tutorials I've found is just like a big shock to me, and they doesn't even work. I mean, 300-400 lines of code shouldn't be necessary for just drawing a simple image, even if it's C++ and DirectX, right?
I've posted my current code below. Could anyone please tell me, with maybe an example, the most simple way of drawing an image on my window? All help would be really nice, but examples and even step-by-step help would be even more helpfull
Please help,
Falcon93
<BR>#include <Windows.h><BR><BR><BR>LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);<BR><BR><BR>int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)<BR>{<BR>WNDCLASSEX wc;<BR>HWND hWnd;<BR>MSG msg;<BR><BR>ZeroMemory(&wc, sizeof(WNDCLASSEX));<BR><BR>wc.cbSize = sizeof(WNDCLASSEX);<BR>wc.hbrBackground = (HBRUSH)COLOR_WINDOW;<BR>wc.hCursor = LoadCursor(NULL, IDC_ARROW);<BR>wc.hIcon = LoadIcon(NULL, IDI_WINLOGO);<BR>wc.hInstance = hInstance;<BR>wc.lpfnWndProc = WindowProc;<BR>wc.lpszClassName = L"MFGCLASS";<BR>wc.style = CS_VREDRAW | CS_HREDRAW;<BR><BR>RegisterClassEx(&wc);<BR><BR>hWnd = CreateWindowEx(NULL, L"MFGCLASS", L"MyFirstGame", WS_OVERLAPPEDWINDOW, 0, 0, 800, 600, NULL, NULL, hInstance, NULL);<BR><BR>ShowWindow(hWnd, nCmdShow);<BR><BR>while(true)<BR>{<BR> if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))<BR> {<BR> TranslateMessage(&msg);<BR> DispatchMessage(&msg);<BR><BR> if (msg.message == WM_QUIT) break;<BR> }<BR><BR> else<BR> {<BR> }<BR>}<BR><BR>return msg.wParam;<BR>}<BR><BR><BR>LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)<BR>{<BR>switch(message)<BR>{<BR> case WM_DESTROY: PostQuitMessage(0); return 0;<BR>}<BR><BR>return DefWindowProc(hWnd, message, wParam, lParam);<BR>}<BR>