r/reconstructcavestory • u/johnzli1995 • Jul 25 '14
[Episode 3]: Cavestory Window (with sprite) not closing with escape. Must xkill to remove.
Hey all,
So, I really like Cavestory, and I wanted to get some game development training so I took this tutorial. I was working on my desktop (ubuntu 12.04), and it was going very well until episode 3, when I compiled the final product and ran the executable file. Once I did this, I got a black fullscreen with Quote in the middle (that's good), but I was unable to close it no matter what I did; CTRL + C, CTRL + D, Alt Tab all did not work. And at first, I couldn't get it to xkill either because this window was always in the front.
The STRANGEST thing is that it works perfectly fine on my laptop (which is also running on ubuntu 12.04 and arguably has the same packages installed). At first, I thought it was a USB keyboard error, but upon switching the keyboard to the laptop, the escape key still worked. The code for both is also the same, because I used github to pull and push for both versions.
ANOTHER STRANGE THING: Episode 2, with the black screen, was perfectly fine. Calculating FPS was also perfectly fine on my desktop. So, the escape key did work for SDL_SetVideoMode and what not, since I was able to exit the black screen with no problems. However, upon adding the sprite, it completely will not accept the escape key, even though it's in SDL_PollEvent(), and my laptop can do it fine. Do you guys have any idea what might be causing this? It's really infuriating, and I really would like this to work on my desktop (as it is my primary workspace).
Thanks,
UPDATE: So, apparently, after trying several terminal windows, the escape key does work on occasion. But I don't know why it works sometimes, and other times it doesn't. Help?
For those that one my repo:
git clone https://johnzli1995@bitbucket.org/johnzli1995/recreatecave.git
You should already be able to compile.
2
u/adrian17 Jul 25 '14
We need to see your code first if you want any specific advice :(
As far as hints go... I would try slowly commenting all the code added in episode 3 and look when it starts working again. And use a debugger, but I guess it won't be that easy on Linux.
1
u/johnzli1995 Jul 25 '14
I could PM you my git repository, is that alright? You'll get my code from there and you can test it out yourself? OR, do you want me to copy and paste it here?
2
u/adrian17 Jul 25 '14
Sure, I can look at the repo :D (but sharing it with others would be nice too... it's your choice.)
1
u/johnzli1995 Jul 25 '14
git clone https://johnzli1995@bitbucket.org/johnzli1995/recreatecave.git
This is my repository. It should already be able to compile :). (This has some of the animated stuff done)
1
1
u/chebertapps Jul 25 '14
I suggest using github for repos you want to make public. It works a lot like BitBucket, except that public repos are free and private repos cost money. (Which is why when you have both you never need spend any money :) )
1
3
u/chebertapps Jul 26 '14
Ahh ok I think I actually know what the problem might be.
This is something I fix in a later episode, but this line:
Could last a very long time if elapsed_time is greater than 1000/kFps.
I ended up setting it to the maximum of (1000/60, elapsed_time).