Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Fullscreen problem  (Read 1153 times)

0 Members and 1 Guest are viewing this topic.

soaup

  • Newbie
  • *
  • Posts: 5
    • View Profile
Fullscreen problem
« on: December 26, 2023, 11:19:32 am »
Hello! My game runs on laptop in fullscreen like this (when the screen resolution is less than 1920*1080):

Creating window code:
Quote
//BASE_WIDTH - 1920
//BASE_HEIGHT - 1080
    bool res = texture->create(BASE_WIDTH, BASE_HEIGHT);
    myCout() << "CREATE MAIN TEXTURE - " << res;
    if (!res) {
        myError() << "ERROR CREATE TEXTURE";
        exit(1);
    }

    textureForShader->create(BASE_WIDTH, BASE_HEIGHT);

    sf::ContextSettings settings;
    settings.depthBits = 24;
    settings.stencilBits = 8;

    if (this->fullScreen)
        window->create(sf::VideoMode(screenWidth, screenHeight), windowTitle,
                       sf::Style::Fullscreen, settings);
    else
        window->create(sf::VideoMode(screenWidth, screenHeight), windowTitle,
                       sf::Style::Close, settings);

    sf::View view( sf::FloatRect(0, 0, (float)screenWidth, (float)screenHeight) );
    view.setCenter(BASE_WIDTH/2, BASE_HEIGHT/2);
    window->setView(view);

    window->setFramerateLimit(60);
    window->setVerticalSyncEnabled(true);
Graphics card on my laptops is NVIDIA RTX 2050.
Oт PC with GeForce GTX 770 everything is fine - the game is stretched to full screen when the screen resolution is less than 1920*1080.
Please answer - what is the problem? drivers?
« Last Edit: December 26, 2023, 11:23:33 am by soaup »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Fullscreen problem
« Reply #1 on: December 30, 2023, 12:39:34 pm »
Am I understand you right, that you set the screenWidth and screenHeight to less than your normal display resolution?
You might want to get the valid fullscreen resolutions or at least validate your selected resolution, as not every resolution can be "fullscreened" and the driver/window manager is apparently left some room to decide on its own, how it handles such invalid screen resolutions.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/