Game Development Community

[Windows | Pro] Editor Menu/OpenGL Aero Offset Fix

by Cassy Brink · in Torque Game Builder · 05/10/2011 (10:33 pm) · 3 replies

Anybody who runs TGB on Windows Vista/7 and has an ATI card has noticed this problem. (For some reason, I don't think it happens on nVidia cards, but this will likely fix it there as well, if the problem does exist). This fix will allow you to maximize, resize, and minimize your Torque 2D editor window without having the offset problem, and this does not harm any other aspect of the editor that I have noticed.

Note that to do this fix, you will need to have the Pro edition, as it requires modification of the T2D source code. First, open "T2D SDK.rc" and create a new menu. You need to make sure that you add at least one menu option to it (I just entered a space) so that it will render the menu bar (which is the entire base of this fix). After doing this, you will need to update game/resource.h to include the menu identifier, since winWindow.cc includes that file rather than the root resource.h created by the Resource Editor.

File: game/resource.h
Find:
#define IDI_ICON1                       107

Add After:
#define IDR_MENU1                       108

File: winWindow.cc
Function: CreateOpenGLWindow
Line: Approx 1369 (1.7.5, unmodified)

Replace:
return CreateWindowExW(
      exWindowStyle,
      windowClassName,
      windowName,
      windowStyle,
      0, 0, width, height,
      NULL, NULL,
      winState.appInstance,
      NULL);

With:
return CreateWindowExW(
      exWindowStyle,
      windowClassName,
      windowName,
      windowStyle,
      0, 0, width, height,
#ifdef TORQUE_TOOLS
      NULL, LoadMenu(winState.appInstance, MAKEINTRESOURCE(IDR_MENU1)),
#else
	  NULL, NULL,
#endif
      winState.appInstance,
      NULL);

-------------------------------------------------------------------
Resource File for people with Visual C++ Express - courtesy of daffodilistic::

File: T2D SDK.rc
Add:
IDR_MENU1 MENU  
    BEGIN  
            MENUITEM " ", 0, GRAYED  
    END

About the author

I'm a transgendered game programming student at the University of Advancing Technology, a fan of Japanese language and culture, and an OpenGL enthusiast.


#1
05/12/2011 (7:29 am)
Confirmed working on my rig (ATI HD5750). I don't have Visual Studio Pro (using Visual Studio Express), so I had to manually enter the resource code in T2D SDK.rc:

IDR_MENU1 MENU
BEGIN
        MENUITEM " ", 0, GRAYED
END
#2
05/12/2011 (5:14 pm)
Thanks, daffodil - I added that information to the original post (because I know a lot of people tend to ignore comments). Forgot that VCExpress is minus one resource editor.