using System; using Gtk; using Cairo; namespace frame { /* tentative de séparer le code qui gere la librairie graphique * du reste du code afin que le programme puisse être mieux * réutilisé avec un autre toolkit */ public class Victor : DrawingArea{ private static Gtk.Window win = null; public game G = new game(); public Context cr; /*______________constuctor___________________*/ public Victor(){ win = new Window ("title"); win.DeleteEvent += new DeleteEventHandler (OnQuit); win.SetDefaultSize(1024,512); GLib.Timeout.Add (25, UpdateClock); win.Add (this); win.ShowAll (); } /*______________Event________________________*/ protected override bool OnExposeEvent (Gdk.EventExpose e){ cr = Gdk.CairoHelper.Create (e.Window); int w, h; e.Window.GetSize (out w, out h); G.play(cr, (int)w, (int)h); return true; } void OnQuit (object sender, DeleteEventArgs e){ Application.Quit (); } private bool UpdateClock (){ win.QueueDraw (); return true; } } }