/// <summary> /// Draws the game to the Window. /// </summary> /// <param name="myGame">The details of the game -- mostly top card and scores.</param> private static void DrawGame(Snap myGame) { SwinGame.DrawBitmap("cardsBoard.png", 0, 0); // Draw the top card Card top = myGame.TopCard; if (top != null) { SwinGame.DrawText("Top Card is " + top.ToString(), Color.White, "GameFont", 0, 20); SwinGame.DrawText("Player 1 score: " + myGame.Score(0), Color.White, "GameFont", 0, 40); SwinGame.DrawText("Player 2 score: " + myGame.Score(1), Color.White, "GameFont", 0, 60); SwinGame.DrawCell(SwinGame.BitmapNamed("Cards"), top.CardIndex, 521, 153); } else { SwinGame.DrawText("No card played yet...", Color.RoyalBlue, 0, 20); } // Draw the back of the cards... to represent the deck SwinGame.DrawCell(SwinGame.BitmapNamed("Cards"), 52, 155, 153); //Draw onto the screen SwinGame.RefreshScreen(60); }
/// <summary> /// Displays a message to the user /// </summary> private static void ShowMessage(string message, int number) { const int Tx = 310; const int Ty = 493; const int Tw = 200; const int Th = 25; const int Steps = 5; const int Bg_X = 279; const int Bg_Y = 453; int fullW; Rectangle toDraw = new Rectangle(); fullW = 260 * number / Steps; SwinGame.DrawBitmap(_LoaderEmpty, Bg_X, Bg_Y); SwinGame.DrawCell(_LoaderFull, 0, Bg_X, Bg_Y); toDraw.X = Tx; toDraw.Y = Ty; toDraw.Width = Tw; toDraw.Height = Th; SwinGame.DrawText(message, Color.White, Color.Transparent, _LoadingFont, FontAlignment.AlignCenter, toDraw); SwinGame.RefreshScreen(); SwinGame.ProcessEvents(); }
private static void ShowMessage(string message, int number) { const int TX = 310; const int TY = 493; const int TW = 200; const int TH = 25; const int STEPS = 5; const int BG_X = 279; const int BG_Y = 453; int fullW; Rectangle toDraw; fullW = 260 * number / STEPS; SwinGame.DrawBitmap(_LoaderEmpty, BG_X, BG_Y); SwinGame.DrawCell(_LoaderFull, 0, BG_X, BG_Y); // SwinGame.DrawBitmapPart(_LoaderFull, 0, 0, fullW, 66, BG_X, BG_Y) toDraw.X = TX; toDraw.Y = TY; toDraw.Width = TW; toDraw.Height = TH; SwinGame.DrawTextLines(message, Color.White, Color.Transparent, _LoadingFont, FontAlignment.AlignCenter, toDraw); // SwinGame.DrawTextLines(message, Color.White, Color.Transparent, _LoadingFont, FontAlignment.AlignCenter, TX, TY, TW, TH) SwinGame.RefreshScreen(); SwinGame.ProcessEvents(); }
/// <summary> /// Draws the game to the Window. /// </summary> /// <param name="myGame">The details of the game -- mostly top card and scores.</param> private static void DrawGame(Snap myGame) { SwinGame.DrawBitmap("cardsBoard.png", 0, 0); // Draw the top card Card top = myGame.TopCard; if (top != null) { SwinGame.LoadFontNamed("GameFont", "Chunkfive.otf", 24); SwinGame.DrawText("Top Card is " + top.ToString(), Color.RoyalBlue, 0, 20); SwinGame.DrawText("Player 1 score: " + myGame.Score(0), Color.RoyalBlue, 0, 30); SwinGame.DrawText("Player 2 score: " + myGame.Score(1), Color.RoyalBlue, 0, 40); SwinGame.DrawCell(SwinGame.BitmapNamed("Cards"), top.CardIndex, 521, 153); SwinGame.LoadSoundEffectNamed("Slap1", "slap1.wav"); SwinGame.PlaySoundEffect("Slap1"); SwinGame.DrawText("Player 1 score:" + myGame.Score(0), Color.Red, "GameFont", 0, 30); SwinGame.DrawText("Player 2 score: " + myGame.Score(1), Color.RoyalBlue, "GameFont", 0, 40); SwinGame.DrawCell(SwinGame.BitmapNamed("Cards"), top.CardIndex, 350, 50); } else { SwinGame.DrawText("No card played yet...", Color.RoyalBlue, 0, 20); } // Draw the back of the cards... to represent the deck SwinGame.DrawCell(SwinGame.BitmapNamed("Cards"), 52, 155, 153); SwinGame.DrawCell(SwinGame.BitmapNamed("Cards"), 52, 160, 50); SwinGame.LoadSoundEffectNamed("Slap2", "slap2.wav"); SwinGame.PlaySoundEffect("Slap2"); //Draw onto the screen SwinGame.RefreshScreen(60); }
private static void ShowMessage(string message, int number) { const int BG_Y = 453; const int TX = 310; const int TY = 493; const int TW = 200; const int TH = 25; const int BG_X = 279; // const int STEPS = 5; SwinGame.DrawBitmap(_loaderEmpty, BG_X, BG_Y); SwinGame.DrawCell(_loaderFull, 0, BG_X, BG_Y); // TODO(Xavier): This is not supported, find alternative // int fullW = (260 * number) / STEPS; // SwinGame.DrawBitmapPart(_LoaderFull, 0, 0, fullW, 66, BG_X, BG_Y) Rectangle toDraw = new Rectangle(); toDraw.X = TX; toDraw.Y = TY; toDraw.Width = TW; toDraw.Height = TH; // SwinGame.DrawTextLines (message, Color.White, Color.Transparent, _LoadingFont, FontAlignment.AlignCenter, toDraw); // SwinGame.DrawTextLines(message, Color.White, Color.Transparent, _LoadingFont, FontAlignment.AlignCenter, TX, TY, TW, TH) SwinGame.DrawText(message, Color.White, Color.Transparent, _loadingFont, FontAlignment.AlignCenter, toDraw); SwinGame.DrawText(message, Color.White, Color.Transparent, _loadingFont, FontAlignment.AlignCenter, toDraw); SwinGame.RefreshScreen(); SwinGame.ProcessEvents(); }
/// <summary> /// Draws the game to the Window. /// </summary> /// <param name="myGame">The details of the game -- mostly top card and scores.</param> private static void DrawGame(Snap myGame) { SwinGame.DrawBitmap("cardsBoard.png", 0, 0); SwinGame.LoadFontNamed("GameFont", "Chunk.otf", 24); SwinGame.LoadFontNamed("TopFont", "Chunk.otf", 32); SwinGame.LoadFontNamed("StartFont", "Chunk.otf", 24); // Draw the top card Card top = myGame.TopCard; if (top != null) { SwinGame.DrawText("Top Card is " + top.ToString(), Color.Red, "TopFont", 310, 105); SwinGame.DrawText("Player 1 score: " + myGame.Score(0), Color.White, "GameFont", 45, 40); SwinGame.DrawText("Player 2 score: " + myGame.Score(1), Color.White, "GameFont", 625, 40); SwinGame.DrawCell(SwinGame.BitmapNamed("Cards"), top.CardIndex, 565, 225); } else { SwinGame.DrawText("No card played yet...", Color.Red, "StartFont", 10, 10); } // Draw the back of the cards... to represent the deck SwinGame.DrawCell(SwinGame.BitmapNamed("Cards"), 52, 200, 230); //Draw onto the screen SwinGame.RefreshScreen(60); }
/// <summary> /// Draws the game to the Window. /// </summary> /// <param name="myGame">The details of the game -- mostly top card and scores.</param> private static void DrawGame(Snap myGame) { //SwinGame.ClearScreen(Color.White); SwinGame.DrawBitmap("cardsBoard.png", 0, 0); //Load Chunkfive font SwinGame.LoadFontNamed("GameFont", "chunkfive.otf", 24); // Draw the top card Card top = myGame.TopCard; if (top != null) { SwinGame.DrawText("Top Card is " + top.ToString(), Color.WhiteSmoke, 0, 10); SwinGame.DrawText("" + myGame.Score(0), Color.White, "GameFont", 77, 52); SwinGame.DrawText("" + myGame.Score(1), Color.White, "GameFont", 769, 55); SwinGame.DrawCell(SwinGame.BitmapNamed("Cards"), top.CardIndex, 521, 153); } else { SwinGame.DrawText("No card played yet...", Color.WhiteSmoke, 0, 10); } // Draw the back of the cards... to represent the deck SwinGame.DrawCell(SwinGame.BitmapNamed("Cards"), 52, 155, 153); //Draw onto the screen SwinGame.RefreshScreen(60); }
/// <summary> /// Draws the game to the Window. /// </summary> /// <param name="myGame">The details of the game -- mostly top card and scores.</param> private static void DrawGame(Snap myGame) { SwinGame.ClearScreen(Color.White); SwinGame.DrawBitmap("cardsBoard.png", 0, 0); // Draw the top card Card top = myGame.TopCard; if (top != null) { SwinGame.DrawText("Top Card is " + top.ToString(), Color.RoyalBlue, 0, 20); SwinGame.DrawText("Player 1 score: " + myGame.Score(0), Color.RoyalBlue, 0, 30); SwinGame.DrawText("Player 2 score: " + myGame.Score(1), Color.RoyalBlue, 0, 40); SwinGame.DrawCell(SwinGame.BitmapNamed("Cards"), top.CardIndex, 565, 226); SwinGame.DrawText("" + myGame.Score(0), Color.White, "GameFont", 75, 50); // let the score color become white// SwinGame.DrawText("" + myGame.Score(1), Color.White, "GameFont", 765, 55); } else { SwinGame.DrawText("No card played yet...", Color.RoyalBlue, 0, 20); } SwinGame.DrawCell(SwinGame.BitmapNamed("Cards"), 52, 200, 225); // Draw the back of the cards... to represent the deck //Draw onto the screen SwinGame.RefreshScreen(60); }
/// <summary> /// Draws the game to the Window. /// </summary> /// <param name="myGame">The details of the game -- mostly top card and scores.</param> private static void DrawGame(Snap myGame) { SwinGame.ClearScreen(Color.White); // Draw the top card Card top = myGame.TopCard; if (top != null) { SwinGame.DrawText("Top Card is " + top.ToString(), Color.RoyalBlue, Chunkfive, 0, 20); SwinGame.DrawText("Player 1 score: " + myGame.Score(0), Color.RoyalBlue, Chunkfive, 0, 30); SwinGame.DrawText("Player 2 score: " + myGame.Score(1), Color.RoyalBlue, Chunkfive, 0, 40); SwinGame.DrawCell(SwinGame.BitmapNamed("Cards"), top.CardIndex, 350, 50); } else { SwinGame.DrawText("No card played yet...", Color.RoyalBlue, 0, 20); } // Draw the back of the cards... to represent the deck SwinGame.DrawCell(SwinGame.BitmapNamed("Cards"), 52, 160, 50); //Draw onto the screen SwinGame.RefreshScreen(60); }
private static void ShowMessage(string message, int number) { const int TX = 310; const int TY = 493; const int TW = 200; const int TH = 25; const int STEPS = 5; const int BG_X = 279; const int BG_Y = 453; int fullW = 0; fullW = 260 * number / STEPS; SwinGame.DrawBitmap(_LoaderEmpty, BG_X, BG_Y); // TODO: Do this the right way SwinGame.DrawCell(_LoaderFull, 0, BG_X, BG_Y); //Draw Bitmap Part (src, srcX, srcY, srcW, srcH, x, y) //SwinGame.DrawBitmapPart(_LoaderFull, 0, 0, fullW, 66, BG_X, BG_Y); Rectangle toDraw = new Rectangle { X = TX, Y = TY, Width = TW, Height = TH }; SwinGame.DrawText(message, Color.White, Color.Transparent, _LoadingFont, FontAlignment.AlignCenter, toDraw); SwinGame.RefreshScreen(); SwinGame.ProcessEvents(); }
/// <summary> /// Draws the game to the Window. /// </summary> /// <param name="myGame">The details of the game -- mostly top card and scores.</param> private static void DrawGame(Snap myGame) { SwinGame.DrawBitmap("cardsBoard.png", 0, 0); //SwinGame.ClearScreen(Color.White); //SwinGame.PlaySoundEffect("Start"); // Draw the top card Card top = myGame.TopCard; if (top != null) { SwinGame.DrawText("Top Card is " + top.ToString(), Color.White, 340, 120); //SwinGame.DrawText ("Player 1 score: " + myGame.Score(0), Color.White, 130, 30); //SwinGame.DrawText ("Player 2 score: " + myGame.Score(1), Color.White, 130, 40); SwinGame.DrawCell(SwinGame.BitmapNamed("Cards"), top.CardIndex, 570, 220); SwinGame.DrawText("" + myGame.Score(0), Color.White, "GameFont", 70, 50); SwinGame.DrawText("" + myGame.Score(1), Color.White, "GameFont", 758, 50); } else { SwinGame.DrawText("Hit space to start ...", Color.WhiteSmoke, 340, 120); } // Draw the back of the cards... to represent the deck SwinGame.DrawCell(SwinGame.BitmapNamed("Cards"), 52, 200, 220); //Draw onto the screen SwinGame.RefreshScreen(60); }
// private static void ShowMessage(string message, bool number) { const int BG_Y = 453; const int TX = 310; const int TY = 493; const int TW = 200; const int TH = 25; const int BG_X = 279; if (number == false) { SwinGame.DrawBitmap(_loaderEmpty, BG_X, BG_Y); } else { SwinGame.DrawCell(_loaderFull, 0, BG_X, BG_Y); } //int fullW = (260 * number) / 5; //int h = 66; //int x = 0; //int y = 0; //Rectangle tooDraw = new Rectangle(); //tooDraw.X = x; //tooDraw.Y = y; //tooDraw.Width = fullW; //tooDraw.Height = h; //SwinGame.DrawBitmap(_loaderFull, BG_X, BG_Y, SwinGame.OptionPartBmp(x, y, fullW, h)); Rectangle toDraw = new Rectangle(); toDraw.X = TX; toDraw.Y = TY; toDraw.Width = TW; toDraw.Height = TH; SwinGame.DrawText(message, Color.White, Color.Transparent, _loadingFont, FontAlignment.AlignCenter, toDraw); SwinGame.RefreshScreen(); SwinGame.ProcessEvents(); }