Jump to content

Vulpix_Dev

Member
  • Posts

    65
  • Joined

  • Last visited

Awards

This user doesn't have any awards

4 Followers

About Vulpix_Dev

  • Birthday Nov 15, 1993

Profile Information

  • Gender
    Male
  • Location
    Colorado
  • Interests
    Programming, reading, gaming.
  • Biography
    I'm a current software development/engineering student. I'm in my 6th term at my school so that makes me a sophomore. My college is accelerated online learning so I'm only in school for 3 1/2 years as opposed to 4. I'm proficient in C++. That's about it right now sadly but I do have minor HTML experience. I didn't learn HTML through my school though. I'm learning C# currently and also learning to write a game engine using c++ and directX programming. There's so much I want to branch out to though. One day I hope to have mastered many programming languages or at least be fluent in them. I also hope to have my own game development and publishing firm. One day I want to branch out to other areas of software development not just games and I also want to delve into robotics and electrical engineering. I'm just now getting into hardware but I really like what I've learned about it. I can't wait to build my first PC and learn about Overclocking things. :)
  • Occupation
    Software development tutor

Vulpix_Dev's Achievements

  1. This is freaking awesome dude. C++ is my all time favorite language. I've been thinking about making something similar to this for a game. Neat though.
  2. Man that's like saying "I want to get a job as a programmer without going to college" the C family of languages is not easy to learn and that's why it's hard to find free resources outside of generic websites for these languages. I'm in college for software development and paying a hefty price tag for my degree in computer science. I started with C++ in classes and have finished that and am learning C#. I can tell you this, after all the time I've been in school which is 1 year +. Programming isn't for everyone. Start with an easier language if that's what you want. Though if you're completely new to programming you need to start with the logic of a program before learning a specific language. What I mean is learn about pseudocode and flowcharting before jumping into actual programming. The syntax isn't what matters it's the logic of a program and developing algorithms. In short, Problem solving. That being said a simple google search regarding c++ will help you locate some very good websites that you can use. Sorry I can't be of more help.
  3. Update- I got it to work. Essentially what you said worked though it took a bit of finagling. Thanks again
  4. For sure. I fell asleep last night that's why I didn't reply. Thank you. I'll try that and see what my results are.
  5. Hello there people. I'm currently developing a game for one of my classes. It's a 2D rpg game inspired by the Final Fantasy series. (obviously the old ones from the snes) I'm having trouble figuring out how to check for a key press. The key is question is the C key. I need to check for the C key being pressed and if it is pressed I need to load a credits .BMP image I created. I already have everything set up and the game loads the main .BMP image for my game (the opening title screen) I'm lost here. I have already incorporated a check for the ESC key being pressed and if it is pressed the game ends and closes. I just don't know how to check for the C key. I thought it might be similar but I can't get it to work. This is all contained in one .cpp file for now. here is my code. //Ryan C. Jones//2D game project game loop//working title TBD//instructor: Janisz//August 15th 2015 #include <windows.h>#include <d3d9.h>#include <d3dx9.h>#include <iostream>using namespace std; //program valuesconst string APPTITLE = "Portcullis of the Lattace";const int SCREENW = 1024;const int SCREENH = 768; //key macro#define KEY_DOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)#define KEY_PRESS(vk_code) ((GetAsyncKeyState(vk_code) & 0x43) ? 1 : 0) //Direct3D objectsLPDIRECT3D9 d3d = NULL;LPDIRECT3DDEVICE9 d3ddev = NULL;LPDIRECT3DSURFACE9 backbuffer = NULL;LPDIRECT3DSURFACE9 surface = NULL; bool gameOver = false;bool switchPage = false; // Game initialization functionbool Game_Init(HWND window){//initialize Direct3Dd3d = Direct3DCreate9(D3D_SDK_VERSION);if (!d3d){MessageBox(window, "Error initializing Direct3D", "Error", MB_OK);return false;} //set Direct3D presentation parametersD3DPRESENT_PARAMETERS d3dpp;ZeroMemory(&d3dpp, sizeof(d3dpp));d3dpp.Windowed = TRUE;d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;d3dpp.BackBufferCount = 1;d3dpp.BackBufferWidth = SCREENW;d3dpp.BackBufferHeight = SCREENH;d3dpp.hDeviceWindow = window; //create Direct3D deviced3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, window,D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &d3ddev); if (!d3ddev){MessageBox(window, "Error creating Direct3D device", "Error", MB_OK);return false;} //clear the backbuffer to blackd3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0); //create surfaceHRESULT result = d3ddev->CreateOffscreenPlainSurface(SCREENW, //width of the surfaceSCREENH, //height of the surfaceD3DFMT_X8R8G8B8, //surface formatD3DPOOL_DEFAULT, //memory pool to use&surface, //pointer to the surfaceNULL); //reserved (always NULL) if (result != D3D_OK){return false;} //load surface from file into newly created surfaceresult = D3DXLoadSurfaceFromFile(surface, //destination surfaceNULL, //destination paletteNULL, //destination rectangle"PortcullisOfTheLattace(MenuImage).bmp", //source filenameNULL, //source rectangleD3DX_DEFAULT, //controls how image is filtered0, //for transparency (0 for none)NULL); //source image info (usually NULL) //make sure file was loaded okayif (result != D3D_OK){return false;} return true;} // Game update functionvoid Game_Run(HWND hwnd){//make sure the Direct3D device is validif (!d3ddev){return;} //create pointer to the back bufferd3ddev->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &backbuffer); //start renderingif (d3ddev->BeginScene()){//draw surface to the backbufferd3ddev->StretchRect(surface, NULL, backbuffer, NULL, D3DTEXF_NONE); //stop renderingd3ddev->EndScene();d3ddev->Present(NULL, NULL, NULL, NULL);} //check for escape key (to exit program)if (KEY_DOWN(VK_ESCAPE)){PostMessage(hwnd, WM_DESTROY, 0, 0);}} // Game shutdown functionvoid Game_End(HWND hwnd){if (surface){surface->Release();}if (d3ddev){d3ddev->Release();}if (d3d){d3d->Release();}} // Windows event handling functionLRESULT WINAPI WinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam){switch (msg){case WM_DESTROY:gameOver = true;break;}return DefWindowProc(hWnd, msg, wParam, lParam);} // Windows entry point functionint WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){MessageBox(NULL, "Welcome to 'Portcullis of the Lattace', A 2D adventure RPG!\n\n\nBy Ryan C. Jones", "POTL welcome message", MB_OK | MB_ICONINFORMATION); WNDCLASSEX wc;HWND hwnd;MSG message; //initialize window settingswc.cbSize = sizeof(WNDCLASSEX);wc.style = CS_HREDRAW | CS_VREDRAW;wc.lpfnWndProc = (WNDPROC)WinProc;wc.cbClsExtra = 0;wc.cbWndExtra = 0;wc.lpszMenuName = NULL;wc.hIcon = NULL;wc.hIconSm = NULL;wc.hInstance = hInstance;wc.hCursor = LoadCursor(NULL, IDC_ARROW);wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);wc.lpszClassName = "MainWindowClass"; if (!RegisterClassEx(&wc)){return FALSE;} //create a new windowhwnd = CreateWindow("MainWindowClass", APPTITLE.c_str(),WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,SCREENW, SCREENH, NULL, NULL, hInstance, NULL); //was there an error creating the window?if (hwnd == 0){return 0;} //display the windowShowWindow(hwnd, nCmdShow);UpdateWindow(hwnd); //initialize the gameif (!Game_Init(hwnd)){return FALSE;} // main message loopwhile (!gameOver){if (PeekMessage(&message, NULL, 0, 0, PM_REMOVE)){TranslateMessage(&message);DispatchMessage(&message);} //process game loop Game_Run(hwnd);} return message.wParam;}
  6. You got it. Thank you Have a good night
  7. Well I still have a bunch of schoolwork to do and it's 3 am so I gotta go. Thanks again. I'm gonna add you if that's okay maybe we can bullshit about programming. I am really passionate about it
  8. I'll try and get into the habit of using the ternary statements. It's so hard for me to read but I guess It's more commonplace.
  9. Okie doke. That actually worked. Obviously I'm not gonna use the code you provided but you helped me solve the issue. It was the fact that I had intialized smallNum to 0 so that was sticking. AS I said I'm still learning C# and the .NET library so I wasn't aware of the int.MaxValue thing. That fixed it. Thank you so much Here's what worked when I set smallNum initialized to int.MaxVal if (tempNum < smallNum && tempNum != STOP && smallNum != STOP)//if small number is equal to 0 or if small num is less than temp number and temp number is NOT equavalent to const STOP variable (-999){ smallNum = tempNum;//small number is set to temp number}
  10. Thank you. Much appreciated. Never heard of Dyscalculia before that's interesting. And yes it is a logical issue.
  11. Here's the code that half worked. if ((smallNum == 0 || smallNum > tempNum) && tempNum != STOP)//if small number is equal to 0 or if small num is less than temp number and temp number is NOT equavalent to const STOP variable (-999){ smallNum = tempNum;//small number is set to temp number }
  12. I got it half way working at one point but it was still incorrect. It would take any value. No matter what it was. If I input a 0 and then a 1 it would say the smallest value is 1. That's obviously not correct Oddly enough if I input 299 and 298 it would take the 298 as the smallest value. I don't quite get it but eh I've been looking at tthis same code for over 9 hours straight.
  13. My output is always 0 for the smallest number no matter if I input a 0 or not. Obviously it's because I have smallNum initialized to 0 in my declarations. What I can't seem to figure out is what I need to implement in order to make the smallest value input stored as smallNum no matter what it's value may be. It seems simple enough but I am stuck.
  14. The other guy said that I should set my smallNum variable to equal -999 and then run a logical check for that. But that didn't work either.
  15. Most programmers do. I've never like ternary statements. Not in C++ and not in C#. I like readability over condensing code. Though I see it's uses don't get me wrong. I just can't read it efficiently and get confused with what exactly it's saying. Now as for what is going wrong. To be honest I don't know. I'm not 100% on where my logic SHOULD be that would make it work. I need to take the smallest input and output it. What I have is an if statement that says. if (smallNum < tempNum && smallNum != 0 && tempNum != STOP) { smallNum = tempNum;//small number is set to temp number }
×