Page 1 of 1

Any way to detect if DoubleBuffer is on?

Posted: Wed Sep 11, 2019 3:38 pm
by Bugala
Any way to detect if DoubleBuffer is on or off?

I am making this function that basically starts by turning doubebuffer off, but at beginning it is not on, and therefore comes error message.

I can get around this using dirty ways, but would prefer a clean way.

Re: Any way to detect if DoubleBuffer is on?

Posted: Wed Sep 11, 2019 5:37 pm
by emeck
Would checking for #ERR_NODOUBLEBUFFER with GetLastError to continue execution or disable double buffering be a clean way?

Re: Any way to detect if DoubleBuffer is on?

Posted: Wed Sep 11, 2019 8:08 pm
by Bugala
Disabling double buffer would be clean, but then I would lose the benefits of double buffer.

Error handling is not really a clean way, as a dirty trick I was thinking of disabling error messages and execute the command, then turn error handling back on, but would rather not do that.

Current solution I am thinking is simply taking care myself that doublebuffer is on when entering the function, since basically only time that is having that problem that comes to my mind is when it is called the first time, so I can first turn doublebuffering on before using it for the first time. It is bit of a hack, but if there is no way to check if double buffering is on, then I guess that is the closest to clean solution.

Re: Any way to detect if DoubleBuffer is on?

Posted: Wed Sep 11, 2019 8:31 pm
by airsoftsoftwair
You can query #ATTRDOUBLEBUFFER for #DISPLAY.

Re: Any way to detect if DoubleBuffer is on?

Posted: Wed Sep 11, 2019 9:44 pm
by emeck
Bugala wrote:
Wed Sep 11, 2019 8:08 pm
Error handling is not really a clean way, as a dirty trick I was thinking of disabling error messages and execute the command, then turn error handling back on, but would rather not do that.
OK, I understand what you mean.

Re: Any way to detect if DoubleBuffer is on?

Posted: Wed Sep 11, 2019 9:48 pm
by emeck
airsoftsoftwair wrote:
Wed Sep 11, 2019 8:31 pm
You can query #ATTRDOUBLEBUFFER for #DISPLAY.
So you can start double buffering when creating the display also or only with BeginDoubleBuffer and it is set to the current display?

Re: Any way to detect if DoubleBuffer is on?

Posted: Thu Sep 12, 2019 10:06 am
by Bugala
airsoftsoftwair wrote:
Wed Sep 11, 2019 8:31 pm
You can query #ATTRDOUBLEBUFFER for #DISPLAY.
Ah, great. Figured there might be something like that existing, just couldn't figure out where to look at, although, should have realized now that I see it.