diff options
author | rupa <rdeadwyler@ns1.com> | 2020-11-10 00:04:46 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-10 16:04:46 +1100 |
commit | a9f65b760a49744b13d822ab359876a52779bd9e (patch) | |
tree | f5e64f0d55df4f170e05f5f9d26218388102e628 /users/rupa/unicode.c | |
parent | 53f11668a3399ff1bdf82902a7717832831219bf (diff) |
userspace and keymap changes for rupa (#10489)
* userspace and keymap changes for rupa
* remove layout wrappers and blocker rows from wrappers
handle this in keymaps for now
Diffstat (limited to 'users/rupa/unicode.c')
-rw-r--r--[-rwxr-xr-x] | users/rupa/unicode.c | 167 |
1 files changed, 148 insertions, 19 deletions
diff --git a/users/rupa/unicode.c b/users/rupa/unicode.c index 89a0d47665..2302a95552 100755..100644 --- a/users/rupa/unicode.c +++ b/users/rupa/unicode.c @@ -17,26 +17,155 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "unicode.h" +combined_mode_t combined_mode = CM_NULL; +bool _seeded = false; + #if defined(UNICODEMAP_ENABLE) const uint32_t PROGMEM unicode_map[] = { - [CHEK] = 0x2713, // ✓ - /* - [DI1] = 0x2680, // ⚀ - [DI2] = 0x2681, // ⚁ - [DI3] = 0x2682, // ⚂ - [DI4] = 0x2683, // ⚃ - [DI5] = 0x2684, // ⚄ - [DI6] = 0x2685, // ⚅ - */ - [HAS] = 0x262D, // ☭ - [IBNG] = 0x203D, // ‽ - [IRNY] = 0x2E2E, // ⸮ - [M4] = 0x2669, // ♩ - [M8] = 0x266A, // ♪ - [M8B] = 0x266B, // ♫ - [M16] = 0x266C, // ♬ - [OM] = 0x0950, // ॐ - [STB] = 0x2605, // ★ - [STW] = 0x2606, // ☆ + [CCIR] = 0x20DD, // COMBINING CIRCLE ⃝ + [CENT] = 0x00A2, // ¢ + [CHEK] = 0x2713, // ✓ + [CKEY] = 0x20E3, // COMBINING KEYCAP ⃣ + [CUI] = 0x26A0, // ⚠ + [ECKS] = 0x2716, // ✖ + [EFF] = 0x017F, // ſ + [HAS] = 0x262D, // ☭ + [HUN] = 0x1F4AF, // 💯 + [IBNG] = 0x203D, // ‽ + [IRNY] = 0x2E2E, // ⸮ + [LALL] = 0x2200, // ∀ + [LELM] = 0x2208, // ∈ + [LEXI] = 0x2203, // ∃ + [LPRO] = 0x22A2, // ⊢ + [M4] = 0x2669, // ♩ + [M8] = 0x266A, // ♪ + [M8B] = 0x266B, // ♫ + [M16] = 0x266C, // ♬ + [NEG] = 0x20E0, // COMBINING NO ⃠ + [NOPE] = 0x1F6AB, // 🚫 + [NUM] = 0x2116, // № + [OM] = 0x0950, // ॐ + [SMB] = 0x263A, // ☻ + [SMW] = 0x263B, // ☺ + [STB] = 0x2605, // ★ + [STOP] = 0x26D4, // ⛔ + [STW] = 0x2606, // ☆ }; #endif + +const char *d6_map[] = { + "⚀", "⚁", "⚂", "⚃", "⚄", "⚅" +}; +const char *dance_map[] = { + "〜( ̄▽ ̄〜)", + "(〜 ̄▽ ̄)〜" +}; +const char *dance_more_map[] = { + "ƪ(˘⌣˘)┐", + "┌(˘⌣˘)ʃ" +}; +const char *flip_map[] = { + "(╯°□°)╯︵ ┻━━┻", + "(ノ-_-)ノ・・ ┻━━┻", + "(ノꐦ⊙曲ఠ)ノ彡┻━┻" +}; +const char *flip_back_map[] = { + "┬──┬◡ノ(° -°ノ)", + "┬──┬ノ( ゜-゜ノ)", + "┬──┬ノ(ಠ_ಠノ)" +}; +const char *joy_map[] = { + "ᕕ( ᐛ )ᕗ ", + "٩(ˊᗜˋ*)و", + "٩( ᐛ )و" +}; +const char *joy_harder_map[] = { + "\\\ ٩( ᐛ )و //", + "✧*。٩(ˊᗜˋ*)و✧*。" +}; + +const char *choice(const char *choices[], int size) { + if (_seeded == false) { + srand(timer_read32()); + dprintf("_seeded the roll\n"); + _seeded = true; + } + return choices[rand() % size]; +} + +const char *d6(void) { + return choice(d6_map, 6); +} +const char *dance(bool more) { + if (more) { + return choice(dance_more_map, 2); + } + return choice(dance_map, 2); +} +const char *flip(bool flip_back) { + if (flip_back) { + return choice(flip_back_map, 3); + } + return choice(flip_map, 3); +} +const char *joy(bool harder) { + if (harder) { + return choice(joy_harder_map, 2); + } + return choice(joy_map, 3); +} + +bool u_x(const char *text) { + send_unicode_string(text); + return false; +}; +bool u_xp(bool is_shifted, const char *shifted, const char *plain) { + send_unicode_string(is_shifted ? shifted : plain); + return false; +}; + +void zalgo(void) { + int number = (rand() % (8 + 1 - 2)) + 2; + unsigned int index; + for (index=0; index<number; index++) { + uint16_t hex = (rand() % (0x036F + 1 - 0x0300)) + 0x0300; + register_hex(hex); + } +} + +bool combined_text(uint16_t keycode) { + if (keycode < KC_A || (keycode > KC_0 && keycode < KC_MINUS) || keycode > KC_SLASH) { + return false; + } + tap_code(keycode); + unicode_input_start(); + switch (combined_mode) { + case CM_CIRCLE: + register_hex(0x20DD); + break; + case CM_NO: + register_hex(0x20E0); + break; + case CM_KEYCAP: + register_hex(0x20E3); + break; + case CM_ZALGO: + zalgo(); + break; + default: + break; + } + unicode_input_finish(); + return true; +} + +void cycle_combined_mode(void) { + if (combined_mode++ >= CM_MAX - 1) { + combined_mode = CM_NULL; + } +} + +combined_mode_t set_combined_mode(combined_mode_t mode) { + combined_mode = combined_mode == mode ? CM_NULL : mode; + return combined_mode; +} |