gameboy Posted June 16, 2019 Report Share Posted June 16, 2019 @Stan` This code is more practical, it is simpler, it can effectively solve practical problems. BTW: we should not delete those settings, should adjust it. // The hDC DC handle, if NULL, uses the entire screen // wR wG wB 0-255, default 128 BOOL SetBrightness(HDC hDC, int wR, int wG, int wB) { BOOL bRet = FALSE; HDC hGammDC = hDC ? hDC : ::GetDC(NULL); #pragma pack(push, 8) typedef struct _tagD3dGammaramp_t { WORDred[256]; WORDgreen[256]; WORDblue[256]; } _D3DGAMMARAMP, *LP_D3DGAMMARAMP; #pragma pack(pop) _D3DGAMMARAMP mGamRamp; memset(&mGamRamp, 0, sizeof(mGamRamp)); for (int iIndex = 0; iIndex < 256; iIndex++) { mGamRamp.red[iIndex] = min(65535, iIndex * (wR + 128)); mGamRamp.green[iIndex] = min(65535, iIndex * (wG + 128)); mGamRamp.blue[iIndex] = min(65535, iIndex * (wB + 128)); } LPVOID lpRamp = &mGamRamp; bRet = SetDeviceGammaRamp(hGammDC, lpRamp); if (hDC == NULL && hGammDC) { ::ReleaseDC(NULL, hGammDC); } return bRet; } Quote Link to comment Share on other sites More sharing options...
Stan` Posted June 16, 2019 Report Share Posted June 16, 2019 @gameboy that code will not work, nor will the previous examples you posted do either. Some are C not C++ which isn't a problem by itself, but we don't code in C anywhere, some are not cross platform, example #include <windows.h> Will only work on windows. Nobody actually needs to change the gamma in the game, you can do it using external software if you need to. Also, when posting code snippets, please use the code tools from the forums. It's unreadable otherwise. Thanks. 29 minutes ago, weridetogether6 said: It's fixed now cheers Did a re installation fix it ? 1 Quote Link to comment Share on other sites More sharing options...
gameboy Posted June 17, 2019 Report Share Posted June 17, 2019 The problem has been fixed Quote Link to comment Share on other sites More sharing options...
weridetogether6 Posted June 27, 2019 Author Report Share Posted June 27, 2019 I am having this problem again I don't know how to put the code in to fix this either Quote Link to comment Share on other sites More sharing options...
Stan` Posted June 27, 2019 Report Share Posted June 27, 2019 31 minutes ago, weridetogether6 said: I am having this problem again I don't know how to put the code in to fix this either What did you change when it last worked ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.