Sign in to follow this  
Followers 0
creeping

making a windowed game run in full screen

3 posts in this topic

#1 ·  Posted (edited)

I play Battlefield 2142, it can run in full screen mode (default) or window mode (set by altering the command line switches) in the game shortcut, this which I have done.

The reason for windows mode: If the game crashes it usually freezes the computer which can avoided if its run in a window.

Within the game settings I have set the resolution to 1024x768.

I wish to make the window appear as if its running in full screen mode so it looks exactly the same as the default mode. So the windows title bar is not visibl and you can not see the edge of the window at the sides or bottom.

The game screen should take up the whole desktop to the very edge of each corner and not one pixel should be off the edge of the screen.

Here is a screen shot of how it looks in window mode:

http://img167.imageshack.us/img167/9327/bf2142fh9.jpg

I have tried using WinMove() But how do I take into account the title bar and edges of the window? I'm just being fuzzy as I want the windowed game screen to be a replica of the full screen.

Is there another way to do this? Such as a function like: WinSetClientSize(x, y, width, height)

Thanks.

Edited by creeping

Share this post


Link to post
Share on other sites



I recently made a script like that for another game. It will adjust the game window to hide the title bar, and borders, as well as adjust to the taskbar size and position.

#include<Array.au3>
AutoItSetOption("WinTitleMatchMode", 4)

$Title = 'Civilization IV'

WinActivate( $Title )

$Taskbar = WinGetPos("classname=Shell_TrayWnd") ;Returns (x,y,w,h)
    $Taskbar_X = $Taskbar[0]
    $Taskbar_Y = $Taskbar[1]
    $Taskbar_W = $Taskbar[2]
    $Taskbar_H = $Taskbar[3]

$Window = WinGetPos( $Title )                   ;Returns (x,y,w,h)
    $Window_X = $Window[0]
    $Window_Y = $Window[1]
    $Window_W = $Window[2]
    $Window_H = $Window[3]

$Client = WinGetClientSize( $Title )            ;Returns (w,h)
    $Client_W = $Client[0]
    $Client_H = $Client[1]

$Border = ( $Window_W - $Client_W ) / 2
$Titlebar = $Window_H - $Client_H

If $Taskbar_W = @DesktopWidth And $Taskbar_H <> @DesktopHeight Then
    ;Horizontal
    $Adjust_W = 0
    $Adjust_H = $Taskbar_H
    
    If $Taskbar_Y = 0 Then  ;Top
        $Start_X = 0
        $Start_Y = $Taskbar_H
    Else                    ;Bottom
        $Start_X = 0
        $Start_Y = 0
    EndIf
ElseIf $Taskbar_W <> @DesktopWidth And $Taskbar_H = @DesktopHeight Then
    ;Vertical
    $Adjust_W = $Taskbar_W
    $Adjust_H = 0
    
    If $Taskbar_X = 0 Then  ;Left
        $Start_X = $Taskbar_W
        $Start_Y = 0
    Else                    ;Right
        $Start_X = 0
        $Start_Y = 0
    EndIf
EndIf

$Available_W = @DesktopWidth - $Adjust_W
$Available_H = @DesktopHeight - $Adjust_H

;~ =====================================================================================

WinMove( $Title,'',$Start_X - $Border,$Start_Y - $Titlebar,$Available_W + ($Border * 2),$Available_H + $Titlebar + $Border )

;~ =====================================================================================

;~ ConsoleWrite( '$Taskbar_X : ' & $Taskbar[0] & @CRLF )
;~ ConsoleWrite( '$Taskbar_Y : ' & $Taskbar[1] & @CRLF )
;~ ConsoleWrite( '$Taskbar_W : ' & $Taskbar[2] & @CRLF )
;~ ConsoleWrite( '$Taskbar_H : ' & $Taskbar[3] & @CRLF )
;~ ConsoleWrite( @CRLF )
;~ ConsoleWrite( '$Window_X : ' & $Window[0] & @CRLF )
;~ ConsoleWrite( '$Window_Y : ' & $Window[1] & @CRLF )
;~ ConsoleWrite( '$Window_W : ' & $Window[2] & @CRLF )
;~ ConsoleWrite( '$Window_H : ' & $Window[3] & @CRLF )
;~ ConsoleWrite( @CRLF )
;~ ConsoleWrite( '$Client_W : ' & $Client[0] & @CRLF )
;~ ConsoleWrite( '$Client_H : ' & $Client[1] & @CRLF )
;~ ConsoleWrite( @CRLF )
;~ ConsoleWrite( '$Border : ' & $Border & @CRLF )
;~ ConsoleWrite( '$Titlebar : ' & $Titlebar & @CRLF )
;~ ConsoleWrite( @CRLF )
;~ ConsoleWrite( '$Available_W : ' & $Available_W & @CRLF )
;~ ConsoleWrite( '$Available_H : ' & $Available_H & @CRLF )
;~ ConsoleWrite( @CRLF )
;~ ConsoleWrite( '$Start_X : ' & $Start_X & @CRLF )
;~ ConsoleWrite( '$Start_Y : ' & $Start_Y & @CRLF )

Share this post


Link to post
Share on other sites

Cool, looks great :rolleyes:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0