Skip to content

Commit aa05f88

Browse files
Update menu, minor QoL tweaks
1 parent e839a1f commit aa05f88

File tree

3 files changed

+123
-18
lines changed

3 files changed

+123
-18
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
CROSSCXX := x86_64-w64-mingw32-g++
2+
3+
main:
4+
$(CROSSCXX) src/main.cpp src/ui.cpp src/wordparser.cpp -Wall -Wno-sign-compare -O2 -o main.exe

src/main.cpp

Lines changed: 119 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ int game()
387387
{
388388
term_deinit();
389389
cout << "Word list not found, exiting...\n";
390+
term_getch();
390391
exit(1);
391392
}
392393

@@ -751,6 +752,7 @@ int game()
751752

752753
int main() // menu
753754
{
755+
init:
754756
term_init();
755757

756758
short term_maxx, term_maxy;
@@ -759,40 +761,140 @@ int main() // menu
759761

760762
if (term_maxx<60||term_maxy<25) return -1;
761763

762-
cout << "███╗ ███╗ ███████╗ ███╗ ██╗ ██╗ ██╗\n";
764+
term_moveCursor(term_maxx/2-20, term_maxy/2-10);
765+
cout << " _______ _______ _\n";
763766
Sleep(200);
764-
cout << "████╗ ████║ ██╔════╝ ████╗ ██║ ██║ ██║\n";
767+
term_moveCursor(term_maxx/2-20, term_maxy/2-9);
768+
cout << "( ) ( ____ \\ ( ( /| |\\ /|\n";
765769
Sleep(200);
766-
cout << "██╔████╔██║ █████╗ ██╔██╗ ██║ ██║ ██║\n";
770+
term_moveCursor(term_maxx/2-20, term_maxy/2-8);
771+
cout << "| () () | | ( \\/ | \\ ( | | ) ( |\n";
767772
Sleep(200);
768-
cout << "██║╚██╔╝██║ ██╔══╝ ██║╚██╗██║ ██║ ██║\n";
773+
term_moveCursor(term_maxx/2-20, term_maxy/2-7);
774+
cout << "| || || | | (__ | \\ | | | | | |\n";
769775
Sleep(200);
770-
cout << "██║ ╚═╝ ██║ ███████╗ ██║ ╚████║ ╚██████╔╝\n";
776+
term_moveCursor(term_maxx/2-20, term_maxy/2-6);
777+
cout << "| |(_)| | | __) | (\\ \\) | | | | |\n";
771778
Sleep(200);
772-
cout << "╚═╝ ╚═╝ ╚══════╝ ╚═╝ ╚═══╝ ╚═════╝\n";
779+
term_moveCursor(term_maxx/2-20, term_maxy/2-5);
780+
cout << "| | | | | ( | | \\ | | | | |\n";
781+
Sleep(200);
782+
term_moveCursor(term_maxx/2-20, term_maxy/2-4);
783+
cout << "| ) ( | | (____/\\ | ) \\ | | (___) |\n";
784+
Sleep(200);
785+
term_moveCursor(term_maxx/2-20, term_maxy/2-3);
786+
cout << "|/ \\| (_______/ |/ )_) (_______)\n";
773787

774788
Sleep(200);
789+
term_moveCursor(term_maxx/2-31, term_maxy/2);
775790
cout << "==============================================================\n";
776-
Sleep(300);
777-
cout << " 1) Start\n";
778-
Sleep(300);
779-
cout << " 2) Quit\n";
780-
Sleep(300);
781-
cout << " 3) Creators\n";
782791
Sleep(200);
792+
term_moveCursor(term_maxx/2-4, term_maxy/2+2);
793+
cout << "1) Start";
794+
Sleep(200);
795+
term_moveCursor(term_maxx/2-4, term_maxy/2+3);
796+
cout << "2) Quit";
797+
Sleep(200);
798+
term_moveCursor(term_maxx/2-4, term_maxy/2+4);
799+
cout << "3) Rules";
800+
Sleep(200);
801+
term_moveCursor(term_maxx/2-4, term_maxy/2+5);
802+
cout << "4) Controls";
803+
Sleep(200);
804+
term_moveCursor(term_maxx/2-4, term_maxy/2+6);
805+
cout << "5) Creators";
806+
Sleep(200);
807+
term_moveCursor(term_maxx/2-31, term_maxy/2+8);
783808
cout << "==============================================================\n";
784809

785810
int result;
786-
if (term_getch()=='1')
787-
result = game();
788-
else // temp
811+
switch(term_getch())
789812
{
790-
term_deinit();
791-
return 0;
813+
case '1':
814+
{
815+
result = game();
816+
break;
817+
}
818+
case '3':
819+
{
820+
term_clear();
821+
term_moveCursor(term_maxx/2-4, term_maxy/2-10);
822+
cout << "Scrabble";
823+
term_moveCursor(term_maxx/2-20, term_maxy/2-8);
824+
cout << "The goal of the game is to get points";
825+
term_moveCursor(term_maxx/2-20, term_maxy/2-7);
826+
cout << "by using the letters you have. You win";
827+
term_moveCursor(term_maxx/2-20, term_maxy/2-6);
828+
cout << "when there are no more letters left.";
829+
term_moveCursor(term_maxx/2-20, term_maxy/2-5);
830+
cout << "You can move only to tiles with letters";
831+
term_moveCursor(term_maxx/2-20, term_maxy/2-4);
832+
cout << "in or next to them. You can see your";
833+
term_moveCursor(term_maxx/2-20, term_maxy/2-3);
834+
cout << "hand below the playfield. During your";
835+
term_moveCursor(term_maxx/2-20, term_maxy/2-2);
836+
cout << "turn, you can do either:";
837+
term_moveCursor(term_maxx/2-20, term_maxy/2-1);
838+
cout << "1. Place one or more letters to form";
839+
term_moveCursor(term_maxx/2-20, term_maxy/2);
840+
cout << "one or more words";
841+
term_moveCursor(term_maxx/2-20, term_maxy/2+1);
842+
cout << "2. Pass the turn and get zero points";
843+
term_moveCursor(term_maxx/2-20, term_maxy/2+2);
844+
cout << "3. Exchange some letters for new ones";
845+
term_moveCursor(term_maxx/2-20, term_maxy/2+3);
846+
cout << "Good luck and have fun!";
847+
term_getch();
848+
goto init;
849+
}
850+
case '4':
851+
{
852+
term_clear();
853+
term_moveCursor(term_maxx/2-15, term_maxy/2-3);
854+
cout << "Arrow keys - move on the field";
855+
term_moveCursor(term_maxx/2-15, term_maxy/2-2);
856+
cout << "Letter - choose / place a letter";
857+
term_moveCursor(term_maxx/2-15, term_maxy/2-1);
858+
cout << "Enter - calculate score";
859+
term_moveCursor(term_maxx/2-15, term_maxy/2);
860+
cout << "Space - pass your turn";
861+
term_moveCursor(term_maxx/2-15, term_maxy/2+1);
862+
cout << "Ctrl-R - exchange letters";
863+
term_moveCursor(term_maxx/2-15, term_maxy/2+2);
864+
cout << "Backspace - return a letter";
865+
term_moveCursor(term_maxx/2-15, term_maxy/2+3);
866+
cout << "Ctrl-C - finish the game";
867+
term_getch();
868+
goto init;
869+
}
870+
case '5':
871+
{
872+
term_clear();
873+
term_moveCursor(term_maxx/2-16, term_maxy/2-2);
874+
cout << "Scrum Leader - SAKostin";
875+
Sleep(200);
876+
term_moveCursor(term_maxx/2-16, term_maxy/2-1);
877+
cout << "Backend Developer - SVRomanchenko";
878+
Sleep(200);
879+
880+
term_moveCursor(term_maxx/2-16, term_maxy/2+1);
881+
cout << "Frontend Developer - OVBondarenko";
882+
Sleep(200);
883+
term_moveCursor(term_maxx/2-16, term_maxy/2+2);
884+
cout << "Designer - SAChapkina";
885+
term_getch();
886+
goto init;
887+
}
888+
default:
889+
{
890+
term_deinit();
891+
return 0;
892+
}
792893
}
793894

794895
term_deinit();
795896

796897
cout << "Player " << result+1 << " won!\n";
898+
term_getch();
797899
return 0;
798900
}

src/ui.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ void term_init()
3333
void term_deinit()
3434
{
3535
term_resetColorPair();
36-
term_clear();
3736
term_moveCursor(0,0);
3837
}
3938

0 commit comments

Comments
 (0)