//Move Camera //Negative Y = FWD, Positive Y = Backward //Strafe: Negative X = Left, Positive X = Right void AlwynD3DInterfaceImpl::leftThumb(int x, int y) { //swprintf_s(device->t_buffer, L"AlwynD3DInterfaceImpl::leftThumb -- X %i, Y %i\n", x, y); //device->logger->debug(device->t_buffer); //Unlike the keyboard, using shift we control walk, run etc. //With the controller, we have a lot more sensitivity, so we calulate how much //axis is being applied, and use this to determine speed. (always taking framerate into account) fwd = axisvalue(-y); side = axisvalue(x); }
void loop() { char key[64]; int value; const char *exec = NULL; while(run) { readev(); switch(ev.type) { case JS_EVENT_BUTTON: value = ev.value; snprintf(key, sizeof(key), "button%d", ev.number); break; case JS_EVENT_AXIS: value = axisvalue(ev.number, ev.value); snprintf(key, sizeof(key), "axis%d_%s", ev.number, ev.value < 0 ? "up" : "down"); break; case JS_EVENT_INIT: default: continue; } if(value == 0) continue; else if(mode == DUMP) { printf("%s\n", key); continue; } else if(commands && config_setting_lookup_string(commands, key, &exec) == CONFIG_TRUE) { system(exec); } } }