yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::zelda3::GraphicsSheetStore::Edit Class Reference

#include <graphics_sheet_store.h>

Collaboration diagram for yaze::zelda3::GraphicsSheetStore::Edit:

Public Member Functions

 Edit (GraphicsSheetStore &store, uint16_t sheet)
 ok() is false when store does not hold sheet.
 
 ~Edit ()
 
 Edit (const Edit &)=delete
 
Edit & operator= (const Edit &)=delete
 
bool ok () const
 
uint16_t sheet () const
 
uint8_t Get (int x, int y) const
 The pixel at (x, y), or 0 outside the sheet.
 
bool Set (int x, int y, uint8_t index)
 
const std::vector< uint8_t > & before () const
 The sheet as it was when the Edit began.
 
absl::Span< const uint8_t > pixels () const
 The sheet now, including uncommitted pixels.
 
void Commit ()
 Bumps the revision once if any pixel changed since the last commit.
 

Static Public Member Functions

static constexpr int width ()
 
static constexpr int height ()
 

Private Attributes

GraphicsSheetStore * store_ = nullptr
 
uint16_t sheet_ = 0
 
std::vector< uint8_t > before_
 
bool uncommitted_ = false
 

Detailed Description

One stroke on one sheet. Set() changes the store's pixels at once, so every reader sees them; the sheet's revision changes once, on Commit() or when the Edit ends. An Edit points into its store: keep it no longer than the stroke.

Definition at line 69 of file graphics_sheet_store.h.

Constructor & Destructor Documentation

◆ Edit() [1/2]

yaze::zelda3::GraphicsSheetStore::Edit::Edit ( GraphicsSheetStore & store,
uint16_t sheet )

ok() is false when store does not hold sheet.

Definition at line 78 of file graphics_sheet_store.cc.

References before_, yaze::zelda3::GraphicsSheetStore::HasSheet(), sheet(), yaze::zelda3::GraphicsSheetStore::Sheet(), and store_.

Here is the call graph for this function:

◆ ~Edit()

yaze::zelda3::GraphicsSheetStore::Edit::~Edit ( )

Definition at line 88 of file graphics_sheet_store.cc.

◆ Edit() [2/2]

yaze::zelda3::GraphicsSheetStore::Edit::Edit ( const Edit & )
delete

Member Function Documentation

◆ operator=()

Edit & yaze::zelda3::GraphicsSheetStore::Edit::operator= ( const Edit & )
delete

◆ ok()

bool yaze::zelda3::GraphicsSheetStore::Edit::ok ( ) const
inline

Definition at line 77 of file graphics_sheet_store.h.

References store_.

◆ sheet()

uint16_t yaze::zelda3::GraphicsSheetStore::Edit::sheet ( ) const
inline

Definition at line 78 of file graphics_sheet_store.h.

References sheet_.

Referenced by Edit().

◆ width()

static constexpr int yaze::zelda3::GraphicsSheetStore::Edit::width ( )
inlinestaticconstexpr

◆ height()

static constexpr int yaze::zelda3::GraphicsSheetStore::Edit::height ( )
inlinestaticconstexpr

◆ Get()

uint8_t yaze::zelda3::GraphicsSheetStore::Edit::Get ( int x,
int y ) const

The pixel at (x, y), or 0 outside the sheet.

Definition at line 92 of file graphics_sheet_store.cc.

References yaze::zelda3::GraphicsSheetStore::kSheetBytes, and yaze::zelda3::GraphicsSheetStore::kSheetWidth.

◆ Set()

bool yaze::zelda3::GraphicsSheetStore::Edit::Set ( int x,
int y,
uint8_t index )

Writes one pixel; ignores coordinates outside the sheet. Returns true when the pixel changed.

Definition at line 99 of file graphics_sheet_store.cc.

References yaze::zelda3::GraphicsSheetStore::kSheetBytes, and yaze::zelda3::GraphicsSheetStore::kSheetWidth.

◆ before()

const std::vector< uint8_t > & yaze::zelda3::GraphicsSheetStore::Edit::before ( ) const
inline

The sheet as it was when the Edit began.

Definition at line 88 of file graphics_sheet_store.h.

References before_.

◆ pixels()

absl::Span< const uint8_t > yaze::zelda3::GraphicsSheetStore::Edit::pixels ( ) const

The sheet now, including uncommitted pixels.

Definition at line 112 of file graphics_sheet_store.cc.

◆ Commit()

void yaze::zelda3::GraphicsSheetStore::Edit::Commit ( )

Bumps the revision once if any pixel changed since the last commit.

Definition at line 116 of file graphics_sheet_store.cc.

Member Data Documentation

◆ store_

GraphicsSheetStore* yaze::zelda3::GraphicsSheetStore::Edit::store_ = nullptr
private

Definition at line 95 of file graphics_sheet_store.h.

Referenced by Edit(), and ok().

◆ sheet_

uint16_t yaze::zelda3::GraphicsSheetStore::Edit::sheet_ = 0
private

Definition at line 96 of file graphics_sheet_store.h.

Referenced by sheet().

◆ before_

std::vector<uint8_t> yaze::zelda3::GraphicsSheetStore::Edit::before_
private

Definition at line 97 of file graphics_sheet_store.h.

Referenced by before(), and Edit().

◆ uncommitted_

bool yaze::zelda3::GraphicsSheetStore::Edit::uncommitted_ = false
private

Definition at line 98 of file graphics_sheet_store.h.


The documentation for this class was generated from the following files: