view/demo/tetris: NCOPTION_INHIBIT_SETLOCALE

This commit is contained in:
nick black 2020-05-19 08:52:36 -04:00
parent 818ec25778
commit e5b1c2cdea
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
4 changed files with 8 additions and 2 deletions

View File

@ -282,6 +282,7 @@ handle_opts(int argc, char** argv, notcurses_options* opts, bool* ignore_failure
usage(*argv, EXIT_FAILURE); usage(*argv, EXIT_FAILURE);
} }
} }
opts->flags |= NCOPTION_INHIBIT_SETLOCALE;
const char* spec = argv[optind]; const char* spec = argv[optind];
return spec; return spec;
} }

View File

@ -208,7 +208,9 @@ int main(void){
if(setlocale(LC_ALL, "") == nullptr){ if(setlocale(LC_ALL, "") == nullptr){
return EXIT_FAILURE; return EXIT_FAILURE;
} }
NotCurses nc; notcurses_options nopts{};
nopts.flags = NCOPTION_INHIBIT_SETLOCALE;
NotCurses nc(nopts);
if(!nc.mouse_enable()){ if(!nc.mouse_enable()){
return EXIT_FAILURE; return EXIT_FAILURE;
} }

View File

@ -5,6 +5,7 @@ int main(void) {
srand(time(nullptr)); srand(time(nullptr));
std::atomic_bool gameover = false; std::atomic_bool gameover = false;
notcurses_options ncopts{}; notcurses_options ncopts{};
ncopts.flags = NCOPTION_INHIBIT_SETLOCALE;
ncpp::NotCurses nc(ncopts); ncpp::NotCurses nc(ncopts);
Tetris t{nc, gameover}; Tetris t{nc, gameover};
std::thread tid(&Tetris::Ticker, &t); std::thread tid(&Tetris::Ticker, &t);

View File

@ -191,7 +191,9 @@ auto main(int argc, char** argv) -> int {
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");
float timescale; float timescale;
NCScale stretchmode; NCScale stretchmode;
auto nonopt = handle_opts(argc, argv, NotCurses::default_notcurses_options, &timescale, &stretchmode); notcurses_options nopts{};
auto nonopt = handle_opts(argc, argv, nopts, &timescale, &stretchmode);
nopts.flags |= NCOPTION_INHIBIT_SETLOCALE;
NotCurses nc; NotCurses nc;
if(!nc.can_open_images()){ if(!nc.can_open_images()){
nc.stop(); nc.stop();