figured out how to use buggy scroll_view
This commit is contained in:
2
dependencies/tim
vendored
2
dependencies/tim
vendored
Submodule dependencies/tim updated: ee6375f553...5ef7f91764
@@ -48,17 +48,23 @@ void ClientCLI_run(ClientCLI* self) {
|
||||
|
||||
while(tim_run(FPS)){
|
||||
switch(self->state){
|
||||
case ClientCLIState_Exit:
|
||||
Return;
|
||||
default:
|
||||
assert(false && "invalid ClientCLI state");
|
||||
break;
|
||||
case ClientCLIState_Exit:
|
||||
Return;
|
||||
case ClientCLIState_StartScreen:
|
||||
start_screen(&start_screen_ctx);
|
||||
break;
|
||||
case ClientCLIState_MainScreen:
|
||||
main_screen(&main_screen_ctx);
|
||||
break;
|
||||
// case ClientCLIState_ListOfServers:
|
||||
// break;
|
||||
// case ClientCLIState_ServerChannels:
|
||||
// break;
|
||||
// case ClientCLIState_ChannelScreen:
|
||||
// break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,9 @@ typedef enum ClientCLIState {
|
||||
ClientCLIState_StartScreen,
|
||||
ClientCLIState_Exit,
|
||||
ClientCLIState_MainScreen,
|
||||
ClientCLIState_ListOfServers,
|
||||
ClientCLIState_ServerChannels,
|
||||
ClientCLIState_ChannelChat,
|
||||
ClientCLIState_ChannelScreen,
|
||||
} ClientCLIState;
|
||||
|
||||
typedef struct ClientCLI {
|
||||
|
||||
@@ -52,7 +52,7 @@ void MainScreenContext_construct(MainScreenContext* ctx, ClientCLI* client){
|
||||
// central_scroll_view //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
{
|
||||
ctx->central_scroll_view.content_h = 50;
|
||||
ctx->central_scroll_view.content_h = 48;
|
||||
ctx->central_scroll_view.data = ctx;
|
||||
ctx->central_scroll_view.draw = draw_central_panel;
|
||||
}
|
||||
@@ -63,18 +63,28 @@ void MainScreenContext_destroy(MainScreenContext* ctx){
|
||||
}
|
||||
|
||||
void main_screen(MainScreenContext* ctx){
|
||||
u8 fg = ctx->client->style.common.fg;
|
||||
u8 bg = ctx->client->style.common.bg;
|
||||
TimStyle style_inverted = {.bg = fg, .fg = bg, .brd = bg};
|
||||
// fill screen
|
||||
if (tim->event.type == TimEvent_Draw) {
|
||||
tim_fill(tim_cell(" ", ctx->client->style.common.fg, ctx->client->style.common.bg), 0, 0, A, A);
|
||||
tim_fill(tim_cell(" ", fg, bg), 0, 0, A, A);
|
||||
}
|
||||
|
||||
tim_scroll_view(&ctx->central_scroll_view, 0, 2, ~0, ~0, ctx->client->style.common);
|
||||
|
||||
if(tim_button_noborder("[Esc/Q] Exit", 1, 0, 14, 1, ctx->client->style.common)
|
||||
|| tim_is_key_press('q')
|
||||
|| tim_is_key_press(TimKey_Escape))
|
||||
// paint over buggy items escaping from panel when it is scrolled down
|
||||
if (tim->event.type == TimEvent_Draw) {
|
||||
tim_draw_row(tim_cell(" ", fg, bg), 0, 0, A);
|
||||
tim_draw_row(tim_cell("─", fg, bg), 0, 1, A);
|
||||
}
|
||||
|
||||
// upper buttons
|
||||
if(tim_button_noborder("[Esc/Q] Exit", 0, 0, 14, 1, style_inverted)
|
||||
|| tim_is_key_press('q') || tim_is_key_press(TimKey_Escape))
|
||||
{
|
||||
ctx->client->state = ClientCLIState_Exit;
|
||||
}
|
||||
|
||||
tim_scroll_view(&ctx->central_scroll_view, 0, 1, ~0, ~0, ctx->client->style.common);
|
||||
}
|
||||
|
||||
static void draw_test_label(void* data, TimRect place, bool is_selected){
|
||||
|
||||
Reference in New Issue
Block a user