72 ProjectFile(
char name[256],
int width,
int height,
char author[100],
81 [[nodiscard]]
const char*
AnimName()
const;
139 [[nodiscard]]
int AnimFPS()
const;
153 [[nodiscard]]
const char*
AnimDesc()
const;
185 m_BG =
Col{.r =
static_cast<unsigned char>(
186 std::clamp(bgCol[0] * 255, 0.0f, 255.0f)),
187 .g =
static_cast<unsigned char>(
188 std::clamp(bgCol[1] * 255, 0.0f, 255.0f)),
189 .b =
static_cast<unsigned char>(
190 std::clamp(bgCol[2] * 255, 0.0f, 255.0f))};
227 void Write(
const char* fileName);
279 template <
typename T>
280 requires std::derived_from<std::remove_cvref_t<T>,
Action>
282 using U = std::remove_cvref_t<T>;
285 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:44
void SetAnimWidth(int width, bool clear=false)
Sets the animation width.
Definition Project.cc:214
Col m_BG
Definition Project.h:323
const char * AnimDesc() const
Returns the animation description.
Definition Project.cc:245
void Undo()
Undoes the most recent action on the undo stack.
Definition Project.cc:259
SharedPtr< LongIndexArray > AnimFrames()
Returns the animation frame storage.
Definition Project.cc:255
void SetAnimHeight(int height, bool clear=false)
Sets the animation height.
Definition Project.cc:224
SharedPtr< LongIndexArray > m_Frames
Definition Project.h:317
int AnimWidth() const
Returns the animation width in pixels.
Definition Project.cc:210
void ReadAndPopulate(const char *filePath)
Loads project data from disk into this instance.
Definition Project.cc:377
int m_Height
Definition Project.h:313
constexpr Platform::Window * Window() const
Returns the owning application window.
Definition Project.h:249
char m_Name[256]
Definition Project.h:311
void SetAnimFPS(int FPS)
Sets the animation frame rate.
Definition Project.cc:241
void SetBgCol(const float *bgCol)
Sets the project background color and rebuilds backing frame storage.
Definition Project.h:182
void PushUndoable(T &&action)
Pushes a new undoable action and clears redo history.
Definition Project.h:281
void Export(const char *filePath, ExportFormat format)
Exports the animation using the chosen format.
Definition Project.cc:71
void SetAnimAuthor(char *author)
Sets the animation author.
Definition Project.cc:234
void Redo()
Reapplies the most recent action on the redo stack.
Definition Project.cc:275
Col BgCol() const
Returns the current background color.
Definition Project.h:204
char m_Author[100]
Definition Project.h:314
const char * AnimName() const
Returns the animation name.
Definition Project.cc:64
void UpdateTitle()
Refreshes the window title using current project state.
Definition Project.cc:579
const char * AnimAuthor() const
Returns the animation author.
Definition Project.cc:231
bool m_Saved
Definition Project.h:321
int AnimHeight() const
Returns the animation height in pixels.
Definition Project.cc:221
char m_Desc[512]
Definition Project.h:316
const char * m_LastSavePath
Definition Project.h:322
const char * LastSavePath() const
Returns the last saved file path.
Definition Project.h:211
std::stack< UniquePtr< Action > > m_UndoStack
Definition Project.h:319
void SetAnimName(char name[256])
Sets the animation name.
Definition Project.cc:67
void SetAnimFrameCount(uint64_t count)
Resizes the animation frame count.
int m_FPS
Definition Project.h:315
uint64_t AnimFrameCount() const
Returns the number of frames in the animation.
Definition Project.cc:252
void Write(const char *fileName)
Serializes the project to disk.
Definition Project.cc:289
void ClearRedoStack()
Removes all actions from the redo stack.
Definition Project.h:304
int AnimFPS() const
Returns the animation frame rate.
Definition Project.cc:238
int m_Width
Definition Project.h:312
Platform::Window * m_Window
Definition Project.h:318
void DisplayAltFPS(double fps)
Shows a temporary FPS value in the window title.
Definition Project.cc:567
void SetAnimDesc(char *desc)
Sets the animation description.
Definition Project.cc:248
std::stack< UniquePtr< Action > > m_RedoStack
Definition Project.h:320
bool Saved() const
Returns whether the project matches the last saved state.
Definition Project.h:258
The FuncDoodle C++ namespace.
Definition Common.h:12
ExportFormat
Definition Constants.h:288
A struct holding an RGB8 color.
Definition Frame.h:47