using System;
using System.Windows.Forms;
using System.Collections.Generic;
namespace NewGame1 {
enum GameStatu {
gameRunning, //0
gamePause, //1
gameMenu, //2
gameLoading, //3
gameStart, //4
gameTest, //5
};
public partial class WinMain : Form {
TimeController timeController;
DirectRender2D directRender2D;
ulong gameFrame;
int counter_FPS;
public WinMain () {
InitializeComponent();
InitiallizeGameSystem();
}
protected void InitiallizeGameSystem () {
timeController = new TimeController(GameLoop);
directRender2D = new DirectRender2D(this);
}
void GameLoop (double ElapsedTime) {
//GameUpdate....
directRender2D.Begin();
directRender2D.renderClear(new Color4(0, 0, 0, 255));
directRender2D.End();
++gameFrame;
++counter_FPS;
}
private void countFPS (object sender, EventArgs e) {
if (counter_FPS > 65)
this.Text = "[High fps]";
else
this.Text = "[" + counter_FPS + "fps]";
counter_FPS = 0;
}
}
}
整理出来就是这样,第5篇我大概会说一说如何render出几何图形。
另外,游戏的输入还是一个很重要的内容,第4篇我会大概的说一说的。