From 39ff121d7389fd6575e65ecb54b11bb87777ca38 Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 17 Jun 2020 21:53:36 -0400 Subject: Implement game mode layer for dcompact on planck (#9402) --- keyboards/planck/keymaps/dcompact/keymap.c | 103 +++++++++++++++++++++++++++- keyboards/planck/keymaps/dcompact/readme.md | 2 +- 2 files changed, 101 insertions(+), 4 deletions(-) (limited to 'keyboards/planck/keymaps') diff --git a/keyboards/planck/keymaps/dcompact/keymap.c b/keyboards/planck/keymaps/dcompact/keymap.c index 0e53d305d5..cb4cd3f5b9 100644 --- a/keyboards/planck/keymaps/dcompact/keymap.c +++ b/keyboards/planck/keymaps/dcompact/keymap.c @@ -34,6 +34,9 @@ enum planck_layers { _RAISE, _FUNC, _PLOVER, + _GAME, + _LNUM, + _LFUN, _ADJUST, _MOUSE }; @@ -41,12 +44,16 @@ enum planck_layers { enum planck_keycodes { BASE = SAFE_RANGE, PLOVER, + GAME, + LNUM, + LFUN, LOWER, RAISE, FUNC, MOUSE, ADJUST, - EXT_PLV + EXT_PLV, + EXT_GM }; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { @@ -59,14 +66,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------|------+------+------+------+------+------| * |Del/Sf| : ; | Q | J | K | X | B | M | W | V | Z | Bspc | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Ctrl |Plover| GUI | Alt |Lower |Shift |Space |Raise | Alt | GUI | Fn |Enter | + * | Ctrl | Game | GUI | Alt |Lower |Shift |Space |Raise | Alt | GUI | Fn |Enter | * `-----------------------------------------------------------------------------------' */ [_BASE] = LAYOUT_planck_grid( KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH, KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, DEL_SHF, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_BSPC, - KC_LCTL, PLOVER, KC_LGUI, KC_LALT, LOWER, KC_LSFT, KC_SPC, RAISE, KC_RALT, KC_RGUI, FUNC, KC_ENT + KC_LCTL, GAME, KC_LGUI, KC_LALT, LOWER, KC_LSFT, KC_SPC, RAISE, KC_RALT, KC_RGUI, FUNC, KC_ENT ), /* Lower @@ -123,6 +130,61 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX ), +/* Game + * ,-----------------------------------------------------------------------------------. + * | Tab | Q | W | E | H | Z | I | | | | | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * |Shift | A | S | D | U | X | P | | | | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Ctrl | F | G | R | M | C | O | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Esc | ~ | Alt |Space |Shift | LNUM | LFUN | | | | | Exit | + * `-----------------------------------------------------------------------------------' + */ +[_GAME] = LAYOUT_planck_grid( + KC_TAB, KC_Q, KC_W, KC_E, KC_H, KC_Z, KC_I, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + KC_LSFT, KC_A, KC_S, KC_D, KC_U, KC_X, KC_P, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + KC_LCTL, KC_F, KC_G, KC_R, KC_M, KC_C, KC_O, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + KC_ESC, KC_TILD, KC_LALT, KC_SPC, KC_LSFT, LNUM, LFUN, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, EXT_GM +), + +/* LNum + * ,-----------------------------------------------------------------------------------. + * | Tab | 1 | 2 | 3 | 4 | | | | | | | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * |Shift | 5 | 6 | 7 | 8 | | | | | | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Ctrl | 9 | 10 | , | . | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Esc | | Alt |Space |Shift | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_LNUM] = LAYOUT_planck_grid( + _______, KC_1, KC_2, KC_3, KC_4, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + _______, KC_5, KC_6, KC_7, KC_8, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + _______, KC_9, KC_0, KC_COMM, KC_DOT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + _______, XXXXXXX, _______, _______, _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX +), + +/* LFun + * ,-----------------------------------------------------------------------------------. + * | Tab | F1 | F2 | F3 | F4 | | | | | | | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * |Shift | F5 | F6 | F7 | F8 | | | | | | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Ctrl | F9 | F10 | F11 | F12 | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Esc | | Alt |Space |Shift | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_LFUN] = LAYOUT_planck_grid( + _______, KC_F1, KC_F2, KC_F3, KC_F4, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + _______, KC_F5, KC_F6, KC_F7, KC_F8, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + _______, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + _______, XXXXXXX, _______, _______, _______, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX +), + + /* Mouse (Not Reachable on Planck) * ,-----------------------------------------------------------------------------------. * | | | | | | | | | | | | | @@ -234,6 +296,41 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; break; + case GAME: + if (!record->event.pressed) { + #ifdef AUDIO_ENABLE + stop_all_notes(); + PLAY_SONG(plover_song); + #endif + layer_on(_GAME); + } + return false; + break; + case EXT_GM: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(plover_gb_song); + #endif + layer_off(_GAME); + } + return false; + break; + case LNUM: + if (record->event.pressed) { + layer_on(_LNUM); + } else { + layer_off(_LNUM); + } + return false; + break; + case LFUN: + if (record->event.pressed) { + layer_on(_LFUN); + } else { + layer_off(_LFUN); + } + return false; + break; case MOUSE: if (record->event.pressed) { layer_on(_MOUSE); diff --git a/keyboards/planck/keymaps/dcompact/readme.md b/keyboards/planck/keymaps/dcompact/readme.md index cd88c3fed3..f3f3d8ca6e 100644 --- a/keyboards/planck/keymaps/dcompact/readme.md +++ b/keyboards/planck/keymaps/dcompact/readme.md @@ -1,6 +1,6 @@ # DCompact Layout -**Dvorak, Layered, Mouse-Enabled, Compact -- now with Plover~** +**Dvorak, Layered, Mouse-Enabled, Compact -- now with Game Mode~** _See [the layout source](keymap.c) for the actual layout_ -- cgit v1.2.3