swingame icon indicating copy to clipboard operation
swingame copied to clipboard

Feature pixbuf

Open Aloz1 opened this issue 8 years ago • 6 comments

This pull request is in reference to issue #36

Aloz1 avatar Aug 04 '16 03:08 Aloz1

Just a note, the pascal interface for this hasn't been written yet. For some strange reason, I keep getting fatal internal errors when trying to build swingame.

Aloz1 avatar Aug 04 '16 06:08 Aloz1

We are in the process of re-writing this as SplashKit at the moment -- did you want to try incorporating your code into that repo? https://github.com/splashkit/splashkit

macite avatar Aug 07 '16 06:08 macite

Ok, thanks. I'll have a go at it. In the mean time, have you had a look at the other pull request? Because it's all low level modifications to an already existing data type, there is no need to modify the Pascal side of things.

Aloz1 avatar Aug 07 '16 21:08 Aloz1

I had a quick look, but hadn't realised the key difference :)

Which approach would you recommend? At the moment the front end in SplashKit could go either way. I'm happy to take suggestions and move forward with just one of these.

macite avatar Aug 08 '16 07:08 macite

I personally believe that modified bitmaps would be better moving forward.

TL;DR They'd result in much less code duplication in the long term and simplify the decision of what type to use for students...because there's only one choice. And are also slightly faster than pixbufs at present.

The biggest difference between the two methods is that bitmaps are able to cache any changes in gpu using textures. That could be added to the pixbuf method as well, but it would end up being almost identical to a bitmap, just with more restrictive purposes (can't draw shapes to it) and lots of duplicate code.

The bitmap method already has texture caching, so when the contents of a bitmap is rarely changed due to pixel drawing. It will be much faster drawing bitmaps to screens or other bitmaps than with pixbufs.

This could be done for pixbufs as well, but it is not a trivial addition, and there will be lots of duplicated code between bitmaps and pixbufs.

On top of that, one less data type is much more convenient to students, who won't have to decide when to use a regular bitmap vs a pixbuf.

Aloz1 avatar Aug 09 '16 03:08 Aloz1

Ok, lets go with that version then. Conversion to SplashKit should be ok, as it is mostly the same in the backend -- but it will need a little bit of work.

macite avatar Aug 09 '16 03:08 macite