Register
Final Platform Layer»Forums»Window closing being weird
Jai
5 posts
Window closing being weird
1 month, 1 week ago Edited by Jai on Oct. 28, 2020, 3:54 p.m. Reason: Initial post
Hey! this is my code for window closing:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
    while (fplPollEvent(currentEvent)) {
		
        switch (currentEvent->type) {
			
            case fplEventType_Window: {
                // A window event, like resize, lost/got focus, etc.
                switch (currentEvent->window.type) {
					
                    case fplWindowEventType_Closed: {
                        global_running = false;
                    } break;
             ...


And for pressing Alt + F4:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
fplKey mappedKey = currentEvent->keyboard.mappedKey;
                        if (state == fplButtonState_Release) {
							
							// F4 key pressed
                            if (mappedKey == fplKey_F4) {
								            
								fplKeyboardModifierFlags keyModifier = currentEvent->keyboard.modifiers;
                                if (keyModifier == fplKeyboardModifierFlags_LAlt
									|| keyModifier == fplKeyboardModifierFlags_RAlt) {
									
                                    global_running = false;
                                }
                            }
                        }


However, none of these cases are being hit, windows is handling these events before I can - the window just closes, but the game is running in the background. What am I doing wrong here?