fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.Threading.Tasks;
  10. using System.IO;
  11.  
  12. namespace Soukoban
  13. {
  14. public partial class Form1 : Form
  15. {
  16. Bitmap bmp;
  17. Graphics g;
  18. Action<PreviewKeyDownEventArgs> DoKeyInput;
  19. Action<PaintEventArgs> DoPaint;
  20. Action DoUpdate;
  21. private Tile[,] mTiles;
  22.  
  23. [Flags]
  24. enum Tile
  25. {
  26. None = 0,
  27. Kabe = 1,
  28. Okiba = 2,
  29. Nimotu = 4,
  30. Player = 8,
  31. OK = Okiba | Nimotu
  32. }
  33.  
  34. public Form1()
  35. {
  36. InitializeComponent();
  37. SetStyle(ControlStyles.AllPaintingInWmPaint, true);
  38. SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
  39. SetStyle(ControlStyles.ResizeRedraw, true);
  40. SetStyle(ControlStyles.UserPaint, true);
  41.  
  42. bmp = new Bitmap(640, 480);
  43. g = Graphics.FromImage(bmp);
  44. Task.Factory.StartNew(GameMain);
  45. }
  46.  
  47. private void GameMain()
  48. {
  49. GameInitialize();
  50. DoPaint = PaintGameMain;
  51. DoUpdate = UpdateGameMain;
  52. DoKeyInput = InputGameMain;
  53.  
  54. while (true)
  55. {
  56. DoUpdate();
  57.  
  58. Invalidate();
  59. }
  60. }
  61.  
  62. private void GameInitialize()
  63. {
  64.  
  65.  
  66. }
  67.  
  68. private void LoadMap(int mapNo)
  69. {
  70. using(var sr = new StreamReader(@"map" + mapNo + ".dat"))
  71. using (var tr = sr as TextReader)
  72. {
  73. List<string> ss = new List<string>();
  74. while (!sr.EndOfStream)
  75. {
  76. ss.Add(sr.ReadLine());
  77. }
  78. mTiles = new Tile[ss.Count(), ss[0].Length];
  79.  
  80. for (int y = 0; y < ss.Count(); y++)
  81. {
  82. var s = ss[y];
  83. for (int x = 0; x < s.Length; x++)
  84. {
  85. mTiles[y, x] = (Tile)Convert.ToInt32(s[x]);
  86. }
  87. }
  88. }
  89. }
  90.  
  91. private void InputGameMain(PreviewKeyDownEventArgs e)
  92. {
  93.  
  94. }
  95.  
  96. private void PaintGameMain(PaintEventArgs e)
  97. {
  98. }
  99.  
  100. private void UpdateGameMain()
  101. {
  102. }
  103.  
  104. protected override void OnPaint(PaintEventArgs e)
  105. {
  106. DoPaint(e);
  107. }
  108.  
  109. private void Form1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
  110. {
  111. DoKeyInput(e);
  112. }
  113.  
  114. }
  115. }
  116.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(4,14): error CS0234: The type or namespace name `Data' does not exist in the namespace `System'. Are you missing an assembly reference?
prog.cs(5,14): error CS0234: The type or namespace name `Drawing' does not exist in the namespace `System'. Are you missing an assembly reference?
prog.cs(8,14): error CS0234: The type or namespace name `Windows' does not exist in the namespace `System'. Are you missing an assembly reference?
prog.cs(9,24): error CS0234: The type or namespace name `Tasks' does not exist in the namespace `System.Threading'. Are you missing an assembly reference?
Compilation failed: 4 error(s), 0 warnings
stdout
Standard output is empty