Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

241 Neutral

About Nuklear

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Nuklear

    Tomato on my face

    Manually search for and delete registry keys for it, then reinstall. It should get rid of the pesky trial expired message.
  2. Nuklear

    8/9/8 - Weapons display video [ 45 weapons of 50 ]

    i've dropped back for the the first time in a while to gd. it's good to see the progress u've made mate...however if this is not intended for the promotion of the game then ur concentrating making everything shiny instead of making the gameplay great. i'm a gta:vc veteran so i have an idea for what will make it u still have any beta invites? :P
  3. Nuklear

    December 19, some new vehicles.

    I remember recommending the "cuban hermes" months ago, glad it's made the final cut :) its good but i don't think it's quite as good as the vice city one... [image][/image] (damned non-standard can all copy & paste the link :P) anyway im glad to see you still soldiering on with this, don't post often but regularly lurking :) good luck mate and hope it pays off for you!
  4. Nuklear

    my function is being ignored

    I looked at how to use debugging and it seems that the function is being called and doing what it's supposed to. However it's not making the colour on the screen changing like it's supposed to. Thanks for your help once again MadHed :)
  5. Nuklear

    my function is being ignored

    Thanks for the reply MadHed. I used the code tags, but they just seemed to change the font. When I use a break point at the pointx.cycle() function the application runs but seems to crash and won't let me shift+tab back to visual studio. I have to end if by doing ctrl+alt+del. I have tried doing a rebuild too but it seems to make no difference. I'm quite new to programming in general and this is really just confusing me.
  6. Hi, I'm trying to make a simple program that will change the colours of a triangle in directx. For which I've made a custom class, when I test it by making a console application it seems to work fine. However when I try making a windows application, the call to my class function seems to be ignored completely. :/ The bit that seems to be ignored is game_loop(), however when I have the game_init() anywhere but right at the top of the winmain function it also doesn't run. I am at a total loss why this is and hope that someone can help. Using VC++ 2005 express if it makes some kind of a difference. Sorry for the code spam, i have made the relevant segments bold in main.cpp. But I really don't know where the fault is. Here is the main.cpp: // include the basic windows header files and the Direct3D header file #include <windows.h> #include <windowsx.h> #include <d3d9.h> #include "colour.h" // define the screen resolution and keyboard macros #define SCREEN_WIDTH 640 #define SCREEN_HEIGHT 480 #define KEY_DOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0) #define KEY_UP(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 0 : 1) // include the Direct3D Library file #pragma comment (lib, "d3d9.lib") // global declarations LPDIRECT3D9 d3d; // the pointer to our Direct3D interface LPDIRECT3DDEVICE9 d3ddev; // the pointer to the device class LPDIRECT3DVERTEXBUFFER9 t_buffer = NULL; // the pointer to the vertex buffer colour point1; colour point2; colour point3; // function prototypes void initD3D(HWND hWnd); // sets up and initializes Direct3D void render_frame(void); // renders a single frame void cleanD3D(void); // closes Direct3D and releases memory void init_graphics(void); // 3D declarations void init_game(void); //initialise game variables void game_loop(void); //game logic struct CUSTOMVERTEX {FLOAT X, Y, Z, RHW; DWORD COLOR;}; #define CUSTOMFVF (D3DFVF_XYZRHW | D3DFVF_DIFFUSE) // the WindowProc function prototype LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); // the entry point for any Windows program int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){ //initialise game variables init_game(); HWND hWnd; WNDCLASSEX wc; ZeroMemory(&wc, sizeof(WNDCLASSEX)); wc.cbSize = sizeof(WNDCLASSEX); = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = (WNDPROC)WindowProc; wc.hInstance = hInstance; wc.hCursor = LoadCursor(NULL, IDC_ARROW); // wc.hbrBackground = (HBRUSH)COLOR_WINDOW; // not needed any more wc.lpszClassName = L"WindowClass"; RegisterClassEx(&wc); hWnd = CreateWindowEx(NULL, L"WindowClass", L"Our Direct3D Program", WS_EX_TOPMOST | WS_POPUP, // fullscreen values 0, 0, // the starting x and y positions should be 0 SCREEN_WIDTH, SCREEN_HEIGHT, // set the window to 640 x 480 NULL, NULL, hInstance, NULL); ShowWindow(hWnd, nCmdShow); // set up and initialize Direct3D initD3D(hWnd); // enter the main loop: MSG msg; while(TRUE) { DWORD starting_point = GetTickCount(); game_loop(); // loop the game logic if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if (msg.message == WM_QUIT) break; TranslateMessage(&msg); DispatchMessage(&msg); } render_frame(); // check the 'escape' key if(KEY_DOWN(VK_ESCAPE)) PostMessage(hWnd, WM_DESTROY, 0, 0); while ((GetTickCount() - starting_point) < 25); } // clean up DirectX and COM cleanD3D(); return msg.wParam; } // this is the main message handler for the program LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_DESTROY: { PostQuitMessage(0); return 0; } break; } return DefWindowProc (hWnd, message, wParam, lParam); } // this function initializes and prepares Direct3D for use void initD3D(HWND hWnd) { d3d = Direct3DCreate9(D3D_SDK_VERSION); D3DPRESENT_PARAMETERS d3dpp; ZeroMemory(&d3dpp, sizeof(d3dpp)); d3dpp.Windowed = FALSE; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.hDeviceWindow = hWnd; d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8; d3dpp.BackBufferWidth = SCREEN_WIDTH; d3dpp.BackBufferHeight = SCREEN_HEIGHT; // create a device class using this information and the info from the d3dpp stuct d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &d3ddev); init_graphics(); // call the function to initialize the triangle return; } // this is the function used to render a single frame void render_frame(void) { d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0); d3ddev->BeginScene(); // select which vertex format we are using d3ddev->SetFVF(CUSTOMFVF); // select the vertex buffer to display d3ddev->SetStreamSource(0, t_buffer, 0, sizeof(CUSTOMVERTEX)); // copy the vertex buffer to the back buffer d3ddev->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1); d3ddev->EndScene(); d3ddev->Present(NULL, NULL, NULL, NULL); return; } // this is the function that cleans up Direct3D and COM void cleanD3D(void) { t_buffer->Release(); // close and release the vertex buffer d3ddev->Release(); // close and release the 3D device d3d->Release(); // close and release Direct3D return; } // this is the function that puts the 3D models into video RAM void init_graphics(void) { // create the vertices using the CUSTOMVERTEX struct CUSTOMVERTEX t_vert[] = { { 320.0f, 50.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(point1.getRed(), point1.getGreen(), point1.getBlue()), }, { 520.0f, 400.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(point2.getRed(), point2.getGreen(), point2.getBlue()), }, { 120.0f, 400.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(point3.getRed(), point3.getGreen(), point3.getBlue()), }, }; // create a vertex buffer interface called t_buffer d3ddev->CreateVertexBuffer(3*sizeof(CUSTOMVERTEX), 0, CUSTOMFVF, D3DPOOL_MANAGED, &t_buffer, NULL); VOID* pVoid; // a void pointer // lock t_buffer and load the vertices into it t_buffer->Lock(0, 0, (void**)&pVoid, 0); memcpy(pVoid, t_vert, sizeof(t_vert)); t_buffer->Unlock(); return; } //initialise the game variables and objects void init_game(void){ //set up the colours of the points point1.setRed(); point2.setGreen(); point3.setBlue(); return; } //loop to do the game logic void game_loop(void){ point1.cycle(); point2.cycle(); point3.cycle(); return; } My colour.h: #pragma once class colour { int red; int green; int blue; bool redToGreen; bool greenToBlue; bool blueToRed; public: void setRed(); void setGreen(); void setBlue(); void cycle(); int getRed() const; int getGreen() const; int getBlue() const; }; and my colour.cpp: #include "colour.h" void colour::setRed() { red = 255; green = 0; blue = 0; redToGreen = true; greenToBlue = false; blueToRed = false; } void colour::setGreen() { red = 0; green = 255; blue = 0; redToGreen = false; greenToBlue = true; blueToRed = false; } void colour::setBlue() { red = 0; green = 0; blue = 255; redToGreen = false; greenToBlue = false; blueToRed = true; } void colour::cycle(){ if (redToGreen){ if(red == 0){ redToGreen = false; greenToBlue = true; blueToRed = false; } else { red -= 1; green += 1; } } if (greenToBlue){ if(green == 0){ redToGreen = false; greenToBlue = false; blueToRed = true; } else { green -= 1; blue += 1; } } if (blueToRed){ if(blue == 0){ redToGreen = true; greenToBlue = false; blueToRed = false; } else { blue -= 1; red += 1; } } } int colour::getRed() const { return red; } int colour::getGreen() const { return green; } int colour::getBlue() const { return blue; } [Edited by - Nuklear on October 7, 2007 2:21:43 PM]
  7. Nuklear

    Untitled do i unsubscribe?
  8. Nuklear


    Goodbye GDNet+.
  9. Nuklear

    a sad day

    My computer died, I think it might be the hdd because when I do a fresh install of Windows its ok the first time I restart but after that some random file goes corrupt. Or it might be the fact that I have no case, and there's a bit of dust accumulating. It's now been 6 weeks of working 7 days a week, without a day off (not counting Christmas and New Year), but i'm still as poor as i was before. Something isn't right.
  10. Nuklear

    Still busy

    So this is my second week of working 7 days a week, i though t it would be tiring. But it's had the opposite effect on me, it has helped me to stop procrastinating so much. Obviously the time available to dev has been reduced but I have less difficulty keeping myself motivated. I'm still doing the first project of the CPP workshop, not really been programming much over the last few days. But i'm half finished and so far i'm meeting my goal of keeping the code neat and OO.
  11. Nuklear

    work work and work

    I haven't made a post recently, mostly because there's not much to report. Also because I have 2 joibs now and I'm working 7 days. I'm thinking of only doing this for a few months until I manage to clear out my debts, still it's pretty draining. Coding related, i'm working on the CPP workshop. I'm taking my time with it as I want to do it properly (no hacks). Hopefully this will give me a good foundation to help me with my future projects. It's made me realise how important designing the project is, opposed to just diving straight into the coding as I've previously been doing. If you read this JWalsh, thanks for the time you've put into this, it's helped me much more than any other programming resources i've used online.
  12. Nuklear

    lolo new post

    He probably thinks no one over 15 is obsessed with pirates, and is trying to groom you.
  13. Nuklear

    Scoring system code looks an awful lot like partic

    I live near Nottingham, in Derby. Only game company here is Eurovision and they only hire veteran programmers. Good luck with getting the job and let me know if the have any other positions open, woud be very grateful.
  14. Nuklear

    An almost-tetris clone

    I decided to have another look at the tetris code that I gave up on a short while ago. Good news is that I have squished the bugs, no I can actually play tetris with it. Bad news is I wasn't able to include the preview of the next shape. This is where the mega bugs creep in. Anyway I'm happy enough with how far I got with it and you can actually play it. Screeny: Clearly I still need to get my basic coding sorting, so I'm steaming ahead with the c++ workshop 1st project. Which isn't quite as straight forward as I thought it would be, but it's a suitable level for me I think.
  15. Nuklear

    crashes and stuff

    Didn't know there was a patch, thanks =) Mages are great damage dealers but wearing 'tissue paper' armour doesn't help (not counting the warmage, 'cos that's just wrong).
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!