| 198 | void ddio_MouseSetVCoords(int width, int height) { ddio_MouseSetLimits(0, 0, width, height); } |
| 199 | |
| 200 | int sdlMouseButtonDownFilter(SDL_Event const *event) { |
| 201 | ASSERT(event->type == SDL_MOUSEBUTTONDOWN); |
| 202 | |
| 203 | const SDL_MouseButtonEvent *ev = &event->button; |
| 204 | t_mse_event mevt; |
| 205 | |
| 206 | if (ev->button == 1) { |
| 207 | DDIO_mouse_state.btn_mask |= MOUSE_LB; |
| 208 | DIM_buttons.down_count[0]++; |
| 209 | DIM_buttons.time_down[0] = timer_GetTime(); |
| 210 | DIM_buttons.is_down[0] = true; |
| 211 | mevt.btn = 0; |
| 212 | mevt.state = true; |
| 213 | MB_queue.send(mevt); |
| 214 | // mprintf(0, "MOUSE Button 0: Down\n"); |
| 215 | } else if (ev->button == 2) { |
| 216 | DDIO_mouse_state.btn_mask |= MOUSE_RB; |
| 217 | DIM_buttons.down_count[1]++; |
| 218 | DIM_buttons.time_down[1] = timer_GetTime(); |
| 219 | DIM_buttons.is_down[1] = true; |
| 220 | mevt.btn = 1; |
| 221 | mevt.state = true; |
| 222 | MB_queue.send(mevt); |
| 223 | // mprintf(0, "MOUSE Button 1: Down\n"); |
| 224 | } |
| 225 | else if (ev->button == 3) { |
| 226 | DDIO_mouse_state.btn_mask |= MOUSE_CB; |
| 227 | DIM_buttons.down_count[2]++; |
| 228 | DIM_buttons.time_down[2] = timer_GetTime(); |
| 229 | DIM_buttons.is_down[2] = true; |
| 230 | mevt.btn = 2; |
| 231 | mevt.state = true; |
| 232 | MB_queue.send(mevt); |
| 233 | // mprintf(0, "MOUSE Button 2: Down\n"); |
| 234 | } |
| 235 | |
| 236 | // buttons 4 and 5 are reserved for the mouse wheel...that's how the engine works...adjust in here. |
| 237 | |
| 238 | else if (ev->button == 4) { |
| 239 | DDIO_mouse_state.btn_mask |= MOUSE_B6; |
| 240 | DIM_buttons.down_count[5]++; |
| 241 | DIM_buttons.time_down[5] = timer_GetTime(); |
| 242 | DIM_buttons.is_down[5] = true; |
| 243 | mevt.btn = 5; |
| 244 | mevt.state = true; |
| 245 | MB_queue.send(mevt); |
| 246 | // mprintf(0, "MOUSE Button 5: Down\n"); |
| 247 | } |
| 248 | else if (ev->button == 5) { |
| 249 | DDIO_mouse_state.btn_mask |= MOUSE_B7; |
| 250 | DIM_buttons.down_count[6]++; |
| 251 | DIM_buttons.time_down[6] = timer_GetTime(); |
| 252 | DIM_buttons.is_down[6] = true; |
| 253 | mevt.btn = 6; |
| 254 | mevt.state = true; |
| 255 | MB_queue.send(mevt); |
| 256 | // mprintf(0, "MOUSE Button 6: Down\n"); |
| 257 | } |
no test coverage detected