Maescool / Catacomb-Snatch

Mojang's Humble bundle source
Other
295 stars 99 forks source link

Fixing some Abstract* bad-uses in ModSystem. #947

Closed Shephiroth closed 12 years ago

Shephiroth commented 12 years ago

Abstract Layer is useless if we "screen.createBitmap" first, and then Image.getRGB(...,AbstractBitmap.getPixels(),...); MojamScreen can do it because is already an implementation, and as it uses MojamBitmap directly has already access to pixels.

We ask AbstractScreen to load an AbstractBitmap with an image as a source.

Changes:

Flet commented 12 years ago

Thanks, this is great.

Shephiroth commented 12 years ago

The function getPixels was correct, but its also against the AbstractLayer. Is no use if set an abstract layer to general purposes and implementation to specify how things are done, if now we try to say the abstract layer how things are done. Added a function in AbstractScreen to create AbstractBitmaps based on BufferedImages, this way is not the Abstract Layer but Implementation layer the one who specify how bitmaps are actually created. We only choose the source, not how.

I know is kind of confusing, but trust me, this should be no problem.

As for the other problem, ill get into it now.