comparison Xcode-iPhoneOS/Demos/src/mixer.c @ 4490:06c7423f8c60

Updated iPhone keyboard code (which builds and runs on the iPad and iPhone simulator now) Updated iPhone demos (which build and run again)
author Sam Lantinga <slouken@libsdl.org>
date Wed, 07 Jul 2010 18:58:51 -0700
parents 64ce267332c6
children 78db79f5a4e2
comparison
equal deleted inserted replaced
4489:2bb1bfeee9e2 4490:06c7423f8c60
122 handleMouseButtonDown(SDL_Event * event) 122 handleMouseButtonDown(SDL_Event * event)
123 { 123 {
124 124
125 int x, y, mouseIndex, i, drumIndex; 125 int x, y, mouseIndex, i, drumIndex;
126 126
127 mouseIndex = event->button.which; 127 mouseIndex = 0;
128 drumIndex = -1; 128 drumIndex = -1;
129 129
130 SDL_SelectMouse(mouseIndex);
131 SDL_GetMouseState(&x, &y); 130 SDL_GetMouseState(&x, &y);
132 /* check if we hit any of the drum buttons */ 131 /* check if we hit any of the drum buttons */
133 for (i = 0; i < NUM_DRUMS; i++) { 132 for (i = 0; i < NUM_DRUMS; i++) {
134 if (x >= buttons[i].rect.x 133 if (x >= buttons[i].rect.x
135 && x < buttons[i].rect.x + buttons[i].rect.w 134 && x < buttons[i].rect.x + buttons[i].rect.w
151 /* called from main event loop */ 150 /* called from main event loop */
152 void 151 void
153 handleMouseButtonUp(SDL_Event * event) 152 handleMouseButtonUp(SDL_Event * event)
154 { 153 {
155 int i; 154 int i;
156 int mouseIndex = event->button.which; 155 int mouseIndex = 0;
157 /* check if this should cause any of the buttons to become unpressed */ 156 /* check if this should cause any of the buttons to become unpressed */
158 for (i = 0; i < NUM_DRUMS; i++) { 157 for (i = 0; i < NUM_DRUMS; i++) {
159 if (buttons[i].touchIndex == mouseIndex) { 158 if (buttons[i].touchIndex == mouseIndex) {
160 buttons[i].isPressed = 0; 159 buttons[i].isPressed = 0;
161 } 160 }