Keyboard Commands Don't Work in VmEmulator

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Keyboard Commands Don't Work in VmEmulator

blossoms75
Hi,

I just got started with Chapter 9. I'm using the square game example to just get a feel for what Jack can do. I was able to successfully compile the .jack files (Square, SquareGame, and Main) on Windows and was able to load them into the VmEmulator. When I run it, I can see everything (i.e. I can see the stack changing), but when the square appears on the VmEmulator screen, I can't move it or change its size. I used the different arrows, but the square never moves. I tried x and z to resize the square, but nothing happens.

What I've Tried:
I went ahead and tried another example (the print Hello World example) just to make sure I was running and using the VmEmulator correcty, and that worked fine.

 I used everything "out of the box," I have java jre and jdk on my machine, and everything worked as explained in the documentation so far. The only thing that doesn't seem to be working are the keyboard commands. I checked the code just in case, and it looks fine (but maybe Im missing something).

My question is:
Is there something else I should look for in order to fix the Square Game keyboard commands?

Thanks for any help.
Reply | Threaded
Open this post in threaded view
|

Re: Keyboard Commands Don't Work in VmEmulator

cadet1620
Administrator
Have you clicked on the keyboard button below, left, of the screen? If your PC's keyboard focus is on some other part of the VM Emulator's UI, the keys won't make it to the program.

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: Keyboard Commands Don't Work in VmEmulator

blossoms75
Yes, I did try that. Next to the keyboard icon, there is a little box that flashes the name of the key you press. I can see that changing. For example, if I press the down arrow, it will say "Down." If I press "x," "X" will flash in that box. Nothing happens on the screen above it though where the black square is.
Reply | Threaded
Open this post in threaded view
|

Re: Keyboard Commands Don't Work in VmEmulator

cadet1620
Administrator
blossoms75 wrote
 I can see everything (i.e. I can see the stack changing),
Missed this when I read your initial post.  Are you trying to run SquareGame with animation on?  You need to have Animate set to "no animation" for the program to run fast enough to be able to read the key presses.  

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: Keyboard Commands Don't Work in VmEmulator

blossoms75
Cool! That worked. You know, I think I tried changing from "Program flow" to "Program and Data Flow," but I didn't think to try "No Animation." Thanks so much for your help.