\hypertarget{my_sprite_8cpp_source}{}\doxysection{my\+Sprite.\+cpp}
\label{my_sprite_8cpp_source}\index{src/mySprite.cpp@{src/mySprite.cpp}}
\mbox{\hyperlink{my_sprite_8cpp}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{my_sprite_8cpp_source_l00001}00001 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{utils_8h}{utils.h}}"{}}}
\DoxyCodeLine{\Hypertarget{my_sprite_8cpp_source_l00002}00002 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{my_sprite_8h}{mySprite.h}}"{}}}
\DoxyCodeLine{\Hypertarget{my_sprite_8cpp_source_l00003}00003 }
\DoxyCodeLine{\Hypertarget{my_sprite_8cpp_source_l00004}\mbox{\hyperlink{class_my_sprite_adbc71a279bb938c9397f4c353fc0e831}{00004}} \mbox{\hyperlink{utils_8h_a7a271d55f100974f7703690edbaca2e2}{Task}} \mbox{\hyperlink{class_my_sprite_adbc71a279bb938c9397f4c353fc0e831}{MySprite::asyncLoad}}(\textcolor{keyword}{const} \textcolor{keywordtype}{string}\& fname)\{}
\DoxyCodeLine{\Hypertarget{my_sprite_8cpp_source_l00005}00005     \mbox{\hyperlink{utils_8h_aa1bc11933ce4506010028d354b3364b4}{DEBUG\_MSG}}(\textcolor{stringliteral}{"{}Load file "{}} << fname)}
\DoxyCodeLine{\Hypertarget{my_sprite_8cpp_source_l00006}00006     \textcolor{keywordflow}{return} std::async(std::launch::async, [fname, \textcolor{keyword}{this}]() -\/> \textcolor{keywordtype}{void} \{}
\DoxyCodeLine{\Hypertarget{my_sprite_8cpp_source_l00007}00007         \mbox{\hyperlink{class_my_sprite_ab5c268ae1f1082535dc15dc163910794}{sp}}.emplace(fname);}
\DoxyCodeLine{\Hypertarget{my_sprite_8cpp_source_l00008}00008     \});}
\DoxyCodeLine{\Hypertarget{my_sprite_8cpp_source_l00009}00009 \}}
\DoxyCodeLine{\Hypertarget{my_sprite_8cpp_source_l00010}00010 }
\DoxyCodeLine{\Hypertarget{my_sprite_8cpp_source_l00011}\mbox{\hyperlink{class_my_sprite_ac80878b9bd025226a903705d3b8df9ae}{00011}} \textcolor{keywordtype}{void} \mbox{\hyperlink{class_my_sprite_ac80878b9bd025226a903705d3b8df9ae}{MySprite::mirror}}(\mbox{\hyperlink{class_my_sprite}{MySprite}}\& msp) \{}
\DoxyCodeLine{\Hypertarget{my_sprite_8cpp_source_l00012}00012     \textcolor{keyword}{const} vector<RGBAcolor>\& inPixels = msp.\mbox{\hyperlink{class_my_sprite_ab5c268ae1f1082535dc15dc163910794}{sp}}-\/>getPixelData();}
\DoxyCodeLine{\Hypertarget{my_sprite_8cpp_source_l00013}00013     \textcolor{keywordtype}{unsigned} rowSize = msp.\mbox{\hyperlink{class_my_sprite_ab5c268ae1f1082535dc15dc163910794}{sp}}-\/>getRowSize();}
\DoxyCodeLine{\Hypertarget{my_sprite_8cpp_source_l00014}00014 }
\DoxyCodeLine{\Hypertarget{my_sprite_8cpp_source_l00015}00015     vector<RGBAcolor> outPixels;}
\DoxyCodeLine{\Hypertarget{my_sprite_8cpp_source_l00016}00016     \textcolor{comment}{// we reserve size so the vector doesn't dynamically grows}}
\DoxyCodeLine{\Hypertarget{my_sprite_8cpp_source_l00017}00017     outPixels.reserve(inPixels.size());}
\DoxyCodeLine{\Hypertarget{my_sprite_8cpp_source_l00018}00018     \textcolor{comment}{//for each line of pixel}}
\DoxyCodeLine{\Hypertarget{my_sprite_8cpp_source_l00019}00019     \textcolor{keywordflow}{for}(\textcolor{keywordtype}{unsigned} rowOffset=0; rowOffset < inPixels.size(); rowOffset+=rowSize)\{}
\DoxyCodeLine{\Hypertarget{my_sprite_8cpp_source_l00020}00020         \textcolor{comment}{// for each pixel of that line}}
\DoxyCodeLine{\Hypertarget{my_sprite_8cpp_source_l00021}00021         \textcolor{keywordflow}{for}(\textcolor{keywordtype}{unsigned} j=0;j<rowSize;++j) \{}
\DoxyCodeLine{\Hypertarget{my_sprite_8cpp_source_l00022}00022             \textcolor{comment}{// push back the pixel opposed to this one (still in the same line)}}
\DoxyCodeLine{\Hypertarget{my_sprite_8cpp_source_l00023}00023             outPixels.push\_back(inPixels[rowOffset + rowSize -\/ j -\/ 1]);}
\DoxyCodeLine{\Hypertarget{my_sprite_8cpp_source_l00024}00024         \}}
\DoxyCodeLine{\Hypertarget{my_sprite_8cpp_source_l00025}00025     \}}
\DoxyCodeLine{\Hypertarget{my_sprite_8cpp_source_l00026}00026     \mbox{\hyperlink{class_my_sprite_ab5c268ae1f1082535dc15dc163910794}{sp}}.emplace(outPixels, rowSize);}
\DoxyCodeLine{\Hypertarget{my_sprite_8cpp_source_l00027}00027 \}}

\end{DoxyCode}
