MCPcopy Create free account
hub / github.com/OneLoneCoder/olcPixelGameEngine / OnBeforeUserUpdate

Method OnBeforeUserUpdate

extensions/olcPGEX_QuickGUI.h:1112–1172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1110 }
1111
1112 bool ModalDialog::OnBeforeUserUpdate(float& fElapsedTime)
1113 {
1114 if(!m_bShowDialog) return false;
1115
1116 m_manFileSelect.Update(this->pge);
1117
1118 if (pge->GetKey(olc::Key::BACK).bPressed)
1119 {
1120 m_path = m_path.parent_path().string() + "/";
1121 //m_listDirectory->bSelectionChanged = true;
1122 //m_listDirectory->nSelectedItem = 0;
1123 }
1124
1125 if (m_listDirectory->bSelectionChanged)
1126 {
1127 std::string sDirectory = m_vDirectory[m_listDirectory->nSelectedItem];
1128 /*if (sDirectory == "..")
1129 m_path = m_path.parent_path().string() + "/";
1130 else
1131 m_path += sDirectory+ "/";*/
1132
1133
1134 m_path += sDirectory + "/";
1135 // Reconstruct Lists
1136 m_vDirectory.clear();
1137
1138 m_vFiles.clear();
1139
1140
1141 for (auto const& dir_entry : std::filesystem::directory_iterator{ m_path })
1142 {
1143 if (dir_entry.is_directory() || dir_entry.is_other())
1144 m_vDirectory.push_back(dir_entry.path().filename().string());
1145 else
1146 m_vFiles.push_back(dir_entry.path().filename().string());
1147 }
1148
1149 //m_vDirectory.push_back("..");
1150
1151 //m_listFiles->nSelectedItem = 0;
1152 //m_listDirectory->nSelectedItem = 0;
1153
1154 }
1155
1156 pge->DrawStringDecal({ 0,0 }, m_path.string());
1157
1158
1159
1160
1161 m_manFileSelect.DrawDecal(this->pge);
1162
1163
1164
1165 if (pge->GetKey(olc::Key::ESCAPE).bPressed)
1166 {
1167 m_bShowDialog = false;
1168 return false;
1169 }

Callers

nothing calls this directly

Calls 6

GetKeyMethod · 0.80
push_backMethod · 0.80
UpdateMethod · 0.45
clearMethod · 0.45
DrawStringDecalMethod · 0.45
DrawDecalMethod · 0.45

Tested by

no test coverage detected