Results 1 to 2 of 2

Thread: Can't get SDL_APPINPUTFOCUS to work

  1. #1

    Can't get SDL_APPINPUTFOCUS to work

    I'm using FreePascal with SDL and am trying to keep track of whether or not my program has mouse and input focus and whether or not it's minimized. Keeping track of mouse focus seems to work fine, but it only registers a loss of input focus. I can't get it to register when it gains input focus again. Anything wrong with my code?

    Code:
       WHILE SDL_PollEvent(@Event) <> 0 DO BEGIN
          CASE Event.Type_ OF
    
             SDL_ActiveEvent :
             CASE Event.Active.State OF
    
                SDL_AppInputFocus :
                IF Event.Active.Gain = 0
                THEN ProgramHasInputFocus := F
                ELSE ProgramHasInputFocus := T;
    
                SDL_AppMouseFocus :
                IF Event.Active.Gain = 0
                THEN ProgramHasMouseFocus := F
                ELSE ProgramHasMouseFocus := T;
    
                SDL_AppActive :
                IF Event.Active.Gain = 0
                THEN ProgramIsActive := F
                ELSE ProgramIsActive := T;
    
             END;
    
             ...
    
          END;
       END;
    Laserbrain Studios - Currently developing Hidden Asset!
    Ascii Sector
    - Real-time roguelike in space!

  2. #2
    Never mind. I figured it out. It's bitwise, of course.
    Laserbrain Studios - Currently developing Hidden Asset!
    Ascii Sector
    - Real-time roguelike in space!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Comodo SSL