Tag Info

New answers tagged

0

I know you asked not to use RawInput, unfortunately on Windows, it will not be possible to use raw USB/HID for mice and keyboards. Windows has an exclusive file lock on mice and keyboards and will not allow you to read from the device directly. You will have to use RawInput or some other Windows specific API for mice and keyboards. I recommend you use ...


1

I managed to implement a pause funcionality that works perfectly well in my game, based on this tutorial: Create a volatile boolean variable in StartingClass private volatile boolean isPaused = false; Inside the run() method, use wait() surrounded by a try-catch. // GAME IS PAUSED try { if (isPaused) { synchronized (this) { ...


0

It seems to me there may be a design issue in the game itself if the frame rate regularly drops to 2fps and that's considered normal. Some turn-based games might take a while to render and present the next screen as basically "static" plus some simple interactive rendering on top of it, but then that's the game style itself. Typically if your game is ...


1

The way I did it is simply calling Keyboard.create() in all the threads that I need to use Keyboard.isKeyDown(int key). I know this sounds sloppy, but it has been working perfectly for me so far.


3

if(SDL_PollEvent(e)) { should be while(SDL_PollEvent(e)) { With "if", you're only processing one event per rendered frame. You need to use a 'while' loop so that every event which occurred during the frame gets processed before the next frame gets drawn.


0

You could either: post increment listNum prior to outputting listNum, assign your iter to listNum prior to outputting listNum, or instead of outputting listNum, just replace it with iter. The issue at hand is that your are not incrementing listNum.


0

Actually you can simply do: private static void Flush() { lastKeyboardState = new KeyboardState(); }


0

I'm assuming the rest of your code goes somewhat like this: if(KeyPressed(Keys.Enter)) bringUpMenu(); if(KeyPressed(Keys.Enter)) selectMenuOption(); and you want to flush the values somewhere in the middle? Well the solution I thought of would be to add the line "keyboardState = lastKeyboardState" to the first if ...



Top 50 recent answers are included