Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Get keyboard processing going, sorta. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | ams/sdl1 |
Files: | files | file ages | folders |
SHA3-256: |
27e79faddf67a12b2b919c2d4e440cef |
User & Date: | ams 2024-06-04 18:07:28 |
Context
2024-06-05
| ||
07:40 | ucfg.c: Initialize default SDL2 mapping. check-in: e3862ddf7f user: ams tags: ams/sdl1 | |
2024-06-04
| ||
18:07 | Get keyboard processing going, sorta. check-in: 27e79faddf user: ams tags: ams/sdl1 | |
17:59 | sdl2.c: Boiler plate for keyboard code. check-in: 7399fa5f2a user: ams tags: ams/sdl1 | |
Changes
Changes to mouse.c.
︙ | ︙ | |||
32 33 34 35 36 37 38 | #define DTP_FIX_VAL(x) ((x) & ((1 << 24) - 1)) #define DTP_FIX(x) (DTP_FIX_VAL(x) | 5 << 25) #define INTERN(x,y) if (sym_find(&sym_mcr, x, &y)) errx(1, "can't find %s in microcode symbols", x) void mouse_event(int x, int y, int buttons) { | | | | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | #define DTP_FIX_VAL(x) ((x) & ((1 << 24) - 1)) #define DTP_FIX(x) (DTP_FIX_VAL(x) | 5 << 25) #define INTERN(x,y) if (sym_find(&sym_mcr, x, &y)) errx(1, "can't find %s in microcode symbols", x) void mouse_event(int x, int y, int buttons) { printf("mouse_event(x = 0%o, y = 0%o, buttons = 0%o)\n", x, y, buttons); idle_mouse_activity(); iob_csr |= 1 << 4; assert_unibus_interrupt(0264); amem[a_mouse_x] = DTP_FIX(x); amem[a_mouse_y] = DTP_FIX(y); amem[a_mouse_wakeup] = amem[a_v_true]; if (buttons == 1) mouse_tail ^= 1; if (buttons == 2) mouse_middle ^= 1; if (buttons == 3) mouse_head ^= 1; printf("mouse_event() - mouse = (0%o, 0%o), mouse (raw) = (0%o, 0%o), h/m/t = %d%d%d\n", mouse_x, mouse_y, mouse_rawx, mouse_rawy, mouse_head, mouse_middle, mouse_tail); } void mouse_poll(void) { static int prevstate; int state; |
︙ | ︙ |
Changes to sdl2.c.
︙ | ︙ | |||
66 67 68 69 70 71 72 | u_minh = 0x7fffffff; u_maxh = 0; u_minv = 0x7fffffff; u_maxv = 0; } static void | | | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | u_minh = 0x7fffffff; u_maxh = 0; u_minv = 0x7fffffff; u_maxv = 0; } static void process_key(SDL_KeyboardEvent e, int keydown) { // KeySym keysym; // SDLKey keycode; int bi; unsigned char buf[5]; |
︙ | ︙ | |||
106 107 108 109 110 111 112 | // knight_process_bucky(x11_modifier_map[Mod2MapIndex], &bi); // if (e->xkey.state & Mod3Mask) // knight_process_bucky(x11_modifier_map[Mod3MapIndex], &bi); // if (e->xkey.state & Mod4Mask) // knight_process_bucky(x11_modifier_map[Mod4MapIndex], &bi); // if (e->xkey.state & Mod5Mask) // knight_process_bucky(x11_modifier_map[Mod5MapIndex], &bi); | | | | | | | | | | | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | // knight_process_bucky(x11_modifier_map[Mod2MapIndex], &bi); // if (e->xkey.state & Mod3Mask) // knight_process_bucky(x11_modifier_map[Mod3MapIndex], &bi); // if (e->xkey.state & Mod4Mask) // knight_process_bucky(x11_modifier_map[Mod4MapIndex], &bi); // if (e->xkey.state & Mod5Mask) // knight_process_bucky(x11_modifier_map[Mod5MapIndex], &bi); knight_process_key(e.keysym.sym, bi, keydown, sdl2_kbd_map, sdl2_modifier_map); } else { // bi = sdl2_bucky(e.keysym.sym); bi = -1; cadet_process_key(e.keysym.sym, bi, keydown, sdl2_kbd_map, sdl2_modifier_map); } } void sdl2_event(void) { SDL_Event ev; send_accumulated_updates(); kbd_dequeue_key_event(); while (SDL_PollEvent(&ev)) { switch (ev.type) { case SDL_WINDOWEVENT: SDL_UpdateTexture(texture, NULL, tv_bitmap, tv_width * sizeof (Uint32)); // flush SDL_RenderClear(renderer); SDL_RenderCopy(renderer, texture, NULL, NULL); SDL_RenderPresent(renderer); break; case SDL_KEYDOWN: process_key(ev.key, 1); break; case SDL_KEYUP: process_key(ev.key, 0); break; case SDL_MOUSEMOTION: case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONUP: mouse_event(ev.button.x, ev.button.y, ev.button.button); break; case SDL_QUIT: exit(0); break; } } } |
︙ | ︙ | |||
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | NOTICE(TRACE_USIM, "tv: using SDL backend for monitor and keyboard\n"); Foreground = 0xffffff; // White Background = 0x000000; // Black SDL_CreateWindowAndRenderer(tv_width, tv_height, SDL_WINDOW_OPENGL, &window, &renderer); // SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); // SDL_RenderClear(renderer); // SDL_RenderPresent(renderer); SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear"); // make the scaled rendering look smoother. SDL_RenderSetLogicalSize(renderer, tv_width, tv_height); texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, tv_width, tv_height); } | > | 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | NOTICE(TRACE_USIM, "tv: using SDL backend for monitor and keyboard\n"); Foreground = 0xffffff; // White Background = 0x000000; // Black SDL_CreateWindowAndRenderer(tv_width, tv_height, SDL_WINDOW_OPENGL, &window, &renderer); SDL_ShowCursor(0); /* Invisible cursor. */ // SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); // SDL_RenderClear(renderer); // SDL_RenderPresent(renderer); SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear"); // make the scaled rendering look smoother. SDL_RenderSetLogicalSize(renderer, tv_width, tv_height); texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, tv_width, tv_height); } |