void ICACHE_FLASH_ATTR u8g_DrawCursor(u8g_t *u8g) { const u8g_pgm_uint8_t *font; uint8_t color; uint8_t encoding = u8g->cursor_encoding; /* get current values */ color = u8g_GetColorIndex(u8g); font = u8g->font; /* draw cursor */ u8g->font = u8g->cursor_font; encoding++; u8g_SetColorIndex(u8g, u8g->cursor_bg_color); /* 27. Jan 2013: replaced call to u8g_DrawGlyph with call to u8g_draw_glyph */ /* required, because y adjustment should not happen to the cursor fonts */ u8g_draw_glyph(u8g, u8g->cursor_x, u8g->cursor_y, encoding); encoding--; u8g_SetColorIndex(u8g, u8g->cursor_fg_color); /* 27. Jan 2013: replaced call to u8g_DrawGlyph with call to u8g_draw_glyph */ /* required, because y adjustment should not happen to the cursor fonts */ /* u8g_DrawGlyph(u8g, u8g->cursor_x, u8g->cursor_y, encoding); */ u8g_draw_glyph(u8g, u8g->cursor_x, u8g->cursor_y, encoding); /* restore previous values */ u8g->font = font; u8g_SetColorIndex(u8g, color); }
// Lua: int = u8g.getColorIndex( self ) static int lu8g_getColorIndex( lua_State *L ) { lu8g_userdata_t *lud; if ((lud = get_lud( L )) == NULL) return 0; lua_pushinteger( L, u8g_GetColorIndex( LU8G ) ); return 1; }