add shift indicator (WIP)

This commit is contained in:
Babz 2021-09-01 12:41:58 +02:00
parent f81dd12d7e
commit 49b4a863fe
3 changed files with 8 additions and 4 deletions

View File

@ -29,10 +29,11 @@ static int callback_keypoll(void) {
int main(void) {
const int timer = timer_configure(TIMER_ANY, 15625, GINT_CALL(callback_keypoll));
int tick_ctr = 0;
int shift_state = 0;
while (1) {
tgrid_sets(1, 0, C_WHITE, C_BLACK, LOREM_IPSUM);
set_statusbar(tick_ctr);
set_statusbar(tick_ctr, shift_state);
set_menubar();
tgrid_display();

View File

@ -6,14 +6,17 @@
#include <stdio.h>
#include <string.h>
void set_statusbar(int tick_ctr) {
void set_statusbar(int tick_ctr, int shfit_state) {
// set green bar
for (int i = 0; i < UNS_TERM_COLS; i++)
tgrid_sets(0, i, C_NONE, C_GREEN, " ");
// then add actutal text
char statusbar[UNS_TERM_COLS + 1];
sprintf(statusbar, "↑Aa %d", tick_ctr);
if (shfit_state)
sprintf(statusbar, "↑Aa %d", tick_ctr);
else
sprintf(statusbar, "_Aa %d", tick_ctr);
tgrid_sets(0, 0, C_BLACK, C_GREEN, statusbar);
}

View File

@ -1,7 +1,7 @@
#ifndef UNS_UI_H
#define UNS_UI_H
void set_statusbar(int tick_ctr);
void set_statusbar(int tick_ctr, int shift_state);
extern char fnkeys[6][11];
void set_menubar(void);