|
FuncDoodle
|
Class that is responsible for storing, reading & saving users' project files. More...
#include <Project.h>
Public Member Functions | |
| 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. | |
| ~ProjectFile () | |
| const char * | AnimName () const |
| Returns the animation name. | |
| void | SetAnimName (char name[256]) |
| Sets the animation name. | |
| int | AnimWidth () const |
| Returns the animation width in pixels. | |
| void | SetAnimWidth (int width, bool clear=false) |
| Sets the animation width. | |
| int | AnimHeight () const |
| Returns the animation height in pixels. | |
| void | SetAnimHeight (int height, bool clear=false) |
| Sets the animation height. | |
| const char * | AnimAuthor () const |
| Returns the animation author. | |
| void | SetAnimAuthor (char *author) |
| Sets the animation author. | |
| int | AnimFPS () const |
| Returns the animation frame rate. | |
| void | SetAnimFPS (int FPS) |
| Sets the animation frame rate. | |
| const char * | AnimDesc () const |
| Returns the animation description. | |
| void | SetAnimDesc (char *desc) |
| Sets the animation description. | |
| unsigned long | AnimFrameCount () const |
| Returns the number of frames in the animation. | |
| void | SetAnimFrameCount (unsigned long count) |
| Resizes the animation frame count. | |
| void | SetBgCol (const float *bgCol) |
| Sets the project background color and rebuilds backing frame storage. | |
| Col | BgCol () const |
| Returns the current background color. | |
| const char * | LastSavePath () const |
| Returns the last saved file path. | |
| SharedPtr< LongIndexArray > | AnimFrames () |
| Returns the animation frame storage. | |
| void | Write (const char *fileName) |
| Serializes the project to disk. | |
| void | ReadAndPopulate (const char *filePath) |
| Loads project data from disk into this instance. | |
| void | Export (const char *filePath, int format) |
| Exports the animation using the chosen format. | |
| constexpr Platform::Window * | Window () const |
| Returns the owning application window. | |
| bool | Saved () const |
| Returns whether the project matches the last saved state. | |
| void | DisplayAltFPS (double fps) |
| Shows a temporary FPS value in the window title. | |
| void | UpdateTitle () |
| Refreshes the window title using current project state. | |
| template<typename T> | |
| void | PushUndoable (T &&action) |
| Pushes a new undoable action and clears redo history. | |
| void | Undo () |
| Undoes the most recent action on the undo stack. | |
| void | Redo () |
| Reapplies the most recent action on the redo stack. | |
| void | ClearRedoStack () |
| Removes all actions from the redo stack. | |
Private Attributes | |
| char | m_Name [256] |
| int | m_Width = 0 |
| int | m_Height = 0 |
| char | m_Author [100] |
| int | m_FPS = 0 |
| char | m_Desc [512] |
| SharedPtr< LongIndexArray > | m_Frames |
| Platform::Window * | m_Window |
| std::stack< UniquePtr< Action > > | m_UndoStack |
| std::stack< UniquePtr< Action > > | m_RedoStack |
| bool | m_Saved = false |
| const char * | m_LastSavePath = "" |
| Col | m_BG |
Class that is responsible for storing, reading & saving users' project files.
Represents a user's project, handling all aspects of its lifecycle - including in-memory storage of project data, deserializing from disk, and serializing back to the .fdp binary format that is documented in ../doc/FDP.md
| FuncDoodle::ProjectFile::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.
| name | Animation name buffer. |
| width | Initial canvas width. |
| height | Initial canvas height. |
| author | Animation author buffer. |
| fps | Initial playback FPS. |
| desc | Animation description buffer. |
| win | Window used for title updates. |
| bgCol | Initial background color. |
|
default |
|
nodiscard |
Returns the animation author.
|
nodiscard |
Returns the animation description.
|
nodiscard |
Returns the animation frame rate.
|
nodiscard |
Returns the number of frames in the animation.
| SharedPtr< LongIndexArray > FuncDoodle::ProjectFile::AnimFrames | ( | ) |
Returns the animation frame storage.
|
nodiscard |
Returns the animation height in pixels.
|
nodiscard |
Returns the animation name.
|
nodiscard |
Returns the animation width in pixels.
|
inlinenodiscard |
Returns the current background color.
|
inline |
Removes all actions from the redo stack.
| void FuncDoodle::ProjectFile::DisplayAltFPS | ( | double | fps | ) |
Shows a temporary FPS value in the window title.
| fps | FPS value to display. |
| void FuncDoodle::ProjectFile::Export | ( | const char * | filePath, |
| int | format ) |
Exports the animation using the chosen format.
| filePath | Output path. |
| format | Export format identifier. |
|
inlinenodiscard |
Returns the last saved file path.
|
inline |
Pushes a new undoable action and clears redo history.
| action | Action instance to store on the undo stack. |
| void FuncDoodle::ProjectFile::ReadAndPopulate | ( | const char * | filePath | ) |
Loads project data from disk into this instance.
| filePath | Project path to read. |
| void FuncDoodle::ProjectFile::Redo | ( | ) |
Reapplies the most recent action on the redo stack.
|
inline |
Returns whether the project matches the last saved state.
| void FuncDoodle::ProjectFile::SetAnimAuthor | ( | char * | author | ) |
Sets the animation author.
| author | New author buffer. |
| void FuncDoodle::ProjectFile::SetAnimDesc | ( | char * | desc | ) |
Sets the animation description.
| desc | New description buffer. |
| void FuncDoodle::ProjectFile::SetAnimFPS | ( | int | FPS | ) |
Sets the animation frame rate.
| FPS | New frames-per-second value. |
| void FuncDoodle::ProjectFile::SetAnimFrameCount | ( | unsigned long | count | ) |
Resizes the animation frame count.
| count | New frame count. |
| void FuncDoodle::ProjectFile::SetAnimHeight | ( | int | height, |
| bool | clear = false ) |
Sets the animation height.
| height | New canvas height. |
| clear | Whether to clear existing frame data. |
| void FuncDoodle::ProjectFile::SetAnimName | ( | char | name[256] | ) |
Sets the animation name.
| name | New animation name buffer. |
| void FuncDoodle::ProjectFile::SetAnimWidth | ( | int | width, |
| bool | clear = false ) |
Sets the animation width.
| width | New canvas width. |
| clear | Whether to clear existing frame data. |
|
inline |
Sets the project background color and rebuilds backing frame storage.
| bgCol | Pointer to three normalized RGB float values. |
| void FuncDoodle::ProjectFile::Undo | ( | ) |
Undoes the most recent action on the undo stack.
| void FuncDoodle::ProjectFile::UpdateTitle | ( | ) |
Refreshes the window title using current project state.
|
inlinenodiscardconstexpr |
Returns the owning application window.
| void FuncDoodle::ProjectFile::Write | ( | const char * | fileName | ) |
Serializes the project to disk.
| filePath | Output project path. |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |