#105269 - damaged1130 - Sat Oct 07, 2006 5:14 am
I'm trying to play around with the stylus and just to make sure I understood what I was doing I wrote a quick program that should move a box around the screen at the touch of the stylus. The box moves fine when the stylus is down, but i can't seem to get it to stick when I pick up the pen. The particular problem I am having is that the box is being cleared by the background when the pen is up, even though I have the background clear routine only happening when the pen is down?
I'm sure its some simple logic issue I'm having here but I just want to make sure this code "Should" work[/code]
Code: |
while(1) { //store the previous coord's to clear them upon change old_x = shape_x; old_y = shape_y; // Test if pen is down. If down then update x,y coord's and clear out // Original area where block rect was with background color uint16 specialKeysPressed = ~IPC->buttons; if(specialKeysPressed & (1 << 6)) { touchPosition touchXY = touchReadXY(); shape_x = touchXY.px; shape_y = touchXY.py; // This should only erase the the previous square when the pen is down but it is seems to be erasing the screen even when the pen is up. drawRect(old_x, old_y, 10, 10, VRAM_A, bgcolor); } //This should execute EVERYTIME but it only seems to draw when the pen is down instead? drawRect(shape_x, shape_y, 10, 10, VRAM_A, color); } |
I'm sure its some simple logic issue I'm having here but I just want to make sure this code "Should" work[/code]