Is there a way to prevent your app from being fullscreened?

Can I prevent the user from fullscreening my app?

The FPS of the game halves when fullscreened because it allows a lot more enemies and items to be spawned. Can I prevent the player from fullscreening rather than just having something that says “PLEASE DONT FULL SCREEN ME!!! I WILL CRASH!!!”

if you’re using GLFW you can remove the decorations (the OS buttons in the title bar); example below. may be platform-sensitive.

without changing much of your code you could also detach your render from the screen size and work with fixed dimensions, render into an appropriately-allocated FBO, which you then draw fbo.draw(0,0,ofGetWidth(), ofGetHeight()); so if someone makes the app fullscreen to get it “bigger” it will simply scale the FBO and not affect the internal aspects of your logic.

that being said it would be ideal to redesign in a way that abstracts the screen size from the logic. that is simplified by working with 0…1 (or -1…1) coordinates – all the decisions/scaling are made in a normalized space. when it’s time to render you decide what resolution canvas you want, and you decide if you want to upsample low-res assets to “fill” a certain space, or have higher-resolution assets when appropriate. that will have a slight impact on FPS, but much less than what your current setup is doing.

int main()
    ofGLFWWindowSettings settings;
    settings.decorated = false;
    ofRunApp(new ofApp);

Was going to mention the window decoration but @burton summed it up nicely.

Another thing you could do is detect if the window is too large and then make it smaller. Something like like:

if( ofGetWidth() > 1600 ){
  ofSetWindowShape(1600, ofGetHeight());
if( ofGetHeight() > 1200 ){
  ofSetWindowShape(1200, ofGetHeight());

This would enforce a maximum window size of 1600 x 1200.

You could also have a max number of enemies allowed and only add more enemies if under that number?

I do, turns out it was something else causing the slowdown but it also doubles the playable area of the game, so I’d like to prevent that if possible.

I’ll give the solutions above a go when I get a chance

Where would this be coded?

For the ofSetWindowShape code in the ofApp::update(){ function.