Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions source/FPSciApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ void FPSciApp::initExperiment(){

updateMouseSensitivity(); // Update (apply) mouse sensitivity
const Array<String> sessions = m_userSettingsWindow->updateSessionDropDown(); // Update the session drop down to remove already completed sessions
m_firstSession = true;
updateSession(sessions[0], true); // Update session to create results file/start collection
}

Expand Down Expand Up @@ -360,7 +361,7 @@ void FPSciApp::updateDeveloperControls(const shared_ptr<FpsConfig>& config) {
if (notNull(m_playerControls)) {
visible = m_playerControls->visible();
rect = m_playerControls->rect();
removeWidget(m_playerControls);
if(m_widgetManager->contains(m_playerControls)) removeWidget(m_playerControls);
}
m_playerControls = PlayerControls::create(*config, std::bind(&FPSciApp::exportScene, this), theme);
m_playerControls->setVisible(visible);
Expand All @@ -373,7 +374,7 @@ void FPSciApp::updateDeveloperControls(const shared_ptr<FpsConfig>& config) {
if (notNull(m_renderControls)) {
visible = m_renderControls->visible();
rect = m_renderControls->rect();
removeWidget(m_renderControls);
if(m_widgetManager->contains(m_renderControls)) removeWidget(m_renderControls);
}
m_renderControls = RenderControls::create(this, *config, renderFPS, numReticles, sceneBrightness, theme, MAX_HISTORY_TIMING_FRAMES);
m_renderControls->setVisible(visible);
Expand All @@ -386,7 +387,7 @@ void FPSciApp::updateDeveloperControls(const shared_ptr<FpsConfig>& config) {
if (notNull(m_weaponControls)) {
visible = m_weaponControls->visible();
rect = m_weaponControls->rect();
removeWidget(m_weaponControls);
if(m_widgetManager->contains(m_weaponControls)) removeWidget(m_weaponControls);
}
m_weaponControls = WeaponControls::create(config->weapon, theme);
m_weaponControls->setVisible(visible);
Expand All @@ -400,15 +401,21 @@ void FPSciApp::makeGUI() {
debugWindow->setVisible(startupConfig.developerMode);

if (startupConfig.developerMode) {
if (m_widgetManager->contains(developerWindow->cameraControlWindow)) removeWidget(developerWindow->cameraControlWindow);
developerWindow->cameraControlWindow->setVisible(startupConfig.developerMode);
addWidget(developerWindow->cameraControlWindow);

if (m_widgetManager->contains(developerWindow->videoRecordDialog)) removeWidget(developerWindow->videoRecordDialog);
developerWindow->videoRecordDialog->setEnabled(true);
developerWindow->videoRecordDialog->setCaptureGui(true);
addWidget(developerWindow->videoRecordDialog);

// Update the scene editor (for new PhysicsScene pointer, initially loaded in GApp)
removeWidget(developerWindow->sceneEditorWindow);
if(m_widgetManager->contains(developerWindow->sceneEditorWindow)) removeWidget(developerWindow->sceneEditorWindow);
developerWindow->sceneEditorWindow = SceneEditorWindow::create(this, scene(), theme);
developerWindow->sceneEditorWindow->moveTo(developerWindow->cameraControlWindow->rect().x0y1() + Vector2(0, 15));
developerWindow->sceneEditorWindow->setVisible(startupConfig.developerMode);
addWidget(developerWindow->sceneEditorWindow);
}

// Open sub-window buttons here (menu-style)
Expand All @@ -421,7 +428,7 @@ void FPSciApp::makeGUI() {
}debugPane->endRow();

// Create the user settings window
if (notNull(m_userSettingsWindow)) { removeWidget(m_userSettingsWindow); }
if (notNull(m_userSettingsWindow) && m_widgetManager->contains(m_userSettingsWindow)) { removeWidget(m_userSettingsWindow); }
m_userSettingsWindow = UserMenu::create(this, userTable, userStatusTable, sessConfig->menu, theme, Rect2D::xywh(0.0f, 0.0f, 10.0f, 10.0f));
addWidget(m_userSettingsWindow);
openUserSettingsWindow();
Expand Down
5 changes: 3 additions & 2 deletions source/FPSciApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,9 @@ class FPSciApp : public GApp {
void saveUserStatus(void);

// Pass throughts to user settings window (for now)
Array<String> updateSessionDropDown(void) { return m_userSettingsWindow->updateSessionDropDown(); }
shared_ptr<UserConfig> const currentUser(void) { return userTable.getUserById(userStatusTable.currentUser); }
Array<String> updateSessionDropDown(void) const { return m_userSettingsWindow->updateSessionDropDown(); }
shared_ptr<UserConfig> const currentUser(void) const { return userTable.getUserById(userStatusTable.currentUser); }
const bool userSettingsVisible() const { return m_userSettingsWindow->visible(); }

void markSessComplete(String id);
/** Updates experiment state to the provided session id and updates player parameters (including mouse sensitivity) */
Expand Down
25 changes: 0 additions & 25 deletions source/GuiElements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,17 +233,6 @@ RenderControls::RenderControls(FPSciApp* app, FpsConfig& config, bool& drawFps,
c->setWidth(width*0.95f);
}framePane->endRow();

auto menuPane = pane->addPane("User Menu");
menuPane->beginRow(); {
m_storedMenuConfig.allowReticleChange = true;
m_storedMenuConfig.allowReticleChangeTimeChange = true;
m_showFullUserMenuBtn = menuPane->addButton("Show Full User Menu", this, &RenderControls::updateUserMenu);
if (config.menu.allowAnyChange()) {
// Default setup already allows any change
m_showFullUserMenuBtn->setEnabled(false);
m_showFullUserMenu = true;
}
} menuPane->endRow();

auto otherPane = pane->addPane("Other");
otherPane->beginRow();{
Expand All @@ -255,20 +244,6 @@ RenderControls::RenderControls(FPSciApp* app, FpsConfig& config, bool& drawFps,
moveTo(Vector2(0, 300));
}

void RenderControls::updateUserMenu() {
MenuConfig tmp = m_app->sessConfig->menu; // Store current config
m_app->sessConfig->menu = m_storedMenuConfig; // Swap the config w/ the stored version
if (!m_showFullUserMenu) {
m_showFullUserMenu = true;
m_showFullUserMenuBtn->setCaption("Hide Full User Menu");
}
else {
m_showFullUserMenu = false;
m_showFullUserMenuBtn->setCaption("Show Full User Menu");
}
m_storedMenuConfig = tmp; // Update the stored config
m_app->updateUserMenu = true; // Set the semaphore to update the user menu
}

WeaponControls::WeaponControls(WeaponConfig& config, const shared_ptr<GuiTheme>& theme, float width, float height) :
GuiWindow("Weapon Controls", theme, Rect2D::xywh(5, 5, width, height), GuiTheme::NORMAL_WINDOW_STYLE, GuiWindow::HIDE_ON_CLOSE), m_config(config)
Expand Down
3 changes: 0 additions & 3 deletions source/GuiElements.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,8 @@ class RenderControls : public GuiWindow {
protected:
FPSciApp* m_app = nullptr;
GuiButton* m_showFullUserMenuBtn = nullptr;
MenuConfig m_storedMenuConfig;
bool m_showFullUserMenu = false;

void updateUserMenu(void);

RenderControls(FPSciApp* app, FpsConfig& config, bool& drawFps, const int numReticles, float& brightness,
const shared_ptr<GuiTheme>& theme, const int maxFrameDelay = 360, const float minFrameRate = 1.0f, const float maxFrameRate=1000.0f, float width=400.0f, float height=10.0f);
public:
Expand Down
7 changes: 4 additions & 3 deletions source/Session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ bool Session::nextTrial() {
m_app->updateTrial(m_trialConfig, false, m_firstTrial);
if (m_firstTrial) m_firstTrial = false;
else {
m_app->showUserMenu = false; // Override showing the user menu after the first trial in the session
m_app->showUserMenu = m_app->userSettingsVisible(); // Override showing the user menu after the first trial in the session
}

// Update session fields (if changed) from trial
Expand Down Expand Up @@ -400,8 +400,9 @@ void Session::onInit(String filename, String description) {
m_targetConfigs = m_app->experimentConfig.getTargetsByTrial(m_sessConfig->id);
nextBlock(true);
}
else { // Invalid session, move to displaying message
currentState = PresentationState::sessionFeedback;
else {
currentState = PresentationState::sessionFeedback; // Invalid session, move to displaying message
m_app->trialConfig = TrialConfig::create(); // Update the app trial config to inherit the session parameters (i.e. user add)
}
}

Expand Down
2 changes: 1 addition & 1 deletion source/UserStatus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ void UserStatusTable::validate(const Array<String>& sessions, const Array<String
for (String userSessId : userStatus.sessionOrder) {
noSessions = false;
if (!sessions.contains(userSessId)) {
throw format("User \"%s\" has session with ID: \"%s\" in their User Status \"sessions\" Array. This session ID does not appear in the experiment config file's \"sessions\" array. Valid options are: %s", userStatus.id, userSessId, expSessions);
throw format("User \"%s\" has session with ID: \"%s\" in their User Status \"sessions\" Array. This session ID does not appear in the experiment config file's \"sessions\" array. Valid options are: %s", userStatus.id, userSessId, expSessions.c_str());
}
}
}
Expand Down