On Friday, 3 June 2016 at 15:47:16 UTC, Adam D. Ruppe wrote:
On Thursday, 2 June 2016 at 04:01:03 UTC, Pie? wrote:
Thanks, I'll look into it. I have tried OpenGL with
simpledisplay but I cannot draw to the window. I assume other
drawing methods are required?
Yeah, you have to use the OpenGL functions instead of my
painter functions.
If so, I can use gamehelpers.d to do the drawing of the images?
Yeah, the OpenGlTexture class can help with it. You can
construct it with a TrueColorImage (readPng gives MemoryImage
which you can call .getAsTrueColorImage on to get one)
Then the OpenGlTexture has a draw method which you can call
from inside the redrawOpenGlScene method. OpenGL coordinates
are different than desktop, but the `create2dWindow` method in
gamehelpers.d will create one with a matrix that matches out.
So the function might look like:
SimpleWindow window = create2dWindow("your title", width,
height);
auto image = new
OpenGlTexture(readPng(your_png_file).getAsTrueColorImage));
window.redrawOpenGlScene = {
image.draw(x, y);
};
window.eventLoop(....);
Use window.redrawOpenGlSceneNow(); in the event loop to make it
redraw.
Thanks! It is working. A few issues with my images being clipped
and not throwing when file doesn't exist... but transparency and
such does exist.
Is the display double buffered or will I need to deal with that
myself?
Also, when the window is resized it goes white. Any ideas how to
fix that?
Thanks again! Your code has been the easiest to work with!
Normally have all kinds of problems.