Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Disable Fullscreen

How do I disable the full screen (Alt + Return) in game? I want people to be able to see the Close Window button in Battle World, but they can't if it's in Fullscreen, that and the FMV's wont work in full screen, so how would I disable the option of full screen?
(An idea would be to ask if the game is in fullscreen and if it is return to window mode)
So can someone tell me the code snippet I need?
 
I think the problem is that [Alt][Return] is a feature within Game.Exe and not a scripted feature, much like other automatic features built into Windows programs. Same can be said about trying to disable the [F1] button in Game.Exe that brings up your list of preferences (General/Gamepad/Keyboard).

Only way around it is if somehow a scripter figures out how to disable the [Alt][Enter] combination of keys using the Win32API itself... blocking the actual WINDOWS function.

I dunno how to block 'em though...
 
Thanks. I'll tell if it works.
EDIT: I can't have sdk at all, it conflicts with my other scripts. (I don't mind putting Disable_Fullscreen.update within every scene's update method)
Anyone else have any ideas?
 
If you want to disable the key only in specials places (battles for example).

Use this code :
Code:
@kbe = Win32API.new('user32', 'keybd_event', 'LLLL', '') # in the initialize method of your scene

@kbe.call(18, 0, 2, 0) # in the update method.

If you want the key to be always disabled, then use the following code : (put it above all other codes...)

Code:
module Input
  class << self
    alias altkey_update update
    @kbe = Win32API.new('user32', 'keybd_event', 'LLLL', '')
    def update
      altkey_update
      @kbe.call(18, 0, 2, 0)
    end
  end
end
 
Thanks, I'll try that when I get to a PC :D I'll reply with any problems. Thank you!
EDIT: It works! Great! Now I just need to copy and paste those two lines into every scene :D
The second code you posted doesn't work, it comes up with undefined method "Call"
 
Got the same 'undefined method' but this does it if you post it above all the other scripts:
Code:
module Input
  class << self
    alias altkey_update update
    def update
      altkey_update
      Win32API.new('user32', 'keybd_event', 'LLLL', '')
.call(18, 0, 2, 0)
    end
  end
end
Now it works.

On a sideline note...I tried (and failed at) replacing the 18 (for the Alt key) with a 123 (that defines the F12 key). Pity that 'THAT' didn't work. Woulda solved the whole F12 bug thing.
 
That's going to cause a lot of memory to be wasted, DVV. Creating an object every frame. Bad, bad.

Code:
module Input
  class << self
    alias altkey_update update
    KBE = Win32API.new('user32', 'keybd_event', 'LLLL', '')
    def update
      altkey_update
      KBE.call(0x12, 0, 2, 0)
    end
  end
end

I prefer using the HEX values for keyboard keys. Don't know why, but I do.
 
I'll try all of these when I get to a pc (i'm on wii opera ATM)
Thanks guys, i'll post any more problems here :D
EDIT: There are many errors, Dvv's didn't work, Yey's worked, but when I went onto a different map it entered fullscreen and wouldn't go out, and because this is battle world rpg there is no in game quit option, so I had to go into task manager to end bwrpg because it was in fullscreen.
 
Strange... :s

My version based on Sel's
(Win32API hardwired, scankey -ascii variant- used):
Code:
module Input
  class << self
    alias altkey_update update
    def update
      altkey_update
      Win32API.new('user32', 'keybd_event', 'LLLL', '').call(18, 0, 2, 0)
    end
  end
end

Yeyinde's version... ditto:
(Win32API set as Constant, hex code for key used) ;)
Code:
module Input
  class << self
    alias altkey_update update
    KBE = Win32API.new('user32', 'keybd_event', 'LLLL', '')
    def update
      altkey_update
      KBE.call(0x12, 0, 2, 0)
    end
  end
end

Both work in my projects (even on a friend's junky Pentium3 laptop).

You are following Selwyn's instructions, right?
"If you want the key to be always disabled, then use the following code : (put it above all other codes...)"

I believe that this not only applies to your custom scripts but all scripts, even Game_Temp. I have it as the very first myself.

As to how you entered fullscreen mode... what? Teleporting from map to map shouldn't do that.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top