public Form1() { InitializeComponent(); testMap = new Map(1, 1); //instanciamos o motor grafico //a apontar para a superficie onde queremos desenhar gfx = new GFXEngine(panel1, false, false); loadStuff(); tick = false; tickTimer = new System.Windows.Forms.Timer(); tickTimer.Tick += new EventHandler(tickTimer_Tick); tickTimer.Interval = 1; //~60 ticks por segundo tickTimer.Start(); operationsTimer = new System.Windows.Forms.Timer(); operationsTimer.Tick += new EventHandler(timer_Tick); operationsTimer.Interval = 40; //25 ticks por segundo operationsTimer.Start(); drawThread = new Thread(drawThreadCycle); drawThread.Start(); }
public void drawMapArea(Map map, int x, int y, int width, int height, int offsetX, int offsetY, int sizeX, int sizeY) { for (int i = 0; i <= sizeX; i++) { for (int j = 0; j <= sizeY; j++) { if (tileSet.tiles != null && i + offsetX < map.width && j + offsetY < map.height && map.tiles[i + offsetX, j + offsetY] >= 0) { drawTile(tileSet.tiles[map.tiles[i + offsetX, j + offsetY]], x + screenScale(i), y + screenScale(j)); } else { drawTile(null, x + screenScale(i), y + screenScale(j)); } } } }