Esempio n. 1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="ev"></param>
 /// <returns></returns>
 protected internal static SdlEventArgs CreateEventArgs(Sdl.SDL_Event ev)
 {
     switch ((EventTypes)ev.type)
     {
         case EventTypes.KeyDown:
             return new KeyboardEventArgs(ev);
         case EventTypes.KeyUp:
             return new KeyboardEventArgs(ev);
         case EventTypes.ActiveEvent:
             return new ActiveEventArgs(ev);
         case EventTypes.Quit:
             return new QuitEventArgs(ev);
         case EventTypes.MouseButtonUp:
             return new MouseButtonEventArgs(ev);
         case EventTypes.MouseButtonDown:
             return new MouseButtonEventArgs(ev);
         case EventTypes.MouseMotion:
             return new MouseMotionEventArgs(ev);
         case EventTypes.VideoExpose:
             return new VideoExposeEventArgs(ev);
         case EventTypes.VideoResize:
             return new VideoResizeEventArgs(ev);
         case EventTypes.UserEvent:
             return new UserEventArgs(ev);
         default:
             return new SdlEventArgs(ev);
     }
 }
Esempio n. 2
0
        public void MouseDownHandler(Sdl.SDL_MouseButtonEvent button)
        {
            if (button.button == Sdl.SDL_BUTTON_LEFT) {
                grabPos = m_keyboard.MousePos - Position;

                grab = Bounds.Contains(m_keyboard.MousePos);
            }
        }
Esempio n. 3
0
 public virtual void AddLetter(Sdl.SDL_keysym key)
 {
     if (!HasFocus) return;
     if (m_keyboard.KeyIsChar(key)) {
         Contents.Contents += m_keyboard.KeyToChar(key);
     } else if (key.sym == Sdl.SDLK_BACKSPACE && Contents.Contents.Length > 0) {
         Contents.Contents = Contents.Contents.Substring(0, Contents.Contents.Length-1);
     }
 }
Esempio n. 4
0
 //public void onKeyPress(object o, KeyPressEventArgs args)
 public void onKeyPress(Sdl.SDL_keysym keysym)
 {
     switch(keysym.sym)
     {
         case Sdl.SDLK_RETURN:
             this.m_shouldStart = true;
             break;
         case Sdl.SDLK_e:
             this.m_usePotion = true;
             break;
         case Sdl.SDLK_q:
             this.m_dropItem = true;
             break;
         case Sdl.SDLK_SPACE:
             this.m_useAutoAttack = true;
             break;
         case Sdl.SDLK_g:
             this.m_lootItem = true;
             break;
         case Sdl.SDLK_w:
             this.m_currentMoveDirection = MovingDirection.UP;
             if(!this.m_moveKeys.Contains(keysym.sym))
                 this.m_moveKeys.Add(keysym.sym);
             break;
         case Sdl.SDLK_a:
             this.m_currentMoveDirection = MovingDirection.LEFT;
             if(!this.m_moveKeys.Contains(keysym.sym))
                 this.m_moveKeys.Add(keysym.sym);
             break;
         case Sdl.SDLK_s:
             this.m_currentMoveDirection = MovingDirection.DOWN;
             if(!this.m_moveKeys.Contains(keysym.sym))
                 this.m_moveKeys.Add(keysym.sym);
             break;
         case Sdl.SDLK_d:
             this.m_currentMoveDirection = MovingDirection.RIGHT;
             if(!this.m_moveKeys.Contains(keysym.sym))
                 this.m_moveKeys.Add(keysym.sym);
             break;
         default:
             break;
     }
     if(keysym.mod == Sdl.SDLK_LSHIFT)
         this.m_useSpecial = true;
 }
Esempio n. 5
0
 public void MouseDownHandler(Sdl.SDL_MouseButtonEvent button)
 {
     if (button.button == Sdl.SDL_BUTTON_LEFT) {
         grabPos = m_keyboard.MousePos - Position;
         if (MouseOnLeft ()) {
             leftGrab = true;
         }
         if (MouseOnRight ()) {
             rightGrab = true;
         }
         if (MouseOnBottom()) {
             bottomGrab = true;
         }
         if (MouseOnTop()) {
             topGrab = true;
         }
         if (MouseInMiddle()) {
             middleGrab = true;
         }
     }
 }
Esempio n. 6
0
        public void HandleInput(Sdl.SDL_Event sdl_event)
        {
            switch (sdl_event.type)
            {
                case Sdl.SDL_QUIT:
                    Dispose();
                    return;
                case Sdl.SDL_KEYDOWN:
                    if (sdl_event.key.keysym.sym == Sdl.SDLK_ESCAPE)
                    {
                        Dispose();
                        return;
                    }
                    else if (sdl_event.key.keysym.sym == 'n')
                    {
                        rotation += (float)(Math.PI / 100);
                        Vector3 newPos = new Vector3((float)Math.Cos(rotation), 0, (float)Math.Sin(rotation));
                        newPos = newPos * 25;
                        newPos.Y = 10;
                        CameraManager.Current.position = newPos;
                    }
                    else if (sdl_event.key.keysym.sym == 'm')
                    {
                        rotation -= (float)(Math.PI / 100);

                        Vector3 newPos = new Vector3((float)Math.Cos(rotation), 0, (float)Math.Sin(rotation));
                        newPos = newPos * 25;
                        newPos.Y = 10;
                        CameraManager.Current.position = newPos;
                    }
                    break;
                case Sdl.SDL_MOUSEBUTTONDOWN:
                    if (sdl_event.button.button == Sdl.SDL_BUTTON_LEFT)
                    {
                        this.mrExplody = new Explosion(new Vector3(1, 1, 1), 0f, 5.0f);
                        return;
                    }
                    break;
            }
        }
Esempio n. 7
0
        private static void ProcessEvent(Sdl.SDL_Event ev)
        {
            switch ((EventTypes)ev.type)
            {
                case EventTypes.ActiveEvent:
                    OnActiveEvent(new ActiveEventArgs(ev));
                    break;

                case EventTypes.JoystickAxisMotion:
                    OnJoystickAxisMotion(new JoystickAxisEventArgs(ev));
                    break;

                case EventTypes.JoystickBallMotion:
                    OnJoystickBallMotion(new JoystickBallEventArgs(ev));
                    break;

                case EventTypes.JoystickButtonDown:
                    OnJoystickButtonDown(new JoystickButtonEventArgs(ev));
                    break;

                case EventTypes.JoystickButtonUp:
                    OnJoystickButtonUp(new JoystickButtonEventArgs(ev));
                    break;

                case EventTypes.JoystickHatMotion:
                    OnJoystickHatMotion(new JoystickHatEventArgs(ev));
                    break;

                case EventTypes.KeyDown:
                    OnKeyboardDown(new KeyboardEventArgs(ev));
                    break;

                case EventTypes.KeyUp:
                    OnKeyboardUp(new KeyboardEventArgs(ev));
                    break;

                case EventTypes.MouseButtonDown:
                    OnMouseButtonDown(new MouseButtonEventArgs(ev));
                    break;

                case EventTypes.MouseButtonUp:
                    OnMouseButtonUp(new MouseButtonEventArgs(ev));
                    break;

                case EventTypes.MouseMotion:
                    OnMouseMotion(new MouseMotionEventArgs(ev));
                    break;

                case EventTypes.Quit:
                    OnQuitEvent(new QuitEventArgs(ev));
                    break;

                case EventTypes.UserEvent:
                    OnUserEvent(new UserEventArgs(ev));
                    break;

                case EventTypes.VideoExpose:
                    OnVideoExpose(new VideoExposeEventArgs(ev));
                    break;

                case EventTypes.VideoResize:
                    OnVideoResize(new VideoResizeEventArgs(ev));
                    break;
            }
        }
Esempio n. 8
0
 public static IntPtr TTF_RenderUTF8_Shaded(IntPtr font, string text, Sdl.SDL_Color fg, Sdl.SDL_Color bg);
Esempio n. 9
0
 public static IntPtr TTF_RenderUTF8_Solid(IntPtr font, string text, Sdl.SDL_Color fg);
Esempio n. 10
0
 internal MouseMotionEventArgs(Sdl.SDL_Event evt)
     : base(evt)
 {
 }
Esempio n. 11
0
 internal JoystickButtonEventArgs(Sdl.SDL_Event evt)
     : base(evt)
 {
 }
Esempio n. 12
0
		public static extern IntPtr TTF_RenderUTF8_Blended(
			IntPtr font, string text, Sdl.SDL_Color fg);
Esempio n. 13
0
		public static extern IntPtr TTF_RenderGlyph_Blended(
			IntPtr font, 
			short ch, 
			Sdl.SDL_Color fg);
Esempio n. 14
0
 public void MouseUpHandler(Sdl.SDL_MouseButtonEvent button)
 {
     if (button.button == Sdl.SDL_BUTTON_LEFT) {
         leftGrab = false;
         rightGrab = false;
         topGrab = false;
         bottomGrab = false;
         middleGrab = false;
     }
 }
Esempio n. 15
0
 internal MouseButtonEventArgs(Sdl.SDL_Event evt)
     : base(evt)
 {
 }
Esempio n. 16
0
 internal QuitEventArgs(Sdl.SDL_Event evt)
     : base(evt)
 {
 }
Esempio n. 17
0
File: Sdl.cs Progetto: tanis2000/FEZ
 public static int SDL_GetWMInfo(out Sdl.SDL_SysWMinfo info);
Esempio n. 18
0
 internal VideoResizeEventArgs(Sdl.SDL_Event evt)
     : base(evt)
 {
 }
Esempio n. 19
0
 public virtual void MouseClicked(Sdl.SDL_MouseButtonEvent button)
 {
     if (Hidden) return;
     if (button.button == Sdl.SDL_BUTTON_LEFT && Bounds.Contains(m_keyboard.MousePos)) {
         if (Pressed != null) Pressed();
         GetFocus(this);
     }
 }
Esempio n. 20
0
 internal KeyboardEventArgs(Sdl.SDL_Event evt)
     : base(evt)
 {
 }
Esempio n. 21
0
 internal JoystickHatEventArgs(Sdl.SDL_Event evt)
     : base(evt)
 {
 }
Esempio n. 22
0
File: Sdl.cs Progetto: tanis2000/FEZ
 public static int SDL_GetWMInfo(out Sdl.SDL_SysWMinfo_Windows info);
Esempio n. 23
0
		public static extern IntPtr TTF_RenderText_Shaded(
			IntPtr font, string text, 
			Sdl.SDL_Color fg, Sdl.SDL_Color bg);
Esempio n. 24
0
 public static IntPtr TTF_RenderGlyph_Shaded(IntPtr font, short ch, Sdl.SDL_Color fg, Sdl.SDL_Color bg);
Esempio n. 25
0
		public static extern IntPtr TTF_RenderUNICODE_Blended(
			IntPtr font, 
			[MarshalAs(UnmanagedType.LPWStr)] string text,
			Sdl.SDL_Color fg);
Esempio n. 26
0
 public static IntPtr TTF_RenderGlyph_Solid(IntPtr font, short ch, Sdl.SDL_Color fg);
Esempio n. 27
0
 internal VideoExposeEventArgs(Sdl.SDL_Event evt)
     : base(evt)
 {
 }
Esempio n. 28
0
 public static IntPtr TTF_RenderText_Blended(IntPtr font, string text, Sdl.SDL_Color fg);
Esempio n. 29
0
File: SdlGfx.cs Progetto: vhotur/tao
 public static extern int SDL_gfxBlitRGBA(IntPtr src, ref Sdl.SDL_Rect srcrect, IntPtr dst, Sdl.SDL_Rect dstrect);
Esempio n. 30
0
 /// <summary>
 /// Holds SDL_Event
 /// </summary>
 /// <param name="eventStruct">Event Struct</param>
 protected SdlEventArgs(Sdl.SDL_Event eventStruct)
 {
     this.eventStruct = eventStruct;
 }