73 ProjectFile(
char name[256],
int width,
int height,
char author[100],
82 [[nodiscard]]
const char*
AnimName()
const;
140 [[nodiscard]]
int AnimFPS()
const;
154 [[nodiscard]]
const char*
AnimDesc()
const;
186 m_BG =
Col{.r =
static_cast<unsigned char>(
187 std::clamp(bgCol[0] * 255, 0.0f, 255.0f)),
188 .g =
static_cast<unsigned char>(
189 std::clamp(bgCol[1] * 255, 0.0f, 255.0f)),
190 .b =
static_cast<unsigned char>(
191 std::clamp(bgCol[2] * 255, 0.0f, 255.0f))};
228 void Write(
const char* fileName);
243 void Export(
const char* filePath,
int format);
280 template <
typename T>
281 requires std::derived_from<std::remove_cvref_t<T>,
Action>
283 using U = std::remove_cvref_t<T>;
286 m_UndoStack.push(std::make_unique<U>(std::forward<T>(action)));
Core type definitions used across FuncDoodle.
Dynamic container for storing animation frames in indexed order.
Logging system, assertion macros, platform utilities, and build/config macros.
Defines pixel color structures and frame/image data containers.
Convenience type aliases for standard smart pointers.
std::shared_ptr< T > SharedPtr
Alias for a reference-counted shared smart pointer.
Definition Ptr.h:31
GLFW-based window abstraction for FuncDoodle.
Base interface for undoable and redoable editor actions.
Definition Common.h:24
ProjectFile(char name[256], int width, int height, char author[100], int fps, char desc[512], Platform::Window *win, Col bgCol)
Creates a new in-memory project file.
Definition Project.cc:32
void SetAnimWidth(int width, bool clear=false)
Sets the animation width.
Definition Project.cc:122
Col m_BG
Definition Project.h:324
const char * AnimDesc() const
Returns the animation description.
Definition Project.cc:153
void Undo()
Undoes the most recent action on the undo stack.
Definition Project.cc:167
SharedPtr< LongIndexArray > AnimFrames()
Returns the animation frame storage.
Definition Project.cc:163
void SetAnimFrameCount(unsigned long count)
Resizes the animation frame count.
void SetAnimHeight(int height, bool clear=false)
Sets the animation height.
Definition Project.cc:132
SharedPtr< LongIndexArray > m_Frames
Definition Project.h:318
int AnimWidth() const
Returns the animation width in pixels.
Definition Project.cc:118
void ReadAndPopulate(const char *filePath)
Loads project data from disk into this instance.
Definition Project.cc:284
unsigned long AnimFrameCount() const
Returns the number of frames in the animation.
Definition Project.cc:160
int m_Height
Definition Project.h:314
constexpr Platform::Window * Window() const
Returns the owning application window.
Definition Project.h:250
char m_Name[256]
Definition Project.h:312
void SetAnimFPS(int FPS)
Sets the animation frame rate.
Definition Project.cc:149
void SetBgCol(const float *bgCol)
Sets the project background color and rebuilds backing frame storage.
Definition Project.h:183
void PushUndoable(T &&action)
Pushes a new undoable action and clears redo history.
Definition Project.h:282
void SetAnimAuthor(char *author)
Sets the animation author.
Definition Project.cc:142
void Redo()
Reapplies the most recent action on the redo stack.
Definition Project.cc:183
Col BgCol() const
Returns the current background color.
Definition Project.h:205
char m_Author[100]
Definition Project.h:315
const char * AnimName() const
Returns the animation name.
Definition Project.cc:52
void UpdateTitle()
Refreshes the window title using current project state.
Definition Project.cc:479
const char * AnimAuthor() const
Returns the animation author.
Definition Project.cc:139
bool m_Saved
Definition Project.h:322
int AnimHeight() const
Returns the animation height in pixels.
Definition Project.cc:129
char m_Desc[512]
Definition Project.h:317
const char * m_LastSavePath
Definition Project.h:323
const char * LastSavePath() const
Returns the last saved file path.
Definition Project.h:212
std::stack< UniquePtr< Action > > m_UndoStack
Definition Project.h:320
void SetAnimName(char name[256])
Sets the animation name.
Definition Project.cc:55
int m_FPS
Definition Project.h:316
void Write(const char *fileName)
Serializes the project to disk.
Definition Project.cc:197
void Export(const char *filePath, int format)
Exports the animation using the chosen format.
Definition Project.cc:59
void ClearRedoStack()
Removes all actions from the redo stack.
Definition Project.h:305
int AnimFPS() const
Returns the animation frame rate.
Definition Project.cc:146
int m_Width
Definition Project.h:313
Platform::Window * m_Window
Definition Project.h:319
void DisplayAltFPS(double fps)
Shows a temporary FPS value in the window title.
Definition Project.cc:467
void SetAnimDesc(char *desc)
Sets the animation description.
Definition Project.cc:156
std::stack< UniquePtr< Action > > m_RedoStack
Definition Project.h:321
bool Saved() const
Returns whether the project matches the last saved state.
Definition Project.h:259
The FuncDoodle C++ namespace.
Definition Common.h:12
A struct holding an RGB8 color.
Definition Frame.h:47