Here's an interesting testbed:
Well, well. I am enjoying my OOP. This testbed needs a (small; under 50x50) image file called image.png.
What I think SHOULD happen is the first image is drawn at the original size, the second image at 4 times larger and then the third image at the original size again. Well, that was the intent.
What actually happens is the third image is also drawn scaled.
I believe I understand what is actually happenning, but I wondered is this actually correct behaviour? If it is correct, is there an easy way around it? I can't set the scale while loading the image associated with for ShouldNotDrawScaled because it throws a compiler error of course.
What do y'all think?
Type TUnscaled Field Image:TImage Method Load(file$) Image = LoadImage(file$) End Method Method Draw(x:Int,y:Int) DrawImage Image,x,y End Method End Type Type TScaled Extends TUnscaled Field scale:Int = 4 Method Draw(x:Int , y:Int) SetScale scale , scale Super.Draw x,y SetScale 1 , 1 End Method End Type Type TTester Method DoIt() End Method End Type Type TGame Field Image:TUnscaled = New TUnscaled Method CallNextTest(test:TTester,x:Int,y:Int) test.DoIt Image.Draw x,y End Method End Type Type TTest1 Extends TTester Method DoIt() Game.Image.Load "image.png" End Method End Type Type TTest2 Extends TTester Field Image:TScaled = New TScaled Method DoIt() Image.Load "image.png" Game.Image=Image End Method End Type ' phew! Local ShouldNotDrawScaled:TTest1 Local ShouldDrawScaled:TTest2 Global Game:TGame = New TGame Graphics 800,600 ShouldNotDrawScaled = New TTest1 Game.CallNextTest ShouldNotDrawScaled,100,100 ShouldDrawScaled = New TTest2 Game.CallNextTest ShouldDrawScaled,200,200 ShouldNotDrawScaled = New TTest1 Game.CallNextTest ShouldNotDrawScaled,400,400 Flip WaitMouse End
Well, well. I am enjoying my OOP. This testbed needs a (small; under 50x50) image file called image.png.
What I think SHOULD happen is the first image is drawn at the original size, the second image at 4 times larger and then the third image at the original size again. Well, that was the intent.
What actually happens is the third image is also drawn scaled.
I believe I understand what is actually happenning, but I wondered is this actually correct behaviour? If it is correct, is there an easy way around it? I can't set the scale while loading the image associated with for ShouldNotDrawScaled because it throws a compiler error of course.
What do y'all think?