I have a game which makes use of the BGUI module for text input and also includes some labels.

Everything is working as intended when I don't do anything to change the window size (ignore that the text is too large!), as below:

This is nice and centered!

However, I want the window to be larger, ideally full screen. For this I have added bge.render.setFullScreen(True) to a bge script which is marked for execution before all other scripts. But when I do this, the result is the following:

enter image description here

The BGUI code for these labels is below:

class SimpleLayout(bgui.bge_utils.Layout):
    def __init__(self, sys, data):
        self.instructionlbl = bgui.Label(self, text='Provide the robot with a description of the location of the highlighted object', pos=[0, .9],
            sub_theme='Large', pt_size = 50,options = bgui.BGUI_DEFAULT | bgui.BGUI_CENTERX)
        self.titlelbl = bgui.Label(self, text=empty.getPropertyNames()[0], pos=[0, .95],
        sub_theme='Large', pt_size = 50,options = bgui.BGUI_DEFAULT | bgui.BGUI_CENTERX)
        self.figurelbl = bgui.Label(self, text='Figure: ',pos=[0, .85],
                sub_theme='Large',pt_size = 50, options = bgui.BGUI_DEFAULT| bgui.BGUI_CENTERX)

I have also tried avoiding setting fullscreen by using bge.render.setWindowSize(bge.render.getDisplayDimensions()[0],bge.render.getDisplayDimensions()[1]) instead but I get the same result.

Setting to fullscreen is also throwing off the cursor in the text input field, putting it one character behind.

Is there something wrong with the way I am using bge.render.setFullScreen(True)? Or is it something I need to fix with the BGUI parts? Any thoughts?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.