adamdruppe: Drawing scaled image

Pie? via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jun 4 08:27:45 PDT 2016


On Saturday, 4 June 2016 at 02:22:37 UTC, Adam D. Ruppe wrote:
> On Friday, 3 June 2016 at 20:06:50 UTC, Pie? wrote:
>> Thanks! It is working. A few issues with my images being 
>> clipped and not throwing when file doesn't exist...
>
> That's weird.. I don't know what's going on there.
>
> BTW have you seen my documentation site too? 
> http://dpldocs.info/experimental-docs/arsd.gamehelpers.OpenGlTexture.draw.1.html
>
> It has a lot of my modules as well as my fork of the official 
> Phobos docs.
>
> But the clipping and throwing shouldn't be a problem.
>
>> Is the display double buffered or will I need to deal with 
>> that myself?
>
> That's automatic.
>
>> Also, when the window is resized it goes white. Any ideas how 
>> to fix that?
>
> It might help to set a window.windowResized handler
>
> window.windowResized = (int width, int height) {
>    window.redrawOpenGlSceneNow();
> };
>
> though I thought I did that automatically, I might have messed 
> it up (I don't often resize windows when using opengl mode...)
>
>> Thanks again! Your code has been the easiest to work with! 
>> Normally have all kinds of problems.
>
> yea, I try to keep it simple - I like minimal dependencies so 
> things just work without a complicated build process, but 
> sometimes I drop balls. If you ever want to do patches btw, I 
> also try to keep the code fairly simple so hacking on it 
> shouldn't be too hard.


Thanks. I will work on improving it the best I can when I 
actually improve upon it ;)

In the simple display code, windowResized happens at the end of a 
resize. You explicitly mention that WM_SIZING was not handled 
because of performance issues in your code.

I tried to add a windowResizing but, of course, the delegate 
signature conflicts with windowResized. I was thinking about 
about to accomplish this.

Would it be better for events to have "Features"? e.g., to deal 
with identical signatures?

e.g.,

delegate (int w, int h, Feature f)

and when the delegate is called we can use f to disambiguate the 
call? (same call for WM_SIZE and WM_SIZING)

Of course, we could create more separation by somehow allowing 
for separate assignment.... but not sure of any cool way to do 
this?

Right now you add delegates to the event handling using an array.

...,delegate (int w, int h) { },...

It would be cool if we could add "specifiers" or possibly 
attributes to them.

..., (delegate (int w, int h) { }).Resized, (delegate (int w, int 
h) { }).Resizing,...

Any ideas on that?



More information about the Digitalmars-d-learn mailing list