Advertisement
jezzye13

Stijngin les 2 - bitmaps ;) - Jessey

Sep 22nd, 2016
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.58 KB | None | 0 0
  1. using System;
  2. /// <summary>
  3. /// Opdracht ge maakt door Jessey N
  4. /// </summary>
  5. namespace GameEngine
  6. {
  7.     /// <summary>
  8.     /// Opdracht ge maakt door Jessey N
  9.     /// </summary>
  10.     public class Les2 : AbstractGame
  11.     {
  12.         public Bitmap mario, dog;
  13.  
  14.         public override void GameStart()
  15.         {
  16.             //Everything that has to happen when the game starts happens here.
  17.             //F.e. initializing objects.
  18.         }
  19.  
  20.         public override void GameEnd()
  21.         {
  22.             //Clean up unmanaged objects here (F.e. bitmaps & fonts)
  23.  
  24.             //For example:
  25.             //m_Bitmap.Dispose();
  26.             //m_Font.Dispose();
  27.             try
  28.             {
  29.                 mario.Dispose();
  30.                 dog.Dispose();
  31.             } catch(Exception ex)
  32.             {
  33.                 Console.WriteLine(ex);
  34.             }
  35.            
  36.         }
  37.  
  38.         public override void Update()
  39.         {
  40.             //Update everything here.
  41.             //F.e. get input, move objects, etc...
  42.  
  43.             //For example:
  44.             //float deltaTime = GAME_ENGINE.GetDeltaTime();
  45.             //bool isDown = GAME_ENGINE.GetKeyDown(Key.Right);
  46.             bool isEsc = GAME_ENGINE.GetKeyDown(Key.Escape);
  47.             if (isEsc)
  48.             {
  49.                 this.GameEnd();
  50.                 System.Windows.Forms.Application.Exit();
  51.             }
  52.         }
  53.  
  54.         public override void Paint()
  55.         {
  56.             //Draw everything here.
  57.  
  58.             //For example:
  59.             //GAME_ENGINE.DrawRectangle(10, 10, 150, 25);
  60.             //GAME_ENGINE.FillEllipse(50, 75, 50, 50);
  61.             GAME_ENGINE.SetColor(0, 0, 0);
  62.  
  63.             GAME_ENGINE.DrawString("1.", 5, 20, 250, 50);
  64.             GAME_ENGINE.DrawString("Jessey Dennis Novani", 20, 20, 250, 50);
  65.  
  66.             GAME_ENGINE.DrawString("2.", 7, 20 + 50, 250, 50);
  67.             GAME_ENGINE.DrawLine(25, 20 + 50 + 40, 25 + (50 / 2), 55); //links
  68.             GAME_ENGINE.DrawLine(25 + 50, 20 + 50 + 40, 25 + (50 / 2), 55); //rechts
  69.             GAME_ENGINE.DrawRectangle(25, 20 + 50 + 40, 50, 50); //base
  70.  
  71.             GAME_ENGINE.DrawString("3.", 7, 20 + 50 + 100, 250, 50);
  72.             GAME_ENGINE.SetColor(255, 255, 255);
  73.             GAME_ENGINE.FillRectangle(25, 20 + 50 + 100, 150, 90); //flag
  74.             GAME_ENGINE.SetColor(255, 0, 0);
  75.             GAME_ENGINE.FillEllipse(25 + (150 / 2), 20 + 50 + 100 + (90 / 2), 25, 25); //punt
  76.             GAME_ENGINE.SetColor(0, 0, 0);
  77.  
  78.             GAME_ENGINE.DrawString("4.", 7, 20 + 50 + 220, 250, 50);
  79.             GAME_ENGINE.FillRectangle(25, 20 + 50 + 220, 150, 150); // background
  80.             GAME_ENGINE.SetColor(Color.White);
  81.             GAME_ENGINE.FillRectangle(25 + 50, 20 + 50 + 220, 50, 150);
  82.             GAME_ENGINE.FillRectangle(25, 20 + 50 + 220 + 50, 150, 50);
  83.             GAME_ENGINE.SetColor(Color.Black);
  84.             GAME_ENGINE.DrawRectangle(25, 20 + 50 + 220, 150, 150); // side
  85.             GAME_ENGINE.FillRectangle(25 + 50, 20 + 50 + 220 + 50, 50, 50); // middel block
  86.  
  87.             GAME_ENGINE.DrawString("5.", 213 - 7, 20, 250, 50);
  88.             GAME_ENGINE.SetColor(Color.Gray);
  89.             GAME_ENGINE.FillRectangle(213 + 7, 20, 40, 120);
  90.             GAME_ENGINE.FillRectangle(213 + 7 + 15, 20 + 120, 10, 50);
  91.             GAME_ENGINE.SetColor(Color.Red);
  92.             GAME_ENGINE.FillEllipse(213 + 7 + 20, 20 + 20, 15, 15);
  93.             GAME_ENGINE.SetColor(255, 165, 0);
  94.             GAME_ENGINE.FillEllipse(213 + 7 + 20, 20 + 20 + 40, 15, 15);
  95.             GAME_ENGINE.SetColor(Color.Green);
  96.             GAME_ENGINE.FillEllipse(213 + 7 + 20, 20 + 20 + 40 + 40, 15, 15);
  97.             GAME_ENGINE.SetColor(0, 0, 0);
  98.  
  99.             GAME_ENGINE.DrawString("6.", 213 - 7, 20 + 200, 250, 50);
  100.             GAME_ENGINE.DrawRoundedRectangle(213 + 7, 20 + 200, 150, 150, 5, 5);
  101.             GAME_ENGINE.SetColor(Color.White);
  102.             GAME_ENGINE.FillRoundedRectangle(213 + 7, 20 + 200, 150, 150, 5, 5);
  103.             GAME_ENGINE.SetColor(Color.Black);
  104.             GAME_ENGINE.FillEllipse(213 + 7 + 75, 20 + 200 + 75, 15, 15);
  105.             GAME_ENGINE.FillEllipse(213 + 7 + 25, 20 + 200 + 25, 15, 15);
  106.             GAME_ENGINE.FillEllipse(213 + 7 + 125, 20 + 200 + 125, 15, 15);
  107.  
  108.             GAME_ENGINE.DrawString("7.   Mario", 426 - 7, 20, 250, 50);
  109.             Bitmap mario = new Bitmap("mario.bmp");
  110.             GAME_ENGINE.DrawBitmap(mario, 426, 20);
  111.  
  112.             GAME_ENGINE.DrawString("8.   Nes dude", 426 - 7, 20 + 220, 250, 50);
  113.             Bitmap dog = new Bitmap("dog.bmp");
  114.             GAME_ENGINE.DrawBitmap(dog, 426, 20 + 220);
  115.         }
  116.     }
  117. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement