// -- APPLICATION ENTRY POINT -- static void Main() { //System.Windows.Forms.Cursor.Hide(); ss = SpriteSheet.load("images/config.csv"); // Create display surface. video = Video.SetVideoMode(FRAME_WIDTH, FRAME_HEIGHT, COLOUR_DEPTH, FRAME_RESIZABLE, USE_OPENGL, FRAME_FULLSCREEN, USE_HARDWARE); Video.WindowCaption = "Shmup"; Video.WindowIcon(new Icon(@"images/shmup.ico")); // invoke application initialisation subroutine setup(); // invoke secondary initialisation subroutine onInit(); // register event handler subroutines Events.Tick += new EventHandler<TickEventArgs>(onTick); Events.Quit += new EventHandler<QuitEventArgs>(onQuit); Events.KeyboardDown += new EventHandler<SdlDotNet.Input.KeyboardEventArgs>(onKeyboard); Events.KeyboardUp += new EventHandler<SdlDotNet.Input.KeyboardEventArgs>(onKeyboard); Events.MouseButtonDown += new EventHandler<SdlDotNet.Input.MouseButtonEventArgs>(onMouseButton); Events.MouseButtonUp += new EventHandler<SdlDotNet.Input.MouseButtonEventArgs>(onMouseButton); Events.MouseMotion += new EventHandler<SdlDotNet.Input.MouseMotionEventArgs>(onMouseMove); // while not quit do process events Events.TargetFps = 60; Events.Run(); }
public static SpriteSheet load(string configfile) { SpriteSheet ss = new SpriteSheet(); StreamReader sr = new StreamReader(configfile); string line = sr.ReadLine(); line = sr.ReadLine(); string[] fields = line.Split('='); ss.imagefile = fields[1]; while (!sr.EndOfStream) { line = sr.ReadLine(); fields = line.Split(','); int x = int.Parse(fields[1]); int y = int.Parse(fields[2]); int w = int.Parse(fields[3]); int h = int.Parse(fields[4]); Rectangle r = new Rectangle(x,y,w,h); ss.rects.Add(r); } return ss; }