Mauriciocaradenepe

cpp de la libreria

Aug 21st, 2018
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. #include <iostream>
  2. #include "Unidades_Graficas.h"
  3.  
  4. //sentido de pertenencia = :://
  5. Unidades_Graficas::Unidades_Graficas()// nace c:
  6. {
  7. //x = System::Console::WindowWidth /2;
  8. //y = System::Console::WindowHeight /2;
  9. x = rand() % 70 + 1;
  10. y = rand() % 20 + 1;
  11. representacion = rand()%121 +30;
  12. color = rand() % 5 + 1;
  13. }
  14. Unidades_Graficas::~Unidades_Graficas()//muere :,v
  15. {
  16. }
  17. void Unidades_Graficas::mostrar()
  18. {
  19. switch (color)
  20. {
  21. case 1: System::Console::ForegroundColor = System::ConsoleColor::Blue; break;
  22. case 2:System::Console::ForegroundColor = System::ConsoleColor::Yellow; break;
  23. case 3:System::Console::ForegroundColor = System::ConsoleColor::DarkYellow; break;
  24. case 4:System::Console::ForegroundColor = System::ConsoleColor::Green; break;
  25. case 5:System::Console::ForegroundColor = System::ConsoleColor::DarkGreen; break;
  26. default:
  27. break;
  28. }
  29. System::Console::SetCursorPosition(x,y);
  30. std::cout << representacion;
  31. }
  32. void Unidades_Graficas::ocultar()
  33. {
  34. System::Console::SetCursorPosition(x, y);
  35. std::cout << ' ';
  36. }
  37. void Unidades_Graficas::mover_x()
  38. {
  39. x = x + desx;
  40. }
  41. void Unidades_Graficas::mover_y()
  42. {
  43. y += desy;
  44. }
Add Comment
Please, Sign In to add comment