77
88
99extern void setupConsole (void );
10+ extern void restoreConsoleMode (void );
1011extern void restoreConsole (void );
1112
1213Win winVerifyer (int grid [6 ][7 ])
@@ -186,23 +187,23 @@ void supergridPrinter(char supergrid[37][98], int grid[6][7], Move winCoordinate
186187 for (int count = 0 ; count < 4 ; count ++ )
187188 {
188189 if (winCoordinates [count ].col == gridJ && winCoordinates [count ].row == gridI )
189- setBackgroundColorBright ( WHITE_BKG );
190+ setBackgroundColorRGB ( 50 , 50 , 50 );
190191 }
191192 printf ("%c" , supergrid [i ][j ]);
192193 setTextColor (WHITE_TXT );
193- setBackgroundColor ( BLACK_BKG );
194+ setBackgroundColorRGB ( 20 , 20 , 20 );
194195 }
195196 if (grid [gridI ][gridJ ] == -1 )
196197 {
197198 setTextColorBright (RED_TXT );
198199 for (int count = 0 ; count < 4 ; count ++ )
199200 {
200201 if (winCoordinates [count ].col == gridJ && winCoordinates [count ].row == gridI )
201- setBackgroundColor ( WHITE_BKG );
202+ setBackgroundColorRGB ( 50 , 50 , 50 );
202203 }
203204 printf ("%c" , supergrid [i ][j ]);
204205 setTextColor (WHITE_TXT );
205- setBackgroundColor ( BLACK_BKG );
206+ setBackgroundColorRGB ( 20 , 20 , 20 );
206207 }
207208 if (grid [gridI ][gridJ ] == 0 )
208209 printf ("%c" , supergrid [i ][j ]);
@@ -283,8 +284,39 @@ int main(int argc, char* argv)
283284 int grid [6 ][7 ] = { 0 };
284285 char supergrid [37 ][98 ];
285286
286- printf ("\n" );
287+ printf ("Test Mode?\n" );
288+ int test_mode ;
289+ test_mode = getchar ();
290+ while (test_mode == '1' )
291+ {
292+ int r , g , b , text ;
293+ bool textColor ;
294+ printf ("Red __ Green __ Blue __\n" );
295+ scanf (" %i %i %i" , & r , & g , & b );
296+ if (r == -1 || g == -1 || b == -1 )
297+ break ;
298+ printf (" True - Blue, False - Red\n" );
299+ scanf (" %d" , & text );
300+ textColor = text ;
301+ if (textColor == true)
302+ setTextColor (BLUE_TXT );
303+ else
304+ setTextColor (RED_TXT );
305+ setBackgroundColorRGB (r , g , b );
306+ char circle [5 ][12 ] = { { ' ' , ' ' , ' ' , '.' , '-' , '\"' , '\"' , '-' , '.' , ' ' , ' ' , ' ' },
307+ { ' ' , ' ' , '/' , ' ' , ' ' , ' ' , ' ' , ' ' , ' ' , '\\' , ' ' , ' ' },
308+ { ' ' , ';' , ' ' , ' ' , ' ' , ' ' , ' ' , ' ' , ' ' , ' ' , ';' , ' ' },
309+ { ' ' , ' ' , '\\' , ' ' , ' ' , ' ' , ' ' , ' ' , ' ' , '/' , ' ' , ' ' },
310+ { ' ' , ' ' , ' ' , '\'' , '-' , '.' , '.' , '-' , '\'' , ' ' , ' ' , ' ' } };
311+ for (int i = 0 ; i < 5 ; i ++ )
312+ {
313+ for (int j = 0 ; j < 12 ; j ++ )
314+ printf ("%c" , circle [i ][j ]);
315+ printf ("\n" );
316+ }
317+
287318
319+ }
288320
289321 for (bool mainMenu = true; mainMenu == true;)
290322 {
@@ -294,6 +326,38 @@ int main(int argc, char* argv)
294326 char playerMovement [3 ];
295327 Win winVerifyerReturn ;
296328 Move winCoordinates [4 ];
329+ bool isMaximazed = false;
330+ setupConsole ();
331+ setBackgroundColorRGB (20 , 20 , 20 );
332+ printf ("Você vai precisar maximizar a janela do console para poder jogar\n" );
333+ printf ("Gostaria de testar pra ver se está funcionando? s- sim n- não\n" );
334+ restoreConsoleMode ();
335+ if (getchar () == 's' )
336+ {
337+ supergridGenerator (supergrid );
338+ for (int i = 0 ; i < 6 ; i ++ )
339+ {
340+ for (int j = 0 ; j < 7 ; j ++ )
341+ grid [i ][j ] = 0 ;
342+ }
343+ setupConsole ();
344+ setBackgroundColorRGB (20 , 20 , 20 );
345+ moveTo (0 , 0 );
346+ clearScreenToBottom ();
347+ moveTo (0 , 0 );
348+ supergridPrinter (supergrid , grid , winCoordinates );
349+ printf ("\n\n\n\n" );
350+ supergridPrinter (supergrid , grid , winCoordinates );
351+ restoreConsoleMode ();
352+ printf ("\nEsses dois tabuleiros foram impressos iguais? s- sim n- não\n" );
353+ if (getchar () == 's' )
354+ {
355+ printf ("Confirmado, executando modo expandido!\n" );
356+ isMaximazed = true;
357+ }
358+ printf ("Bem, aparentemente não. Caso você errou o teste você pode reiniciar o programa\n" );
359+
360+ }
297361 printf ("Gostaria de jogar o modo: 1- Singleplyer ou 2- Multiplayer\n" );
298362 if (scanf ("%i" , & player ) == 1 );
299363
@@ -317,12 +381,25 @@ int main(int argc, char* argv)
317381 if (player == 3 )
318382 player = 1 ;
319383 setupConsole ();
320- printf ("/033[90" );
384+ setBackgroundColorRGB (20 , 20 , 20 );
385+ if (isMaximazed == true)
386+ {
387+ moveTo (0 , 0 );
388+ clearScreenToBottom ();
389+ moveTo (0 , 0 );
390+ }
391+ else
392+ clearScreen ();
321393 supergridPrinter (supergrid , grid , winCoordinates );
322- restoreConsole ();
394+ restoreConsoleMode ();
323395 printf ("Jogue jogador %i\n" , player );
324396 if (scanf (" %i" , & playerMove .col ) == 1 );
325397 playerMove .col -- ;
398+ if (playerMove .col > 6 || playerMove .col < 0 )
399+ {
400+ printf ("Fora de Alcance!" );
401+ continue ;
402+ }
326403 getTheRow (grid , & playerMove );
327404 if (playerMove .row == -1 )
328405 {
@@ -385,7 +462,7 @@ int main(int argc, char* argv)
385462 if (scanf (" %c" , & keepPlaying ) == 1 )
386463 continue ;
387464 printf ("Voltar ao menu principal? s-sim n-não\n" );
388- if ( getchar () == '\n' );
465+ getchar ();
389466 if (getchar () == 'n' )
390467 mainMenu = false;
391468 }
0 commit comments