Added ability to change individual frame images. Needed to clone spriteimage and add a frame-count

This commit is contained in:
Tim Young 2018-02-11 14:28:37 +00:00
parent 76af207526
commit 124a2a8966
4 changed files with 121 additions and 72 deletions

View File

@ -1,5 +1,5 @@
{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f34\fbidi \froman\fcharset1\fprq2{\*\panose 02040503050406030204}Cambria Math;}
{\f39\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\f40\fbidi \fmodern\fcharset0\fprq1{\*\panose 00000000000000000000}Consolas;}{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}
{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f34\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria Math;}
{\f39\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\f40\fbidi \fmodern\fcharset0\fprq1{\*\panose 020b0609020204030204}Consolas;}{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}
{\fdbmajor\f31501\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhimajor\f31502\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0302020204030204}Calibri Light;}
{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}
{\fdbminor\f31505\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}
@ -38,60 +38,60 @@
\fs22\lang1033\langfe1033\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp1033 \snext0 \sqformat \spriority0 Normal;}{\*\cs10 \additive \ssemihidden \sunhideused \spriority1 Default Paragraph Font;}{\*
\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \ql \li0\ri0\sa160\sl259\slmult1
\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe1033\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp1033 \snext11 \ssemihidden \sunhideused
Normal Table;}}{\*\rsidtbl \rsid70908\rsid200619\rsid3222827\rsid8334151}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\operator tim.young@lightsys.org}
{\creatim\yr2017\mo9\dy20\hr8\min3}{\revtim\yr2017\mo10\dy10\hr6\min32}{\version4}{\edmins6}{\nofpages4}{\nofwords1167}{\nofchars6655}{\nofcharsws7807}{\vern91}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}}
Normal Table;}}{\*\rsidtbl \rsid70908\rsid200619\rsid3222827\rsid8334151\rsid16607907}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\operator tim.young@lightsys.org}
{\creatim\yr2017\mo9\dy20\hr8\min3}{\revtim\yr2018\mo2\dy11\hr14\min2}{\version5}{\edmins6}{\nofpages4}{\nofwords1266}{\nofchars6728}{\nofcharsws7908}{\vern93}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}}
\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect
\widowctrl\ftnbj\aenddoc\trackmoves0\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\horzdoc\dghspace120\dgvspace120\dghorigin1701
\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind1\viewscale120\rsidroot3222827 \nouicompat \fet0{\*\wgrffmtfilter 2450}\nofeaturethrottle1\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\*\pnseclvl1
\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind1\viewscale100\rsidroot3222827 \nouicompat \fet0{\*\wgrffmtfilter 2450}\nofeaturethrottle1\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\*\pnseclvl1
\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5
\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang
{\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0
\fs22\lang1033\langfe1033\loch\af31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af39 \ltrch\fcs0 \f39\lang9\langfe1033\langnp9\insrsid8334151 \hich\af39\dbch\af31505\loch\f39 1.07
\par \hich\af39\dbch\af31505\loch\f39 * Fixed a bug in the SpriteEntryForm where it was possible to drag over the edge of the sprite and\hich\af39\dbch\af31505\loch\f39 make an invalid sprite size.
\par \hich\af39\dbch\af31505\loch\f39 * Fixed a bug in the SpriteEntryForm where it was possible to drag over the edge of the sprite and make an invalid sprite size.
\par }{\rtlch\fcs1 \af39 \ltrch\fcs0 \f39\lang9\langfe1033\langnp9\insrsid16607907 \hich\af39\dbch\af31505\loch\f39 * Added an option to get the number of frames in a given animation
\par \hich\af39\dbch\af31505\loch\f39 * added an option to clone the sprit\hich\af39\dbch\af31505\loch\f39 e-image when duplicating a sprite. Slower, but sometimes necessary.
\par }{\rtlch\fcs1 \af39 \ltrch\fcs0 \f39\lang9\langfe1033\langnp9\insrsid70908 \hich\af39\dbch\af31505\loch\f39 1.0.6
\par }{\rtlch\fcs1 \af39 \ltrch\fcs0 \f39\lang9\langfe1033\langnp9\insrsid200619 \hich\af39\dbch\af31505\loch\f39 * Changed the primary home to gitlab: }{\rtlch\fcs1 \af39 \ltrch\fcs0 \f39\lang9\langfe1033\langnp9\insrsid200619\charrsid200619
\hich\af39\dbch\af31505\loch\f39 https://git.solidcharity.com/timy/SpriteLibrary}{\rtlch\fcs1 \af39 \ltrch\fcs0 \f39\lang9\langfe1033\langnp9\insrsid200619
\par \hich\af39\dbch\af31505\loch\f39 * Rebuilt the documentation
\par }{\rtlch\fcs1 \af39 \ltrch\fcs0 \f39\lang9\langfe1033\langnp9\insrsid3222827 \hich\af39\dbch\af31505\loch\f39 * Added linked sprite-controllers so we can share sprite definitions between controllers (decreases load time considerably)
\par \hich\af39\dbch\af31505\loch\f39 * Added a SpriteDatabase system that can help you define, load, and save sprites. It also decreases load time.
\par \hich\af39\dbch\af31505\loch\f39 * Added the SpriteDa\hich\af39\dbch\af31505\loch\f39
tabase OpenEditWindow, which allows you to graphically define sprites. Add your sprite images to your resources, and then make a function to call the OpenEditWindow function (passing it a filename). It will save the sprite definitions to the filename.
\hich\af39\dbch\af31505\loch\f39 T\hich\af39\dbch\af31505\loch\f39 hen you can add that file to your resources and load that new resource.
\par \hich\af39\dbch\af31505\loch\f39 * Added a SpriteDa\hich\af39\dbch\af31505\loch\f39 tabase system that can help you define, load, and save sprites. It also decreases load time.
\par \hich\af39\dbch\af31505\loch\f39 * Added the SpriteDatabase OpenEditWindow, which allows you to graphically define sprites. Add your sprite images to your resources, and then make a function to \hich\af39\dbch\af31505\loch\f39
call the OpenEditWindow function (passing it a filename). It will save the sprite definitions to the filename. Then you can add that file to your resources and load that new resource.
\par }{\rtlch\fcs1 \af39 \ltrch\fcs0 \f39\lang9\langfe1033\langnp9\insrsid70908 \hich\af39\dbch\af31505\loch\f39 * F}{\rtlch\fcs1 \af39 \ltrch\fcs0 \f39\lang9\langfe1033\langnp9\insrsid3222827 \hich\af39\dbch\af31505\loch\f39 ix}{\rtlch\fcs1 \af39 \ltrch\fcs0
\f39\lang9\langfe1033\langnp9\insrsid70908 \hich\af39\dbch\af31505\loch\f39 ed MouseEnterTransparent, MouseLeaveTransparent
\par \hich\af39\dbch\af31505\loch\f39 * Added a number more Sprite creation functions
\par \hich\af39\dbch\af31505\loch\f39 * Added a number \hich\af39\dbch\af31505\loch\f39 more Sprite creation functions
\par \hich\af39\dbch\af31505\loch\f39 * Added a number more Sprite.AddAnimation functions
\par \hich\af39\dbch\af31505\loch\f39 * Allow us to set the ending fr\hich\af39\dbch\af31505\loch\f39 ame after we animate (which frame do we display when we are done) in AnimateOnce and AnimateJustAFewTimes
\par \hich\af39\dbch\af31505\loch\f39 * After a ReplaceImage, it immediately invalidates the sprite and re-draws it.
\par \hich\af39\dbch\af31505\loch\f39 * Add a series of Events, Sprite.MouseOverTransparent, Sprite.MouseEnte\hich\af39\dbch\af31505\loch\f39
rTransparent, and Sprite.MouseLeaveTransparent. These check the transparent areas of a sprite to see if you are moving over a solid or transparent area of a sprite. For use if there is a lot of empty area inside a sprite, and you do not want to trigger
\hich\af39\dbch\af31505\loch\f39 a\hich\af39\dbch\af31505\loch\f39 MouseEnter function over the empty region.
\par \hich\af39\dbch\af31505\loch\f39 * Allow us to set the ending frame after we animate (which frame do we display when we are done) in AnimateOnce and AnimateJustAFewTimes
\par \hich\af39\dbch\af31505\loch\f39 * After a ReplaceImage, it immediate\hich\af39\dbch\af31505\loch\f39 ly invalidates the sprite and re-draws it.
\par \hich\af39\dbch\af31505\loch\f39 * Add a series of Events, Sprite.MouseOverTransparent, Sprite.MouseEnterTransparent, and Sprite.MouseLeaveTransparent. These check the transparent areas of a sprite to see if you are moving over a solid or transp
\hich\af39\dbch\af31505\loch\f39 arent area of a sprite. For use if there is a lot of empty area inside a sprite, and you do not want to trigger a MouseEnter function over the empty region.
\par \hich\af39\dbch\af31505\loch\f39 1.0.5
\par \hich\af39\dbch\af31505\loch\f39 * upgraded a lot of documentation. Started the big documentation push
\par \hich\af39\dbch\af31505\loch\f39 - inline documentation updated
\par \hich\af39\dbch\af31505\loch\f39 - inline documentat\hich\af39\dbch\af31505\loch\f39 ion updated
\par \hich\af39\dbch\af31505\loch\f39 - Online documentation file: }{\field{\*\fldinst {\rtlch\fcs1 \af39 \ltrch\fcs0 \f39\lang9\langfe1033\langnp9\insrsid70908 \hich\af39\dbch\af31505\loch\f39 HYPERLINK http://tyounglightsys.ddns.info/SpriteLibrary/doc }{
\rtlch\fcs1 \af39 \ltrch\fcs0 \f39\lang9\langfe1033\langnp9\insrsid3222827 {\*\datafield
00d0c9ea79f9bace118c8200aa004ba90b0200000003000000e0c9ea79f9bace118c8200aa004ba90b7c00000068007400740070003a002f002f00740079006f0075006e0067006c0069006700680074007300790073002e00640064006e0073002e0069006e0066006f002f005300700072006900740065004c0069006200
72006100720079002f0064006f0063000000795881f43b1d7f48af2c825dc485276300000000a5ab00030000}}}{\fldrslt {\rtlch\fcs1 \af39 \ltrch\fcs0 \f39\lang9\langfe1033\langnp9\insrsid70908 \hich\af39\dbch\af31505\loch\f39
http://tyounglightsys.ddns.info/SpriteLibrary/doc}}}\sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\rtlch\fcs1 \af39 \ltrch\fcs0 \f39\lang9\langfe1033\langnp9\insrsid70908
72006100720079002f0064006f0063000000795881f43b1d7f48af2c825dc485276300000000a5ab0003000000}}}{\fldrslt {\rtlch\fcs1 \af39 \ltrch\fcs0 \f39\lang9\langfe1033\langnp9\insrsid70908 \hich\af39\dbch\af31505\loch\f39 http://tyounglightsys.ddns.info/S
\hich\af39\dbch\af31505\loch\f39 priteLibrary/doc}}}\sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\rtlch\fcs1 \af39 \ltrch\fcs0 \f39\lang9\langfe1033\langnp9\insrsid70908
\par \hich\af39\dbch\af31505\loch\f39 - Start of a large documentation PDF - Will not see the light of day until 1.0.6
\par \hich\af39\dbch\af31505\loch\f39 * added a Sp\hich\af39\dbch\af31505\loch\f39 riteIsBeingDestroyed event. That way you can have code fired off as a particular sprite is being destroyed.
\par \hich\af39\dbch\af31505\loch\f39 * added three events; MouseHover, MouseEnter, and MouseLeave. When the mouse moves over a sprite for the first time, it does the MouseEnter. When\hich\af39\dbch\af31505\loch\f39
we move off the sprite, it does the MouseLeave, and when we pause over the sprite, it does a MouseHover.
\par \hich\af39\dbch\af31505\loch\f39 * Added sprite opacity. Sprite.opacity = .5;
\par \hich\af39\dbch\af31505\loch\f39 * added a SpriteIsBeingDestroyed event. That way you can have code fired off as a particular sprite is being destroyed.
\par \hich\af39\dbch\af31505\loch\f39 * added three events; MouseHover,\hich\af39\dbch\af31505\loch\f39
MouseEnter, and MouseLeave. When the mouse moves over a sprite for the first time, it does the MouseEnter. When we move off the sprite, it does the MouseLeave, and when we pause over the sprite, it does a MouseHover.
\par \hich\af39\dbch\af31505\loch\f39 * Added sprite opacity. Sprite.opac\hich\af39\dbch\af31505\loch\f39 ity = .5;
\par \hich\af39\dbch\af31505\loch\f39 * fixed some issues with transparency and sprites
\par \hich\af39\dbch\af31505\loch\f39 * Fixed my new way to add animations. The rotation t\hich\af39\dbch\af31505\loch\f39 hey use is opposite of what I use. So everything rotated opposite from what was expected.
\par \hich\af39\dbch\af31505\loch\f39 * Added Sprite.MoveTo(Sprite) so a Sprite can target another sprite. The moving sprite will probably need to be moving a bit faster than the destination sprite if t\hich\af39\dbch\af31505\loch\f39
he moving sprite hopes to catch up with it.
\par \hich\af39\dbch\af31505\loch\f39 * Added GetSpriteBaseImageCenter and GetSpritePictureboxCenter to find the center-point of the sprite.
\par \hich\af39\dbch\af31505\loch\f39 * Added SpriteComparisonDelegate, the ability to override the sort order (display order) of sprites. The sor\hich\af39\dbch\af31505\loch\f39
t order affects which sprite is printed on top of the other sprites. Whichever one has the highest priority is the one that appears on top of the other ones. The default sort order is created by: }{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0
\f40\fs19\cf1\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 SpriteComparisonDelegate}{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf1\insrsid70908 \hich\af40\dbch\af31505\loch\f40 = }{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0
\f40\fs19\cf2\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 delegate}{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf1\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 (}{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0
\f40\fs19\cf17\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 Sprite}{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf1\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 first, }{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0
\f40\fs19\cf17\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 Sprite}{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf1\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 \hich\af40\dbch\af31505\loch\f40 second) \{ }{\rtlch\fcs1
\af40\afs19 \ltrch\fcs0 \f40\fs19\cf2\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 return}{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf1\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 first.Zvalue.CompareTo(second.Zvalue); \};
}{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf1\insrsid70908
\par \hich\af39\dbch\af31505\loch\f39 * Fixed my new way to add animations. The rotation they use is opposite of what I use. So everything rotated opposite from what was expected.
\par \hich\af39\dbch\af31505\loch\f39 * Added Sprite.MoveTo(Sprite) so a Sprite can targe\hich\af39\dbch\af31505\loch\f39
t another sprite. The moving sprite will probably need to be moving a bit faster than the destination sprite if the moving sprite hopes to catch up with it.
\par \hich\af39\dbch\af31505\loch\f39 * Added GetSpriteBaseImageCenter and GetSpritePictureboxCenter to find the center-point of the spr\hich\af39\dbch\af31505\loch\f39 ite.
\par \hich\af39\dbch\af31505\loch\f39
* Added SpriteComparisonDelegate, the ability to override the sort order (display order) of sprites. The sort order affects which sprite is printed on top of the other sprites. Whichever one has the highest priority is the one that appears on top of
\hich\af39\dbch\af31505\loch\f39 the other ones. The default sort order is created by: }{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf1\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 SpriteComparisonDelegate}{\rtlch\fcs1 \af40\afs19
\ltrch\fcs0 \f40\fs19\cf1\insrsid70908 \hich\af40\dbch\af31505\loch\f40 = }{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf2\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 delegate}{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0
\f40\fs19\cf1\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 (}{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf17\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 Sprite}{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0
\f40\fs19\cf1\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 first, }{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf17\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 Sprite}{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0
\f40\fs19\cf1\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 second) \{ }{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf2\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 return}{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0
\f40\fs19\cf1\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 first.Zvalue.CompareTo(second.Zvalue); \}; }{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf1\insrsid70908
\par }{\rtlch\fcs1 \af39 \ltrch\fcs0 \f39\cf1\insrsid70908 \hich\af39\dbch\af31505\loch\f39 The sort function simply compares the Zvalue. A more complex version might be:}{\rtlch\fcs1 \af39 \ltrch\fcs0 \f39\lang9\langfe1033\langnp9\insrsid70908
\par }\pard \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf2\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 delegate}{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0
\f40\fs19\cf1\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 (}{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf17\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 Sprite}{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0
@ -104,40 +104,42 @@ t order affects which sprite is printed on top of the other sprites. Whichever
\hich\af40\dbch\af31505\loch\f40 (first.BaseImageLocation.Y != second.BaseImageLocation.Y) }{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf2\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 return}{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0
\f40\fs19\cf1\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 first.BaseImageLocation.Y.CompareTo(second.BaseImageLocation.Y);
\par \hich\af40\dbch\af31505\loch\f40 }{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf2\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 return}{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf1\highlight8\insrsid70908
\hich\af40\dbch\af31505\loch\f40 first.BaseImageLocation.X.CompareTo(second.B\hich\af40\dbch\af31505\loch\f40 aseImageLocation.X);
\hich\af40\dbch\af31505\loch\f40 first.BaseImageLocation.X.CompareTo(second.BaseImageLocation.X);
\par }\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf1\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 \};}{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0
\f40\fs19\cf1\insrsid70908
\par }{\rtlch\fcs1 \af39 \ltrch\fcs0 \f39\lang9\langfe1033\langnp9\insrsid70908 \hich\af39\dbch\af31505\loch\f39
* Added another way to Add Animations. We can create an animation that is a rotation of a different animation. For example, you can have something rotated by 45 or 90 degrees.
\par \hich\af39\dbch\af31505\loch\f39 * Fixed a bug with large sprites that make\hich\af39\dbch\af31505\loch\f39 other things blink
\par \hich\af39\dbch\af31505\loch\f39 * SpriteController.ResetKeypressState() clears any residual keypress. Sometimes the program misses keys being pressed and released. This clears any memory, and starts it from scratch.
\par }{\rtlch\fcs1 \af39 \ltrch\fcs0 \f39\lang9\langfe1033\langnp9\insrsid70908 \hich\af39\dbch\af31505\loch\f39 * Added another way to Add Animations. We can create an animation that is a rotation o\hich\af39\dbch\af31505\loch\f39
f a different animation. For example, you can have something rotated by 45 or 90 degrees.
\par \hich\af39\dbch\af31505\loch\f39 * Fixed a bug with large sprites that make other things blink
\par \hich\af39\dbch\af31505\loch\f39 * SpriteController.ResetKeypressState() clears any residual keypress. Sometimes the program misses key\hich\af39\dbch\af31505\loch\f39 s being pressed and released. This clears any memory, and starts it from scratch.
\par \hich\af39\dbch\af31505\loch\f39 1.0.4
\par \hich\af39\dbch\af31505\loch\f39 * fix timing issue with start-animation. It\hich\af39\dbch\af31505\loch\f39 had not been setting the animation start time.
\par \hich\af39\dbch\af31505\loch\f39 * Added ability to change the animation speed of one frame. Works across all sprites. }{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf1\lang9\langfe1033\highlight8\langnp9\insrsid70908 \hich\af40\dbch\af31505\loch\f40
ChangeFrameAnimationSpeed}{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf1\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 / GetFrameAnimationSpeed}{\rtlch\fcs1 \af39 \ltrch\fcs0 \f39\lang9\langfe1033\langnp9\insrsid70908
\par \hich\af39\dbch\af31505\loch\f39 * Added the ability to return the count of animations this sprite has \hich\af39\dbch\af31505\loch\f39 (Sprite.AnimationCount)
\par \hich\af39\dbch\af31505\loch\f39 * Added a Sprite.GetImage(animation, frame) so we can retrieve any specific image
\par \hich\af39\dbch\af31505\loch\f39 * added a sprite.unhidesprite function that does the opposite of the hidesprite function.
\par \hich\af39\dbch\af31505\loch\f39 * Fix the getanimationspeed func to return the real amount
\par \hich\af39\dbch\af31505\loch\f39 *\hich\af39\dbch\af31505\loch\f39 Add a random number generator to the sprite controller
\par \hich\af39\dbch\af31505\loch\f39 *Allow a change to the tick-speed. Default is 10ms.
\par \hich\af39\dbch\af31505\loch\f39 *Add a spriteController.DestroyAllSprites function
\par \hich\af39\dbch\af31505\loch\f39 * Added the ability to replace a sprite frame. (Sprite.ReplaceImage)
\par \hich\af39\dbch\af31505\loch\f39 * Added a }{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf1\lang9\langfe1033\highlight8\langnp9\insrsid70908 \hich\af40\dbch\af31505\loch\f40 RegisterKeyDownF\hich\af40\dbch\af31505\loch\f40 unction}{\rtlch\fcs1
\af40\afs19 \ltrch\fcs0 \f40\fs19\cf1\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 and RegisterKeyUpFunction, as well as the corresponding events on the keyfilter. This allows you to trigger things when a key is pressed and released.}{
\rtlch\fcs1 \af39 \ltrch\fcs0 \f39\lang9\langfe1033\langnp9\insrsid70908
\par \hich\af39\dbch\af31505\loch\f39 * Added a function to return all the sprites that intersect with a given rectangle
\par \hich\af39\dbch\af31505\loch\f39 * Added a Key\hich\af39\dbch\af31505\loch\f39 sPressed function that returns a list of all the keys which are currently pressed.
\par \hich\af39\dbch\af31505\loch\f39 * Repaired a glitch in playing sounds. Set the stream position back to 0 (the beginning so you can play it a second time)
\par \hich\af39\dbch\af31505\loch\f39 *Repaired a small bug with the animate-once functi\hich\af39\dbch\af31505\loch\f39 on that kept rotating the animation once it had finished.\line * Support for large sprites. SpriteController.}{\rtlch\fcs1 \af39
\ltrch\fcs0 \f39\cf1\lang9\langfe1033\highlight8\langnp9\insrsid70908 \hich\af39\dbch\af31505\loch\f39 OptimizeForLargeSpriteImages}{\rtlch\fcs1 \af39 \ltrch\fcs0 \f39\cf1\highlight8\insrsid70908 \hich\af39\dbch\af31505\loch\f39
= true/false will resize the sprite and store it in its resized state. It should print the sprite faster this way than if\hich\af39\dbch\af31505\loch\f39 it needs to squish or expand the sprite every time it goes to print it.
\par \hich\af39\dbch\af31505\loch\f39 *Add the ability to specify the starting frame when we tell the sprite to do an animation. }{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf2\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 public}{\rtlch\fcs1
\af40\afs19 \ltrch\fcs0 \f40\fs19\cf1\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 }{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf2\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 void}{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0
\f40\fs19\cf1\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 ChangeAnimation(}{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf2\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 int}{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0
\f40\fs19\cf1\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 WhichAnimation, }{\rtlch\fcs1 \ab\af40\afs19 \ltrch\fcs0 \b\f40\fs19\cf2\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 int}{\rtlch\fcs1 \ab\af40\afs19 \ltrch\fcs0
\b\f40\fs19\cf1\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 StartFrame = 0}{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf1\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 )}{\rtlch\fcs1 \af39 \ltrch\fcs0
\par \hich\af39\dbch\af31505\loch\f39 * fix timing issue with start-animation. It had not been setting the animation start time.
\par \hich\af39\dbch\af31505\loch\f39 * Added ability to change the animation speed of one frame. Works across a\hich\af39\dbch\af31505\loch\f39 ll sprites. }{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf1\lang9\langfe1033\highlight8\langnp9\insrsid70908
\hich\af40\dbch\af31505\loch\f40 ChangeFrameAnimationSpeed}{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf1\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 / GetFrameAnimationSpeed}{\rtlch\fcs1 \af39 \ltrch\fcs0
\f39\lang9\langfe1033\langnp9\insrsid70908
\par \hich\af39\dbch\af31505\loch\f39 * Added the ability to return the count of animations this sprite has (Sprite.AnimationCount)
\par \hich\af39\dbch\af31505\loch\f39 * Added a Sprite.GetImage(animation, frame) so we can retrieve any specific image
\par \hich\af39\dbch\af31505\loch\f39 * added a sprite.\hich\af39\dbch\af31505\loch\f39 unhidesprite function that does the opposite of the hidesprite function.
\par \hich\af39\dbch\af31505\loch\f39 * Fix the getanimationspeed func to return the real amount
\par \hich\af39\dbch\af31505\loch\f39 * Add a random number generator to the sprite controller
\par \hich\af39\dbch\af31505\loch\f39 *Allow a change to the tick-speed. Default is 10ms.
\par \hich\af39\dbch\af31505\loch\f39 *Add a spriteC\hich\af39\dbch\af31505\loch\f39 ontroller.DestroyAllSprites function
\par \hich\af39\dbch\af31505\loch\f39 * Added the ability to replace a sprite frame. (Sprite.ReplaceImage)
\par \hich\af39\dbch\af31505\loch\f39 * Added a }{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf1\lang9\langfe1033\highlight8\langnp9\insrsid70908 \hich\af40\dbch\af31505\loch\f40 RegisterKeyDownFunction}{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0
\f40\fs19\cf1\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 and RegisterKeyUpFunction, as well as the corresponding events on the keyfilter. This allows you to trigger things\hich\af40\dbch\af31505\loch\f40
when a key is pressed and released.}{\rtlch\fcs1 \af39 \ltrch\fcs0 \f39\lang9\langfe1033\langnp9\insrsid70908
\par \hich\af39\dbch\af31505\loch\f39 * Added a function to return all the sprites that intersect with a given rectangle
\par \hich\af39\dbch\af31505\loch\f39 * Added a KeysPressed function that returns a list of all the keys which are currently pressed.
\par \hich\af39\dbch\af31505\loch\f39 * Repaired a glitch in playing sounds. \hich\af39\dbch\af31505\loch\f39 Set the stream position back to 0 (the beginning so you can play it a second time)
\par \hich\af39\dbch\af31505\loch\f39 *Repaired a small bug with the animate-once function that kept rotating the animation once it had finished.\line * Support for large sprites. SpriteController.}{\rtlch\fcs1 \af39 \ltrch\fcs0
\f39\cf1\lang9\langfe1033\highlight8\langnp9\insrsid70908 \hich\af39\dbch\af31505\loch\f39 OptimizeForLargeSp\hich\af39\dbch\af31505\loch\f39 riteImages}{\rtlch\fcs1 \af39 \ltrch\fcs0 \f39\cf1\highlight8\insrsid70908 \hich\af39\dbch\af31505\loch\f39
= true/false will resize the sprite and store it in its resized state. It should print the sprite faster this way than if it needs to squish or expand the sprite every time it goes to print it.
\par \hich\af39\dbch\af31505\loch\f39 *Add the ability to specify the starting frame whe\hich\af39\dbch\af31505\loch\f39 n we tell the sprite to do an animation. }{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf2\highlight8\insrsid70908
\hich\af40\dbch\af31505\loch\f40 public}{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf1\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 }{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf2\highlight8\insrsid70908
\hich\af40\dbch\af31505\loch\f40 void}{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf1\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 ChangeAnimation(}{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf2\highlight8\insrsid70908
\hich\af40\dbch\af31505\loch\f40 int}{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf1\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 WhichAnimation, }{\rtlch\fcs1 \ab\af40\afs19 \ltrch\fcs0 \b\f40\fs19\cf2\highlight8\insrsid70908
\hich\af40\dbch\af31505\loch\f40 int}{\rtlch\fcs1 \ab\af40\afs19 \ltrch\fcs0 \b\f40\fs19\cf1\highlight8\insrsid70908 \hich\af40\dbch\af31505\loch\f40 StartFrame = 0}{\rtlch\fcs1 \af40\afs19 \ltrch\fcs0 \f40\fs19\cf1\highlight8\insrsid70908
\hich\af40\dbch\af31505\loch\f40 )}{\rtlch\fcs1 \af39 \ltrch\fcs0 \f39\lang9\langfe1033\langnp9\insrsid70908
\par \hich\af39\dbch\af31505\loch\f39 1.0.3
\par \hich\af39\dbch\af31505\loch\f39 * Fixed a problem in the "animate a few times" function. It basically would only animate once, regardless of how many times you told it to animate.
\par \hich\af39\dbch\af31505\loch\f39 * Fixed a problem in the sound. I was itterating through a list of sounds, and the list changed. My foreach loop would break. Changed that. Thanks, Warren for pointing that out.
@ -300,8 +302,8 @@ fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffff0c6ad98892f1d411a65f0040963251e50000000000000000000000001066
bf7abb41d301feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000
ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffff0c6ad98892f1d411a65f0040963251e5000000000000000000000000c0e7
b30341a3d301feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000105000000000000}}

View File

@ -4,12 +4,15 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
namespace SpriteLibrary
{
/// <summary>
/// A single frame of an animation
/// </summary>
[Serializable]
internal class AnimationSingleFrame
{
public Image Frame;
@ -22,6 +25,8 @@ namespace SpriteLibrary
ResizedFrame = null;
}
}
[Serializable]
internal class AnimationFrame
{
public int SingleFrameID; //The ID number of the image we want to view
@ -37,6 +42,7 @@ namespace SpriteLibrary
/// <summary>
/// One animation. A series of images.
/// </summary>
[Serializable]
internal class Animation
{
public int AnimationID;
@ -228,6 +234,7 @@ namespace SpriteLibrary
List<AnimationSingleFrame> Frames = new List<AnimationSingleFrame>();
public int FrameCount { get { return Frames.Count; } }
public int AnimationCount { get { return Animations.Count; } }
private SmartImage() { }
public SmartImage(SpriteController Controller, Image SpriteImage)
{
@ -254,6 +261,25 @@ namespace SpriteLibrary
AddAnimation(Start, SpriteImage, width, height, duration, Count);
}
public static SmartImage Clone(SmartImage Orig)
{
SmartImage tClone = new SmartImage();
tClone.MyController = Orig.MyController;
tClone.Animations = PartClone<List<Animation>>(Orig.Animations);
tClone.Frames = PartClone<List<AnimationSingleFrame>>(Orig.Frames);
return tClone;
}
public static T PartClone<T>(T obj)
{
using (var ms = new MemoryStream())
{
var formatter = new BinaryFormatter();
formatter.Serialize(ms, obj);
ms.Position = 0;
return (T)formatter.Deserialize(ms);
}
}
public Animation getAnimation(int index)
{

View File

@ -192,7 +192,7 @@ namespace SpriteLibrary
public bool CannotMoveOutsideBox = false; //If set to true, it will not automatically move outside the picture box.
/// <summary>
/// Get or set the animation nimber. It is best to change the animation using ChangeAnimation.
/// Get or set the animation number. It is best to change the animation using ChangeAnimation.
/// It is safer.
/// </summary>
public int AnimationIndex
@ -209,6 +209,17 @@ namespace SpriteLibrary
get { return MyImage.AnimationCount; }
}
/// <summary>
/// Return the number of frames in the specified animation
/// </summary>
/// <param name="animation">the index for the animation you want to find the number of frames for</param>
/// <returns>the number of indexes in the specified animation. Returns -1 if the animation does not exist</returns>
public int AnimationFrameCount(int animation)
{
if (animation < 0 || animation >= MyImage.AnimationCount) return -1; //error
return MyImage.AnimationFrameCount(animation);
}
//The location and size of the sprite
int xPositionOnImage = -1;
int yPositionOnImage = -1;
@ -629,13 +640,19 @@ namespace SpriteLibrary
/// </summary>
/// <param name="OldSprite">The Sprite to make a copy of</param>
/// <param name="RetainName">If we want to set this sprite name to be that of the original. This is a terrible idea. Never do it.</param>
public Sprite(Sprite OldSprite, bool RetainName = false)
/// <param name="CloneImage">When set to true, the image is duplicated, not just referenced. If you are going to mess with individual image frames, you want to do this.</param>
public Sprite(Sprite OldSprite, bool RetainName = false, bool CloneImage = false)
{
MySpriteController = OldSprite.MySpriteController;
ID = MySpriteController.SpriteCount;
Width = OldSprite.Width;
Height = OldSprite.Height;
MyImage = OldSprite.MyImage;
//do a deep clone of the smartimage if we want to make a duplicate..
if (!CloneImage)
MyImage = OldSprite.MyImage;
else
MyImage = SmartImage.Clone(OldSprite.MyImage);
MovementSpeed = OldSprite.MovementSpeed;
SpriteOriginName = OldSprite.SpriteName;

View File

@ -999,12 +999,16 @@ namespace SpriteLibrary
/// </code>
/// </example>
/// <param name="Name">The name of a sprite</param>
/// <param name="CloneImage">Normally, sprites all use the same images for their animations. To keep the memory
/// footprint small, they all reference the same sprite image. CloneImage to true will duplicate the images
/// used to make the sprite. This will use up more memory, but it will allow you to change the images without
/// affecting the rest of your sprites. This function is a fair bit slower when using CloneImage.</param>
/// <returns>A duplicate of the specified sprite. It has no location, and does not retain the sprite name.</returns>
public Sprite DuplicateSprite(string Name)
public Sprite DuplicateSprite(string Name, bool CloneImage = false)
{
Sprite tSprite = SpriteFromName(Name);
if (tSprite == null) return null;
return new Sprite(tSprite); //Make a new sprite that is based off the original
return new Sprite(tSprite,false,CloneImage); //Make a new sprite that is based off the original
}
/// <summary>