tappytux: Large graphics rework, changes TFPRasterImage into TLazIntfImage to store sprites to increase the speed in Linux and Mac OS X

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2148 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat
2011-11-16 07:44:39 +00:00
parent d07426651b
commit 5e35b522d3
5 changed files with 144 additions and 86 deletions

View File

@@ -98,10 +98,9 @@ begin
snowmanWrong.StartPoint := vTappyTuxDrawer.GetAnimation(i).Position;
snowmanWrong.EndPoint := vTappyTuxDrawer.GetAnimation(i).Position;
snowmanWrong.Position := vTappyTuxDrawer.GetAnimation(i).Position;
snowmanWrong.Bitmap := TPortableNetworkGraphic.Create;
snowmanWrong.LoadImageFromPng(vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'snowmanwrong.png');
snowmanWrong.caption:= 'Oh-oh!';
snowmanWrong.value:= '0';
snowmanWrong.Bitmap.LoadFromFile(vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'snowmanwrong.png');
vTappyTuxDrawer.AddAnimation(snowmanWrong);
vTappyTuxDrawer.RemoveAnimation(i);
i := i -1;
@@ -184,17 +183,13 @@ begin
lTuxAnimation.IsInfinite := True;
lTuxAnimation.StartPoint := Point(250, 328);
lTuxAnimation.EndPoint := lTuxAnimation.StartPoint;
SetLength(lTuxAnimation.Bitmaps, 6);
lTuxAnimation.Bitmaps[0] := TPortableNetworkGraphic.Create;
lTuxAnimation.Bitmaps[0].LoadFromFile(vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'tux_1.png');
lTuxAnimation.Bitmaps[1] := TPortableNetworkGraphic.Create;
lTuxAnimation.Bitmaps[1].LoadFromFile(vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'tux_2.png');
lTuxAnimation.Bitmaps[2] := TPortableNetworkGraphic.Create;
lTuxAnimation.Bitmaps[2].LoadFromFile(vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'tux_3.png');
lTuxAnimation.Bitmaps[3] := TPortableNetworkGraphic.Create;
lTuxAnimation.Bitmaps[3].LoadFromFile(vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'tux_4.png');
lTuxAnimation.Bitmaps[4] := lTuxAnimation.Bitmaps[2];
lTuxAnimation.Bitmaps[5] := lTuxAnimation.Bitmaps[1];
SetLength(lTuxAnimation.Images, 6);
lTuxAnimation.LoadImageFromPng(0, vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'tux_1.png');
lTuxAnimation.LoadImageFromPng(1, vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'tux_2.png');
lTuxAnimation.LoadImageFromPng(2, vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'tux_3.png');
lTuxAnimation.LoadImageFromPng(3, vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'tux_4.png');
lTuxAnimation.LoadImageFromPng(4, vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'tux_3.png');
lTuxAnimation.LoadImageFromPng(5, vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'tux_2.png');
vTappyTuxDrawer.AddAnimation(lTuxAnimation);
for i:= 1 to 5 do
@@ -274,9 +269,8 @@ begin
snowmanAnimation.StartPoint := Point(xAux, 5);
snowmanAnimation.EndPoint := Point(xAux, 100);
snowmanAnimation.IsInfinite:= false;
snowmanAnimation.Bitmap := TPortableNetworkGraphic.Create;
snowmanAnimation.LoadImageFromPng(vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'snowman.png');
//snowmanAnimation.caption:= gameQuestionList[random(gameQuestionList.Count - 1)];
snowmanAnimation.Bitmap.LoadFromFile(vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'snowman.png');
questionType[1] := random(3);
@@ -332,10 +326,9 @@ begin
snowmanRight.StartPoint := vTappyTuxDrawer.GetAnimation(i).Position;
snowmanRight.EndPoint := vTappyTuxDrawer.GetAnimation(i).Position;
snowmanRight.Position := vTappyTuxDrawer.GetAnimation(i).Position;
snowmanRight.Bitmap := TPortableNetworkGraphic.Create;
snowmanRight.caption:= 'OK!';
snowmanRight.value:= '0';
snowmanRight.Bitmap.LoadFromFile(vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'snowmanright.png');
snowmanRight.LoadImageFromPng(vTappyTuxConfig.GetResourcesDir() + 'images' + PathDelim + 'sprites' + PathDelim + 'snowmanright.png');
vTappyTuxDrawer.AddAnimation(snowmanRight);
vTappyTuxDrawer.RemoveAnimation(i);
i := i - 1;