feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title) - OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update) - Window resize events trigger scene.on_resize callbacks - Scene transitions (fade, slide_left/right/up/down) with smooth animations - Full integration of Python Scene objects with C++ engine All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
This commit is contained in:
parent
f76a26c120
commit
eaeef1a889
11 changed files with 1305 additions and 11 deletions
42
src/SceneTransition.h
Normal file
42
src/SceneTransition.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#pragma once
|
||||
#include "Common.h"
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
enum class TransitionType {
|
||||
None,
|
||||
Fade,
|
||||
SlideLeft,
|
||||
SlideRight,
|
||||
SlideUp,
|
||||
SlideDown
|
||||
};
|
||||
|
||||
class SceneTransition {
|
||||
public:
|
||||
TransitionType type = TransitionType::None;
|
||||
float duration = 0.0f;
|
||||
float elapsed = 0.0f;
|
||||
std::string fromScene;
|
||||
std::string toScene;
|
||||
|
||||
// Render textures for transition
|
||||
std::unique_ptr<sf::RenderTexture> oldSceneTexture;
|
||||
std::unique_ptr<sf::RenderTexture> newSceneTexture;
|
||||
|
||||
// Sprites for rendering textures
|
||||
sf::Sprite oldSprite;
|
||||
sf::Sprite newSprite;
|
||||
|
||||
SceneTransition() = default;
|
||||
|
||||
void start(TransitionType t, const std::string& from, const std::string& to, float dur);
|
||||
void update(float dt);
|
||||
void render(sf::RenderTarget& target);
|
||||
bool isComplete() const { return elapsed >= duration; }
|
||||
float getProgress() const { return duration > 0 ? std::min(elapsed / duration, 1.0f) : 1.0f; }
|
||||
|
||||
// Easing function for smooth transitions
|
||||
static float easeInOut(float t);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue