예제 #1
0
 public EventQueue()
 {
     _handle = Allegro.CreateEventQueue();
     if (_handle == IntPtr.Zero)
     {
         throw new Exception("No events. Ever");
     }
     Allegro.RegisterEventSource(_handle, Allegro.GetKeyboardEventSource());
 }
예제 #2
0
 public Font(string filename, int size)
 {
     _handle = Allegro.LoadFont(filename, size, 0);
     if (_handle == IntPtr.Zero)
     {
         Console.WriteLine("errno = {0}", Allegro.GetErrNo());
         throw new Exception("Font could not be loaded HAHA.");
     }
 }
예제 #3
0
        public Display(string title, int width, int height)
        {
            _handle = Allegro.CreateDisplay(width, height);
            if (_handle == IntPtr.Zero)
            {
                throw new Exception("No display for you!");
            }
            Allegro.SetWindowTitle(_handle, title);

            Width  = width;
            Height = height;
        }
예제 #4
0
        static void Main(string[] args)
        {
            Allegro.Init();

            using (var display = new Display("NOT SHIT", 1280, 720)) {
                using (var queue = new EventQueue()) {
                    using (var font = new Font("fonts/DejaVuSansMono.ttf", 16)) {
                        Main(display, queue, font);
                    }
                }
            }
        }
예제 #5
0
 public void Clear(Color color)
 {
     SetAsTarget();
     Allegro.ClearToColor(color.AllegroColor);
 }
예제 #6
0
 public void SetAsTarget()
 {
     Allegro.SetTargetBackbuffer(_handle);
 }
예제 #7
0
 public void Flip()
 {
     Allegro.FlipDisplay();
 }
예제 #8
0
 public void Dispose()
 {
     Allegro.DestroyDisplay(_handle);
 }
예제 #9
0
 public Allegro.IEvent NextEvent()
 {
     return(Allegro.GetNextEvent(_handle));
 }
예제 #10
0
 public void Dispose()
 {
     Allegro.DestroyEventQueue(_handle);
 }
예제 #11
0
 public void Draw(string text, float x, float y, Color?color = null)
 {
     Allegro.DrawText(_handle, (color ?? Color.White).AllegroColor, x, y, 0, text);
 }
예제 #12
0
 public void Measure(string text, out int x, out int y, out int width, out int height)
 {
     Allegro.GetTextDimensions(_handle, text, out x, out y, out width, out height);
 }
예제 #13
0
 public void Dispose()
 {
     Allegro.DestroyFont(_handle);
 }