SuperSpaceInvaderTurboApoca.../doc/SAE102-SpaceInvaders/latex/de/d7a/draw_menus_8cpp_source.tex
2022-01-10 18:25:13 +01:00

189 lines
30 KiB
TeX

\hypertarget{draw_menus_8cpp_source}{}\doxysection{draw\+Menus.\+cpp}
\label{draw_menus_8cpp_source}\index{src/pixelManager/drawMenus.cpp@{src/pixelManager/drawMenus.cpp}}
\mbox{\hyperlink{draw_menus_8cpp}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00001}00001 }
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00012}00012 \textcolor{preprocessor}{\#include <chrono>}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00013}00013 \textcolor{preprocessor}{\#include <thread>}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00014}00014 \textcolor{preprocessor}{\#include "{}mingl/shape/rectangle.h"{}}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00015}00015 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{play_mode_8h}{playMode.h}}"{}}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00016}00016 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{pixel_manager_8h}{pixelManager/pixelManager.h}}"{}}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00017}00017 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{utils_8h}{utils.h}}"{}}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00018}00018 }
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00019}00019 \textcolor{keyword}{using namespace }nsShape;}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00020}00020 \textcolor{keyword}{using namespace }nsGraphics;}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00021}00021 }
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00022}\mbox{\hyperlink{class_pixel_manager_a3931894fc3a88e00c4c33e12c2be1aac}{00022}} \textcolor{keywordtype}{void} \mbox{\hyperlink{class_pixel_manager_a3931894fc3a88e00c4c33e12c2be1aac}{PixelManager::displayButton}}(\textcolor{keyword}{const} \mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}\& baseVector, \textcolor{keyword}{const} \textcolor{keywordtype}{string}\& text, nsGraphics::RGBAcolor\& color)\{}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00023}00023 \mbox{\hyperlink{class_pixel_manager_aaca742e0e39716b5e5a89e422a031c36}{window}} << Rectangle(baseVector, \mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(180, 40)+baseVector, KGray);}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00024}00024 \mbox{\hyperlink{class_pixel_manager_aaca742e0e39716b5e5a89e422a031c36}{window}} << Rectangle(baseVector+\mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(2,2), \mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(178, 38)+baseVector, KBlack);}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00025}00025 \mbox{\hyperlink{class_pixel_manager_aaca742e0e39716b5e5a89e422a031c36}{window}} << nsGui::Text(baseVector+\mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(10,22), text, color);}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00026}00026 \}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00027}00027 }
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00028}\mbox{\hyperlink{class_pixel_manager_abdbbb5087907bd0bbd44b63a6906a11f}{00028}} \textcolor{keywordtype}{void} \mbox{\hyperlink{class_pixel_manager_abdbbb5087907bd0bbd44b63a6906a11f}{PixelManager::displayMenu}}(\textcolor{keyword}{const} \mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}\& pos, \mbox{\hyperlink{struct_menu}{Menu}}\& currentMenu)\{}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00029}00029 \mbox{\hyperlink{class_pixel_manager_a061f872b418537446952b17533ff02d6}{startFrame}}();}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00030}00030 \mbox{\hyperlink{class_pixel_manager_a1aa725d6d04cce92ce8d43d58175e28f}{drawSprite}}(\mbox{\hyperlink{class_pixel_manager_a297c927d2c069c1da7d34d15b11d481d}{menuBackground}}, \mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(0, 0));}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00031}00031 \mbox{\hyperlink{class_pixel_manager_a1aa725d6d04cce92ce8d43d58175e28f}{drawSprite}}(\mbox{\hyperlink{class_pixel_manager_aa108cd115eedc01b2076844b96bc076f}{logo}},\mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(100,50));}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00032}00032 \mbox{\hyperlink{class_pixel_manager_a402e04eeae1dfe23f8da76a0bb1770a5}{drawText}}(\mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(10, 692), \textcolor{stringliteral}{"{}tips:"{}},nsGraphics::KWhite,Font::BITMAP\_8\_BY\_13);}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00033}00033 \mbox{\hyperlink{class_pixel_manager_a402e04eeae1dfe23f8da76a0bb1770a5}{drawText}}(\mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(10, 702), \textcolor{stringliteral}{"{}use 'z','s','q','d' and 'enter' to navigate the menus"{}},nsGraphics::KWhite,Font::BITMAP\_8\_BY\_13);}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00034}00034 \mbox{\hyperlink{class_pixel_manager_a402e04eeae1dfe23f8da76a0bb1770a5}{drawText}}(\mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(10, 712), \textcolor{stringliteral}{"{}see the configuration file for player specific key bindings"{}},nsGraphics::KWhite,Font::BITMAP\_8\_BY\_13);}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00035}00035 \mbox{\hyperlink{class_pixel_manager_a402e04eeae1dfe23f8da76a0bb1770a5}{drawText}}(\mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(1150, 712), \textcolor{stringliteral}{"{}version 1.0.0"{}});}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00036}00036 \textcolor{keywordtype}{unsigned} margin = 0;}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00037}00037 \textcolor{keywordtype}{unsigned} cpt = 0;}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00038}00038 \textcolor{keywordflow}{for}(\textcolor{keywordtype}{string}\& value : currentMenu.\mbox{\hyperlink{struct_menu_aea9e09a7e28e90cc5f12a91eeb0ff918}{entries}} )\{}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00039}00039 \mbox{\hyperlink{class_pixel_manager_a3931894fc3a88e00c4c33e12c2be1aac}{displayButton}}(\mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(0,0+margin)+ pos, value, (currentMenu.\mbox{\hyperlink{struct_menu_aeacef21b240be4f074d8d778c1a66c99}{currentValue}} == cpt) ? currentMenu.\mbox{\hyperlink{struct_menu_a3049aa1e1b6343216fa9b06436e46e93}{selectedColor}} : currentMenu.\mbox{\hyperlink{struct_menu_abd2654040eb88b1aec2ddcca45cf79ab}{unSelectedColor}} );}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00040}00040 ++cpt;}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00041}00041 margin += 50;}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00042}00042 \}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00043}00043 \mbox{\hyperlink{class_pixel_manager_a39a1801e2c89c10c6a5c9ef33c83e8ec}{endFrame}}();}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00044}00044 \}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00045}00045 }
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00046}00046 }
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00047}\mbox{\hyperlink{class_pixel_manager_a9bd88ddbbd706078ed039c942931df6a}{00047}} \textcolor{keywordtype}{void} \mbox{\hyperlink{class_pixel_manager_abdbbb5087907bd0bbd44b63a6906a11f}{PixelManager::displayMenu}}(\textcolor{keyword}{const} \mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}\& pos, \mbox{\hyperlink{struct_menu}{Menu}}\& currentMenu, \textcolor{keyword}{const} vector<ScoreLink>\& rankings, \textcolor{keyword}{const} \mbox{\hyperlink{utils_8h_acd2eabcda2cfc7902077f1f9a9e318de}{WinValue}}\& winner)\{}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00048}00048 \mbox{\hyperlink{class_pixel_manager_a061f872b418537446952b17533ff02d6}{startFrame}}();}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00049}00049 \mbox{\hyperlink{class_pixel_manager_a1aa725d6d04cce92ce8d43d58175e28f}{drawSprite}}(\mbox{\hyperlink{class_pixel_manager_a297c927d2c069c1da7d34d15b11d481d}{menuBackground}}, \mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(0, 0));}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00050}00050 \mbox{\hyperlink{class_pixel_manager_a1aa725d6d04cce92ce8d43d58175e28f}{drawSprite}}(\mbox{\hyperlink{class_pixel_manager_aa108cd115eedc01b2076844b96bc076f}{logo}},\mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(100,50));}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00051}00051 \mbox{\hyperlink{class_pixel_manager_a402e04eeae1dfe23f8da76a0bb1770a5}{drawText}}(\mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(1150, 700), \textcolor{stringliteral}{"{}version 1.0.0"{}});}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00052}00052 \textcolor{keywordtype}{unsigned} margin = 0;}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00053}00053 \textcolor{keywordtype}{unsigned} cpt = 0;}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00054}00054 \textcolor{keywordflow}{if} (winner == \mbox{\hyperlink{utils_8h_acd2eabcda2cfc7902077f1f9a9e318deae334ea4bb6fd38968f6809b091120ad8}{WinValue::PLAYERS}}) \mbox{\hyperlink{class_pixel_manager_a402e04eeae1dfe23f8da76a0bb1770a5}{drawText}}(\mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(0-\/55,0-\/20)+ pos,\textcolor{stringliteral}{"{}The players won, earth is now safe"{}},nsGraphics::KWhite);}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00055}00055 \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (winner == \mbox{\hyperlink{utils_8h_acd2eabcda2cfc7902077f1f9a9e318dea6c5e2f894ce45b3f0b6c6a9f35165354}{WinValue::INVADERS}}) \mbox{\hyperlink{class_pixel_manager_a402e04eeae1dfe23f8da76a0bb1770a5}{drawText}}(\mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(0-\/55,0-\/20)+ pos,\textcolor{stringliteral}{"{}The invaders have reached earth"{}},nsGraphics::KWhite);}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00056}00056 \textcolor{keywordflow}{else} \mbox{\hyperlink{class_pixel_manager_a402e04eeae1dfe23f8da76a0bb1770a5}{drawText}}(\mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(0-\/55,0-\/20)+ pos,\textcolor{stringliteral}{"{}God won, as His power are infinite"{}},nsGraphics::KWhite);}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00057}00057 \textcolor{keywordflow}{for}(\textcolor{keywordtype}{string}\& value : currentMenu.\mbox{\hyperlink{struct_menu_aea9e09a7e28e90cc5f12a91eeb0ff918}{entries}} )\{}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00058}00058 \mbox{\hyperlink{class_pixel_manager_a3931894fc3a88e00c4c33e12c2be1aac}{displayButton}}(\mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(0,0+margin)+ pos, value, (currentMenu.\mbox{\hyperlink{struct_menu_aeacef21b240be4f074d8d778c1a66c99}{currentValue}} == cpt) ? currentMenu.\mbox{\hyperlink{struct_menu_a3049aa1e1b6343216fa9b06436e46e93}{selectedColor}} : currentMenu.\mbox{\hyperlink{struct_menu_abd2654040eb88b1aec2ddcca45cf79ab}{unSelectedColor}} );}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00059}00059 ++cpt;}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00060}00060 margin += 50;}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00061}00061 \}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00062}00062 margin = 0;}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00063}00063 \mbox{\hyperlink{class_pixel_manager_a402e04eeae1dfe23f8da76a0bb1770a5}{drawText}}(\mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(0,350), \textcolor{stringliteral}{"{}Top 10 of the best players"{}},nsGraphics::KWhite);}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00064}00064 \textcolor{keywordflow}{for} (\textcolor{keyword}{auto}\& value: rankings)\{}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00065}00065 \mbox{\hyperlink{class_pixel_manager_a402e04eeae1dfe23f8da76a0bb1770a5}{drawText}}(\mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(0,400+margin),value.name,nsGraphics::KWhite,Font::BITMAP\_HELVETICA\_12);}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00066}00066 \mbox{\hyperlink{class_pixel_manager_a402e04eeae1dfe23f8da76a0bb1770a5}{drawText}}(\mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(140,400+margin),to\_string(value.score),nsGraphics::KWhite,Font::BITMAP\_HELVETICA\_12);}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00067}00067 margin += 15;}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00068}00068 \}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00069}00069 \mbox{\hyperlink{class_pixel_manager_a39a1801e2c89c10c6a5c9ef33c83e8ec}{endFrame}}();}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00070}00070 \}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00071}00071 }
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00072}\mbox{\hyperlink{class_pixel_manager_a30c8c220730ef121c78b6ff9b3a941d3}{00072}} \mbox{\hyperlink{play_mode_8h_a188092ed559d356ade9a517d60ec3f34}{PlayMode}} \mbox{\hyperlink{class_pixel_manager_a30c8c220730ef121c78b6ff9b3a941d3}{PixelManager::showInitialMenu}}()\{}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00073}00073 vector<string> entries \{\textcolor{stringliteral}{"{}single player"{}},\textcolor{stringliteral}{"{}multi player (local)"{}},\textcolor{stringliteral}{"{}exit"{}}\};}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00074}00074 \mbox{\hyperlink{struct_menu}{Menu}} initial \{entries,0,nsGraphics::KRed,nsGraphics::KWhite\};}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00075}00075 \textcolor{keywordtype}{unsigned} xOffset = \mbox{\hyperlink{class_pixel_manager_a69a986401035a12c8e12a015b7ac250a}{getScreenHeight}}() / 2 ;}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00076}00076 \textcolor{keywordtype}{unsigned} yOffset = \mbox{\hyperlink{class_pixel_manager_a755b819d8edf14edcd0d87d5fd3966fd}{getScreenWidth}}() / 2 -\/ 90;}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00077}00077 chrono::milliseconds waitTime = chrono::milliseconds(100);}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00078}00078 \textcolor{keywordflow}{while}(\mbox{\hyperlink{class_pixel_manager_aaca742e0e39716b5e5a89e422a031c36}{window}}.isOpen())\{}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00079}00079 \mbox{\hyperlink{class_pixel_manager_abdbbb5087907bd0bbd44b63a6906a11f}{displayMenu}}(\mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(yOffset,xOffset),initial);}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00080}00080 \textcolor{comment}{// go down }}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00081}00081 \textcolor{keywordflow}{if} (\mbox{\hyperlink{class_pixel_manager_aaca742e0e39716b5e5a89e422a031c36}{window}}.isPressed(\{\textcolor{stringliteral}{'s'}, false\}))\{}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00082}00082 ++initial.currentValue;}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00083}00083 \textcolor{keywordflow}{if} (initial.currentValue > initial.entries.size()-\/1) initial.currentValue = 0;}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00084}00084 this\_thread::sleep\_for(waitTime);}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00085}00085 \} }
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00086}00086 \textcolor{comment}{// go up}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00087}00087 \textcolor{keywordflow}{if} (\mbox{\hyperlink{class_pixel_manager_aaca742e0e39716b5e5a89e422a031c36}{window}}.isPressed(\{\textcolor{stringliteral}{'z'}, false\}))\{}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00088}00088 \textcolor{keywordflow}{if} (initial.currentValue == 0) initial.currentValue = initial.entries.size()-\/1;}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00089}00089 \textcolor{keywordflow}{else} -\/-\/initial.currentValue;}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00090}00090 this\_thread::sleep\_for(waitTime);}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00091}00091 \}\textcolor{comment}{// select option}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00092}00092 \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\mbox{\hyperlink{class_pixel_manager_aaca742e0e39716b5e5a89e422a031c36}{window}}.isPressed(\{13, false\}))\{}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00093}00093 \textcolor{keywordflow}{switch}(initial.currentValue)\{}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00094}00094 \textcolor{keywordflow}{case} 0:}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00095}00095 \textcolor{keywordflow}{return} \mbox{\hyperlink{play_mode_8h_a188092ed559d356ade9a517d60ec3f34a0679273e201afd0bf57af3961f8a23b8}{PlayMode::SINGLE}};}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00096}00096 \textcolor{keywordflow}{case} 1:}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00097}00097 \textcolor{keywordflow}{return} \mbox{\hyperlink{play_mode_8h_a188092ed559d356ade9a517d60ec3f34ab4a558b0213c8f288d7fabe5399a9a82}{PlayMode::TWO\_LOCAL}};}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00098}00098 \textcolor{keywordflow}{case} 2:}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00099}00099 \textcolor{keywordflow}{return} \mbox{\hyperlink{play_mode_8h_a188092ed559d356ade9a517d60ec3f34aa42b2fb0e720a080e79a92f4ca97d927}{PlayMode::EXIT}};}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00100}00100 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00101}00101 \textcolor{keywordflow}{return} \mbox{\hyperlink{play_mode_8h_a188092ed559d356ade9a517d60ec3f34a0679273e201afd0bf57af3961f8a23b8}{PlayMode::SINGLE}};}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00102}00102 \}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00103}00103 \}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00104}00104 \}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00105}00105 exit(0);}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00106}00106 \}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00107}00107 }
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00108}\mbox{\hyperlink{class_pixel_manager_aff5bd3e9f79200dbb2e7c0a5b9346625}{00108}} \textcolor{keywordtype}{void} \mbox{\hyperlink{class_pixel_manager_aff5bd3e9f79200dbb2e7c0a5b9346625}{PixelManager::askPlayerNameMenu}}(\mbox{\hyperlink{utils_8h_a19f2f2312637b6ed67b6d24598b6f470}{playerID}} pID, \textcolor{keywordtype}{unsigned} score, \textcolor{keywordtype}{string}\& name) \{}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00109}00109 name = string(6, \textcolor{charliteral}{'A'});}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00110}00110 \textcolor{keywordtype}{unsigned} currentSelected = 0 ;}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00111}00111 chrono::milliseconds waitTime = chrono::milliseconds(100);}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00112}00112 \textcolor{keywordflow}{while} (\mbox{\hyperlink{class_pixel_manager_aaca742e0e39716b5e5a89e422a031c36}{window}}.isOpen())\{}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00113}00113 \mbox{\hyperlink{class_pixel_manager_a061f872b418537446952b17533ff02d6}{startFrame}}();}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00114}00114 \mbox{\hyperlink{class_pixel_manager_a1aa725d6d04cce92ce8d43d58175e28f}{drawSprite}}(\mbox{\hyperlink{class_pixel_manager_a297c927d2c069c1da7d34d15b11d481d}{menuBackground}}, \mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(0, 0));}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00115}00115 \mbox{\hyperlink{class_pixel_manager_a402e04eeae1dfe23f8da76a0bb1770a5}{drawText}}(\mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(600, 100), \textcolor{stringliteral}{"{}Nom du joueur "{}} + to\_string(pID + 1));}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00116}00116 \mbox{\hyperlink{class_pixel_manager_a402e04eeae1dfe23f8da76a0bb1770a5}{drawText}}(\mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(600, 150), \textcolor{stringliteral}{"{}Score : "{}} + to\_string(score));}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00117}00117 \textcolor{keywordflow}{for} (\textcolor{keywordtype}{unsigned} i = 0; i < name.size(); ++i)\{}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00118}00118 \mbox{\hyperlink{class_pixel_manager_a402e04eeae1dfe23f8da76a0bb1770a5}{drawText}}(\mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(600 + 30 * i, 200), \textcolor{keywordtype}{string}(1, name[i]),}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00119}00119 (i == currentSelected) ? nsGraphics::KRed : nsGraphics::KWhite);}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00120}00120 \}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00121}00121 \mbox{\hyperlink{class_pixel_manager_a39a1801e2c89c10c6a5c9ef33c83e8ec}{endFrame}}();}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00122}00122 \textcolor{comment}{// go down }}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00123}00123 \textcolor{keywordflow}{if} (\mbox{\hyperlink{class_pixel_manager_aaca742e0e39716b5e5a89e422a031c36}{window}}.isPressed(\{\textcolor{stringliteral}{'s'}, false\}))\{}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00124}00124 ++name[currentSelected];}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00125}00125 \textcolor{keywordflow}{if} (name[currentSelected] > 90) name[currentSelected] = 65;}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00126}00126 this\_thread::sleep\_for(waitTime);}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00127}00127 \} }
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00128}00128 \textcolor{comment}{// go up}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00129}00129 \textcolor{keywordflow}{if} (\mbox{\hyperlink{class_pixel_manager_aaca742e0e39716b5e5a89e422a031c36}{window}}.isPressed(\{\textcolor{stringliteral}{'z'}, false\}))\{}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00130}00130 -\/-\/name[currentSelected];}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00131}00131 \textcolor{keywordflow}{if} (name[currentSelected] < 65) name[currentSelected] = 90;}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00132}00132 this\_thread::sleep\_for(waitTime);}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00133}00133 \}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00134}00134 \textcolor{comment}{// go right }}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00135}00135 \textcolor{keywordflow}{if} (\mbox{\hyperlink{class_pixel_manager_aaca742e0e39716b5e5a89e422a031c36}{window}}.isPressed(\{\textcolor{stringliteral}{'d'}, false\}))\{}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00136}00136 ++currentSelected;}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00137}00137 \textcolor{keywordflow}{if} (currentSelected > name.size()-\/1) currentSelected = 0;}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00138}00138 this\_thread::sleep\_for(waitTime);}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00139}00139 \}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00140}00140 \textcolor{comment}{// go left }}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00141}00141 \textcolor{keywordflow}{if} (\mbox{\hyperlink{class_pixel_manager_aaca742e0e39716b5e5a89e422a031c36}{window}}.isPressed(\{\textcolor{stringliteral}{'q'}, false\}))\{}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00142}00142 \textcolor{keywordflow}{if} (currentSelected == 0) currentSelected = name.size()-\/1;}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00143}00143 \textcolor{keywordflow}{else} -\/-\/currentSelected;}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00144}00144 this\_thread::sleep\_for(waitTime);}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00145}00145 \}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00146}00146 \textcolor{comment}{// select option}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00147}00147 \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\mbox{\hyperlink{class_pixel_manager_aaca742e0e39716b5e5a89e422a031c36}{window}}.isPressed(\{13, false\}))}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00148}00148 \{}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00149}00149 \mbox{\hyperlink{class_pixel_manager_aaca742e0e39716b5e5a89e422a031c36}{window}}.resetKey(\{13, \textcolor{keyword}{false}\});}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00150}00150 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00151}00151 \}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00152}00152 \}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00153}00153 exit(0);}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00154}00154 \}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00155}00155 }
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00156}\mbox{\hyperlink{class_pixel_manager_aca51fa0a1ef8ac59076669ac68c7e152}{00156}} \textcolor{keywordtype}{bool} \mbox{\hyperlink{class_pixel_manager_aca51fa0a1ef8ac59076669ac68c7e152}{PixelManager::showDeathMenu}}(\textcolor{keyword}{const} vector<ScoreLink>\& rankings,\textcolor{keyword}{const} \mbox{\hyperlink{utils_8h_acd2eabcda2cfc7902077f1f9a9e318de}{WinValue}}\& winner) \{}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00157}00157 vector<string> entries \{\textcolor{stringliteral}{"{}retry"{}},\textcolor{stringliteral}{"{}main menu"{}}\};}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00158}00158 \mbox{\hyperlink{struct_menu}{Menu}} death \{entries,0,nsGraphics::KRed,nsGraphics::KWhite\};}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00159}00159 \textcolor{keywordtype}{unsigned} xOffset = \mbox{\hyperlink{class_pixel_manager_a69a986401035a12c8e12a015b7ac250a}{getScreenHeight}}() / 2 ;}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00160}00160 \textcolor{keywordtype}{unsigned} yOffset = \mbox{\hyperlink{class_pixel_manager_a755b819d8edf14edcd0d87d5fd3966fd}{getScreenWidth}}() / 2 -\/ 90;}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00161}00161 chrono::milliseconds waitTime = chrono::milliseconds(100);}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00162}00162 \textcolor{keywordflow}{while}(\mbox{\hyperlink{class_pixel_manager_aaca742e0e39716b5e5a89e422a031c36}{window}}.isOpen())\{}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00163}00163 \mbox{\hyperlink{class_pixel_manager_abdbbb5087907bd0bbd44b63a6906a11f}{displayMenu}}(\mbox{\hyperlink{utils_8h_aaa06d516441b519f8892f37adafeade2}{Position}}(yOffset,xOffset),death,rankings,winner);}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00164}00164 \textcolor{comment}{// go down }}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00165}00165 \textcolor{keywordflow}{if} (\mbox{\hyperlink{class_pixel_manager_aaca742e0e39716b5e5a89e422a031c36}{window}}.isPressed(\{\textcolor{stringliteral}{'s'}, false\}))\{}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00166}00166 ++death.currentValue;}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00167}00167 \textcolor{keywordflow}{if} (death.currentValue > death.entries.size()-\/1) death.currentValue = 0;}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00168}00168 this\_thread::sleep\_for(waitTime);}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00169}00169 \} }
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00170}00170 \textcolor{comment}{// go up}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00171}00171 \textcolor{keywordflow}{if} (\mbox{\hyperlink{class_pixel_manager_aaca742e0e39716b5e5a89e422a031c36}{window}}.isPressed(\{\textcolor{stringliteral}{'z'}, false\}))\{}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00172}00172 \textcolor{keywordflow}{if} (death.currentValue == 0) death.currentValue = death.entries.size()-\/1;}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00173}00173 \textcolor{keywordflow}{else} -\/-\/death.currentValue;}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00174}00174 this\_thread::sleep\_for(waitTime);}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00175}00175 \}\textcolor{comment}{// select option}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00176}00176 \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\mbox{\hyperlink{class_pixel_manager_aaca742e0e39716b5e5a89e422a031c36}{window}}.isPressed(\{13, false\}))\{}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00177}00177 \textcolor{keywordflow}{switch}(death.currentValue)\{}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00178}00178 \textcolor{keywordflow}{case} 0:\{}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00179}00179 \textcolor{keywordflow}{return} \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00180}00180 \}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00181}00181 \textcolor{keywordflow}{case} 1:\{}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00182}00182 \mbox{\hyperlink{class_pixel_manager_aaca742e0e39716b5e5a89e422a031c36}{window}}.resetKey(\{13, \textcolor{keyword}{false}\});}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00183}00183 \textcolor{keywordflow}{return} \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00184}00184 \}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00185}00185 \}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00186}00186 \}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00187}00187 \}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00188}00188 exit(0);}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00189}00189 \}}
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00190}00190 }
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00191}00191 }
\DoxyCodeLine{\Hypertarget{draw_menus_8cpp_source_l00192}00192 }
\end{DoxyCode}