Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About Gixugif

  • Rank
  1. Thank you, I see how that works now. I mean to read through the solution when I get the chance to better understand it, but it seems this solution would still be rather troubling in the context I'm using it. Since writing this game is also meant to be a learning experience I'm trying to implement many things myself that higher-level libraries would otherwise take care of such as loading sounds and graphics, but taking a looking at lwjgl just for this may be the way to go and it may prevent problems later on too. Edit: Of course using this for my input here would require me to use it in other areas to, requiring a massive rewrite. I'm wondering if that update will be quicker and maybe even save me a lot more time in the long run, or if I can think of a nice solution for this using the method I was originally going with.
  2. I am aware that there is a bug, a 12 or 13 year old bug, that exists on Linux and probably other Unix based systems, that certain ways of detecting when a key is pressed or released do not function the way one would expect. I am also aware there are a few ways around this and I have gone so far to attempt to implement this solution that can be viewed here: http://stackoverflow.../4679195/596359 The problem is that this does not seem to fix anything. The first question someone will ask I believe I can anticipate. I placed this code in a ".java" file named "". This file is in "../src/com/example/". To use it in my code I have put the following lines at the beginning of my main() method: RepeatingKeyEventsFixer repeatingkeyeventsfixer = new RepeatingKeyEventsFixer(); repeatingkeyeventsfixer.install(); [color=#000000]Still, when I press down a key, it tells me it's being pressed down and held, but it will also say it is being released with just about the same frequency. Does anyone have any idea what I may have done wrong? I have also posted this on StackExchange with poor results. I'll post the link here in case the way I phrased things there could help any more: http://stackoverflow.../8948238/596359 [color=#000000]The following code is the code I am using to test if a key has been released or not. I appreciate the time any takes to consider my question. addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e){ processKey(e); } public void keyReleased(KeyEvent g){ processKeyReleased(g); } } ... private void processKeyReleased(KeyEvent g){ int keyCode = g.getKeyCode(); if(!isPaused && !gameOver){ if(keyCode == KeyEvent.VK_LEFT || keyCode == KeyEvent.VK_RIGHT){ System.out.println("released"); player.stopLooping(); } } }
  3. Oops, sorry, took a while for me to get back to this. Edited the line in the op a little bit, but shouldn't have made a functional difference. So the problem was it was looking for "/Images" in the bin directory when the contents of "/Images" were in bin, but not "/Images" itself. Changing the code to read "/player.gif" instead of "/Images/player.gif" fixed this.
  4. BufferedImage ="/Images/player.gif")); The file getResourceAsStream is looking at definitely exists (it's a variable in the actual code, but I figure simpler to write it out here), but for whatever reason, "is" is null on the next line. I'm guessing there's something I don't understand about how this works, but anything I've read so far on the matter hasn't been at all helpful, so I would be thankful for anyone who can explain to me what's going on. I'm sure it's not an issue of where the file is located. My classes are in /src in the DreamGame folder, and as you can see, Images is in the Images folder.
  5. Gixugif

    Neural Network help. Sorry!

    Alright, that makes things a ton clearer. Now this really doesn't seem all that difficult. Thank you so much.
  6. Gixugif

    Neural Network help. Sorry!

    Why, yes, as a matter of fact, that does make me feel much better. by backprop I just meant backpropogation error. I was provided with that, feedforward, and such. I guess what I have to do is implement an algorithm that uses those functions to classify irises. Anyway, thanks. That helps a little. I think I can figure out the rest of the way. Here's the backprop program I was talking about, if you're still wondering:
  7. So, not having been able to find help anywhere else, I come here looking to ask something about NNs when I see the thread complaining about all the NN threads recently. Haha, Oh well. Here's one more then. I have question about inputting data. The data is layed out in a text file just like this: 4.4,0.4,1.1,3.2,flower-name 5.5,1.2,7.7,6.3,flower-name 4.5,6.2,4.4,1.9,flower-name etc. ... Each line is a data point. Now, the backprop function accepts one int. I realize, unfortunately, that the answer is probably different in each case, but I'll at least start by asking: Would I enter each of the numbers in on the line separately? Like loop through backprop 4 times for each line (I almost positive that's not how it'd be done, but like I said, just trying to figure this all out), or do I average them all together or something? I'm already normalizing the values by the way, by dividing the number by the highest number in each column. Also, what about the flower-name? Surely that has to be taken into account somehow. Anyway, thanks, and I'll post more details if necessary (and I'm sure it will be)
  8. Wow, somehow I missed that. Thanks so much for catching that.
  9. #include <windows.h> #include <gl\gl.h> #include <gl\glu.h> #include <gl\glaux.h> HGLRC hRC = NULL; HDC hDC = NULL; HWND hWnd = NULL; HINSTANCE hInstance; bool keys[25]; bool active = TRUE; bool fullscreen = TRUE; LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); GLvoid ReSizeGLScene(GLsizei width, GLsizei height) { if (height == 0) { height = 1; } glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0f,(GLfloat)width/(GLfloat)height, 0.1f, 100.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } int InitGL(GLvoid) { glShadeModel(GL_SMOOTH); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClearDepth(1.0f); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); return TRUE; } int DrawGLScene(GLvoid) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); return TRUE; } GLvoid KillGLWindow(GLvoid) { if (fullscreen) { ChangeDisplaySettings(NULL, 0); ShowCursor(TRUE); } if (hRC) { if (!wglMakeCurrent(NULL, NULL)) { MessageBox(NULL, "Release of DC And RC Failed.", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION); } if (!wglDeleteContext(hRC)) { MessageBox(NULL, "Release Rendering Context Failed.", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION); }hRC = NULL; } if (hDC && !ReleaseDC(hWnd, hDC)) { MessageBox(NULL, "Release Device Context Failed.", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION); hDC = NULL; } if (hWnd && !DestroyWindow(hWnd)) { MessageBox(NULL, "Could Not Release hWnd.", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION); hWnd = NULL; } if (!UnregisterClass("OpenG", hInstance)) { MessageBox(NULL, "Could Not UnregisterClass.", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION); hInstance = NULL; } } BOOL CreateGLWindow(char* title, int width, int height, int bits, bool fullscreenflag) { GLuint PixelFormat; WNDCLASS wc; DWORD dwExStyle; DWORD dwStyle; RECT WindowRect; WindowRect.left = (long)0; WindowRect.right = (long)width; = (long)0; WindowRect.bottom = (long)height; fullscreen = fullscreenflag; hInstance = GetModuleHandle(NULL); = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; wc.lpfnWndProc = (WNDPROC) WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = NULL; wc.lpszMenuName = NULL; wc.lpszClassName = "OpenG"; if (!RegisterClass(&wc)) { MessageBox(NULL, "Failed to Register The Window Class.", "ERROR", MB_OK | MB_ICONEXCLAMATION); return FALSE; } if (fullscreen) { DEVMODE dmScreenSettings; memset(&dmScreenSettings, 0, sizeof(dmScreenSettings)); dmScreenSettings.dmSize=sizeof(dmScreenSettings); dmScreenSettings.dmPelsWidth = width; dmScreenSettings.dmPelsHeight = height; dmScreenSettings.dmBitsPerPel = bits; dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT; if (ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) { if (MessageBox(NULL, "The Requested Fullscreen Mode Is Not Supported By\nYour Video Card. Use Windowed Mode Instead?", "NeHe G", MB_YESNO|MB_ICONEXCLAMATION)==IDYES) { fullscreen = FALSE; } else { MessageBox(NULL, "Program Will Now Close.", "ERROR", MB_OK |MB_ICONSTOP); return FALSE; } } } if (fullscreen) { dwExStyle = WS_EX_APPWINDOW; dwStyle = WS_POPUP; ShowCursor(FALSE); } else { dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; dwStyle = WS_OVERLAPPEDWINDOW; } AdjustWindowRectEx(&WindowRect, dwStyle, FALSE, dwExStyle); if (!(hWnd = CreateWindowEx( dwExStyle, "OpenG", title, WS_CLIPSIBLINGS | WS_CLIPCHILDREN | dwStyle, 0, 0, WindowRect.right-WindowRect.left,, NULL, NULL, hInstance, NULL))) { KillGLWindow(); MessageBox(NULL, "Window Creation Error.", "ERROR", MB_OK | MB_ICONEXCLAMATION); return FALSE; } static PIXELFORMATDESCRIPTOR pfd = { sizeof(PIXELFORMATDESCRIPTOR), 1, PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, PFD_TYPE_RGBA, bits, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, PFD_MAIN_PLANE, 0, 0, 0, 0 }; if (!(hDC = GetDC(hWnd))) { KillGLWindow(); MessageBox(NULL, "Can't Create A GL Device Context.", "ERROR", MB_OK | MB_ICONEXCLAMATION); return FALSE; } if (!(PixelFormat = ChoosePixelFormat(hDC, &pfd))) { KillGLWindow(); MessageBox(NULL, "Can't Find A Suitable PixelFormat", "ERROR", MB_OK | MB_ICONEXCLAMATION); return FALSE; } if (!(hRC = wglCreateContext(hDC))) { KillGLWindow(); MessageBox(NULL, "Can't Create A GL Rendering Context.", "ERROR", MB_OK | MB_ICONEXCLAMATION); return FALSE; } if(!wglMakeCurrent(hDC, hRC)) { KillGLWindow(); MessageBox(NULL, "Can't Activate The GL Rendering Context.", "ERROR", MB_OK | MB_ICONEXCLAMATION); return FALSE; } ShowWindow(hWnd, SW_SHOW); SetForegroundWindow(hWnd); SetFocus(hWnd); ReSizeGLScene(width, height); if (!InitGL()) { KillGLWindow(); MessageBox(NULL, "Initialization Failed.", "ERROR", MB_OK | MB_ICONEXCLAMATION); return FALSE; } return TRUE; } LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_ACTIVATE: { if (!HIWORD(wParam)) { active = TRUE; } else { active = FALSE; } return 0; } case WM_SYSCOMMAND: { switch (wParam) { case SC_SCREENSAVE: case SC_MONITORPOWER: return 0; } break; } case WM_CLOSE: { PostQuitMessage(0); return 0; } case WM_KEYDOWN: { keys[wParam] = TRUE; return 0; } case WM_KEYUP: { keys[wParam] = FALSE; return 0; } case WM_SIZE: { ReSizeGLScene(LOWORD(lParam), HIWORD(lParam)); return 0; } } return DefWindowProc(hWnd, uMsg, wParam, lParam); } int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { MSG msg; BOOL done = FALSE; if (MessageBox(NULL, "Would You Like To Run In Fullscreen Mode?", "Start Fullscreen?", MB_YESNO | MB_ICONQUESTION)== IDNO) { fullscreen = FALSE; } if (!CreateGLWindow("NeHe's OpenGL Framework", 640, 480, 16, fullscreen)) { return 0; } while(!done) { if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if (msg.message == WM_QUIT) { done = TRUE; } else { TranslateMessage(&msg); DispatchMessage(&msg); } } else { if (active) { if(keys[VK_ESCAPE]) { done = TRUE; } else { DrawGLScene(); SwapBuffers(hDC); } } if (keys[VK_F1]) { keys[VK_F1] = FALSE; KillGLWindow(); fullscreen = !fullscreen; if (!CreateGLWindow("NeHe's OpenGL FrameWork", 640, 480, 16, fullscreen)) { return 0; } } } } KillGLWindow(); return (msg.wParam); } It should be the same as what's on the site, but I suppose it's easier to see it all together, and maybe someone else will see something. I already had the latest driver from intel - I checked again to make sure. I have Win 7 so I tried disabling aero; that didn't help. I wasn't really able to find anything else on the intel pages that would help. I really appreciate all that help.
  10. Intel 82945G Express And yeah, I made sure it was fully updated.
  11. So, I just started trying to learn OpenGL, and the tutorial I'm following has me creating a simple window with a solid black background. When I try to run it, I get the error "Can't Create A GL Rendering Context." I did a search and it would seem this has to do with your video driver. Because it's such a simple thing to do though, I'd imagine it has to do with my coding, or maybe because I have integrated graphics? Since the code is basically just copied from the tutorial, it doesn't seem like that'd be the issue. If it helps, i'm using NeHe's tutorial.
  12. Gixugif

    Java won't recognize function

    The method calling getData is in a different class. Yeah, that was it. Stupid little mistake, didn't even occur to me you couldn't do that for some reason. Thanks for the help, and very quick replies.
  13. Gixugif

    Java won't recognize function

    It's defined in the Circular_Linked_List class (not the one included in the java library), as getNode and deleteNode. I might as well include the definitions. public Node getNode(int index) // returns a node from the list { if (index > (size - 1)) return null; Node temp = getFirst(); for (int i = 0; i < index; i++) { temp =; } return temp; } public Node deleteNode(Node delNode) // deletes a node { int index = checkNode(delNode); if (index == -1) System.out.println("Node doesn't exist"); Node temp = getNode(index - 1); if(index == (size - 1)) { Node del = last; =; last = temp; size--; return del; } else { Node del =; =; = null; size--; return del; } } public int getData(Node myNode) // returns data of node { return; } Here's the error message after splitting it into four lines (it appears at getData): cannot find symbol symbol : method getData(Circular_Linked_List.Node) location: class AmStramGram getData( ^ 1 error
  14. delOrder[count] = getData(infantCircle.deleteNode(infantCircle.getNode(k))); This should be all you need. All of the functions accept Node as their parameter and return a Node also. The error I get says it "cannot find symbol" at getData(), and it's probably because for some reason it doesn't think it's getting a Node as a parameter. Help would be appreciated. Thanks!
  15. Gixugif

    Java error: cannot find symbol

    Oh, thank you. That did it. I didn't realize that variables declared in try...catch blocks were only available inside of them.
  • 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!