Skip to content
Merged
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
19 changes: 11 additions & 8 deletions assets/lumenlab-logo-dark-inkscape.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/lumenlab-logo-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified board/enclosure/v2/lumenlab-enclosure-redesign.FCStd
Binary file not shown.
1 change: 1 addition & 0 deletions include/display/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ namespace Display
void drawScenesMenu();
void drawRecallGameHud();
void drawPhaseEvasionGameHud();
void drawChainReactionGameHud();
void drawDemoGameHud();
void drawCanvasSceneHud();
void drawUnconnectedControllerScreen();
Expand Down
12 changes: 8 additions & 4 deletions include/engine/state-manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "games/recall/state.h"
#include "games/phase-evasion/state.h"
#include "games/chain-reaction/state.h"
#include "games/demo/state.h"
#include "scenes/canvas/state.h"

Expand All @@ -21,6 +22,7 @@ namespace Engine
MenuScenes,
GameRecall,
GamePhaseEvasion,
GameChainReaction,
GameDemo,
SceneCanvas,
NoControllerConnected,
Expand All @@ -38,6 +40,7 @@ namespace Engine
{
Recall,
PhaseEvasion,
ChainReaction,
Demo,
COUNT
};
Expand All @@ -58,14 +61,13 @@ namespace Engine
{
public:
StateManager(SystemCore::ContextManager *ctx) : contextManager{ctx},
phaseEvasionGameState{ctx},
recallGameState{ctx},
phaseEvasionGameState{ctx},
chainReactionGameState{ctx},
systemState{SystemState::Initialize},
userMainMenuChoice{MainMenuSelection::Games},
userGameChoice{GameSelection::Recall},
userSceneChoice{SceneSelection::Canvas}
{
}
userSceneChoice{SceneSelection::Canvas} {}

bool displayShouldUpdate = true;
bool displayIsVisible = true;
Expand All @@ -92,6 +94,7 @@ namespace Engine

Games::Recall::GameState &getRecallGameState() { return recallGameState; }
Games::PhaseEvasion::GameState &getPhaseEvasionGameState() { return phaseEvasionGameState; }
Games::ChainReaction::GameState &getChainReactionGameState() { return chainReactionGameState; }
Games::Demo::GameState &getDemoGameState() { return demoGameState; }

Scenes::Canvas::SceneState &getCanvasSceneState() { return canvasSceneState; }
Expand All @@ -106,6 +109,7 @@ namespace Engine

Games::Recall::GameState recallGameState;
Games::PhaseEvasion::GameState phaseEvasionGameState;
Games::ChainReaction::GameState chainReactionGameState;
Games::Demo::GameState demoGameState;

Scenes::Canvas::SceneState canvasSceneState;
Expand Down
27 changes: 27 additions & 0 deletions include/games/chain-reaction/driver.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#pragma once

#include "engine/layer.h"
#include "engine/timer.h"
#include "core/context-manager.h"
#include "games/chain-reaction/ion-cannon.h"

namespace Games::ChainReaction
{
class Driver : public Engine::Layer, private Engine::Timer
{
public:
Driver(SystemCore::ContextManager *ctx);
~Driver() { state.reset(); }
void nextEvent() override;
void reset();
void renderIons();
void advanceActiveIon();

private:
SystemCore::ContextManager *contextManager;
GameState &state;
IonCannon cannon;

void handleDispatch();
};
}
36 changes: 36 additions & 0 deletions include/games/chain-reaction/ion-cannon.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#pragma once

#include "games/chain-reaction/ion.h"
#include "core/context-manager.h"

namespace Games::ChainReaction
{
class IonCannon
{
public:
IonCannon(SystemCore::ContextManager *ctx) : contextManager{ctx} {}
IonCannon(const IonCannon &) = delete;

static constexpr uint8_t ionWidth = 6;

IonCannon &operator=(const IonCannon &) = delete;

Ion &operator[](uint16_t index) { return ionPool[index]; }
const Ion &operator[](uint16_t index) const { return ionPool[index]; }

auto begin() { return ionPool.begin(); }
auto end() { return ionPool.end(); }
const auto begin() const { return ionPool.begin(); }
const auto end() const { return ionPool.end(); }

const size_t size() const { return ionPool.size(); }

const size_t shouldDispatch() const;
void dispatch();
void reset();

private:
SystemCore::ContextManager *contextManager;
std::vector<Ion> ionPool;
};
}
34 changes: 34 additions & 0 deletions include/games/chain-reaction/ion.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#pragma once

#include "engine/timer.h"
#include "lights/color.h"

namespace Games::ChainReaction
{
class Ion : public Engine::Timer
{
public:
Ion() { Ion(maxIonColors); }
Ion(uint8_t size);
~Ion() = default;

static constexpr uint8_t maxIonColors = 3;

const uint8_t getSize() const { return colors.size(); }

uint16_t getPosition() const { return static_cast<uint16_t>(positionFloat); }
void updatePosition();

const std::vector<Lights::Color> &getColors() const { return colors; };
void assignColors(uint8_t s);

const bool isActive() const { return active; }

std::vector<Lights::Color> colors;

private:
float positionFloat;
float speed;
bool active = true;
};
}
18 changes: 18 additions & 0 deletions include/games/chain-reaction/player.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#pragma once

#include "core/context-manager.h"
#include "player/player.h"

namespace Games::ChainReaction
{
class Player
{
public:
Player(SystemCore::ContextManager *ctx) {};
void checkAccelerator();

// void checkColorChangeRequest();

private:
};
}
34 changes: 34 additions & 0 deletions include/games/chain-reaction/state.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#pragma once

#include <cstdint>

namespace SystemCore
{
class ContextManager;
}

namespace Games::ChainReaction
{
enum class Actions
{
Startup,
Dispatch,
ActiveDrop,
GameOver
};

class GameState
{
public:
GameState(SystemCore::ContextManager *ctx) : contextManager{ctx} {}
uint16_t reactions;

Actions current = Actions::Startup;
static constexpr const char *memoryKeyName = "high_chain";

void reset();

private:
SystemCore::ContextManager *contextManager;
};
}
2 changes: 1 addition & 1 deletion include/games/phase-evasion/state.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace Games::PhaseEvasion
uint16_t gemsCaptured;
uint16_t highScore;
Actions current = Actions::Startup;
static constexpr const char *memoryKeyName = "phase-high";
static constexpr const char *memoryKeyName = "high_phase";

void reset();
void loadHighScore();
Expand Down
2 changes: 1 addition & 1 deletion include/games/recall/state.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace Games::Recall
uint16_t highScore;
uint16_t round;
Actions current = Actions::Startup;
static constexpr const char *memoryKeyName = "recall-high";
static constexpr const char *memoryKeyName = "high_recall";

void reset();
void loadHighScore();
Expand Down
2 changes: 1 addition & 1 deletion include/lights/led-luminance.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Lights
static constexpr float MAX_LED_BRIGHTNESS = 255.0f;
static constexpr int MAX_ADC_READING = 4095;

int getLuminance() { return currentLuminance; }
int getLuminance();
void adjustLuminance();
static uint8_t applyGamma(uint8_t value);

Expand Down
2 changes: 1 addition & 1 deletion src/core/configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <Preferences.h>

#ifndef LUMENLAB_VERSION
#define LUMENLAB_VERSION "v999.999.999"
#define LUMENLAB_VERSION "v99.99.99"
#endif
#ifdef USE_PS3
#define PS_CONTROLLER_TYPE "PS3"
Expand Down
11 changes: 10 additions & 1 deletion src/core/context-manager.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#include "core/context-manager.h"
#include "player/controller-properties.h"
#include "games/demo/driver.h"
#include "games/recall/driver.h"
#include "games/phase-evasion/driver.h"
#include "games/chain-reaction/driver.h"
#include "games/demo/driver.h"
#include "scenes/canvas/driver.h"
#include "logger.h"

Expand Down Expand Up @@ -31,6 +32,7 @@ namespace SystemCore
SystemCore::Configuration::load(memory);
stateManager.getPhaseEvasionGameState().loadHighScore();
stateManager.getRecallGameState().loadHighScore();
// TODO: Add loadHighScore for Chain Reaction
}

void ContextManager::checkExitRequest()
Expand Down Expand Up @@ -111,6 +113,9 @@ namespace SystemCore
case Engine::GameSelection::PhaseEvasion:
stateManager.setNext(Engine::SystemState::GamePhaseEvasion);
break;
case Engine::GameSelection::ChainReaction:
stateManager.setNext(Engine::SystemState::GameChainReaction);
break;
case Engine::GameSelection::Demo:
stateManager.setNext(Engine::SystemState::GameDemo);
break;
Expand Down Expand Up @@ -176,6 +181,10 @@ namespace SystemCore
application = new Games::PhaseEvasion::Driver{this};
logf("Transitioning to Phase Evasion (Game)");
break;
case Engine::SystemState::GameChainReaction:
application = new Games::ChainReaction::Driver{this};
logf("Transitioning to Chain Reaction (Game)");
break;
case Engine::SystemState::GameDemo:
application = new Games::Demo::Driver{this};
logf("Transitioning to Demo (Game)");
Expand Down
Loading
Loading