Skip to content

Commit

Permalink
Add user friendly setWindowXXX(...) and VDP_setWindowOff() methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Leur68 committed Nov 21, 2024
1 parent 1010efa commit 3a2d2e5
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
37 changes: 37 additions & 0 deletions inc/vdp.h
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,43 @@ void VDP_setWindowHPos(u16 right, u16 pos);
* The Vertical position of the window in 1 tile unit (8 pixels).
*/
void VDP_setWindowVPos(u16 down, u16 pos);
/**
* \brief
* Turns off the window.
*/
void VDP_setWindowOff();
/**
* \brief
* Positions the window from the top edge of the screen by the specified number of rows (tiles).
*
* \param rows
* The number of rows, expressed in tiles.
*/
void VDP_setWindowOnTop(u16 rows);
/**
* \brief
* Positions the window from the bottom edge of the screen by the specified number of rows (tiles).
*
* \param rows
* The number of rows, expressed in tiles.
*/
void VDP_setWindowOnBottom(u16 rows);
/**
* \brief
* Positions the window from the left edge of the screen by the specified number of columns, each 2 tiles wide (16 pixels).
*
* \param cols
* The number of columns, expressed in double tiles.
*/
void VDP_setWindowOnLeft(u16 cols);
/**
* \brief
* Positions the window from the right edge of the screen by the specified number of columns, each 2 tiles wide (16 pixels).
*
* \param cols
* The number of columns, expressed in double tiles.
*/
void VDP_setWindowOnRight(u16 cols);

/**
* \brief
Expand Down
25 changes: 25 additions & 0 deletions src/vdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,31 @@ void VDP_setWindowVPos(u16 down, u16 pos)
*pw = 0x9200 | v;
}

void VDP_setWindowOff()
{
VDP_setWindowVPos(false, 0);
VDP_setWindowHPos(false, 0);
}

void VDP_setWindowOnTop(u16 rows)
{
VDP_setWindowVPos(false, rows);
}

void VDP_setWindowOnBottom(u16 rows)
{
VDP_setWindowVPos(true, (screenHeight / 8) - rows);
}

void VDP_setWindowOnLeft(u16 cols)
{
VDP_setWindowHPos(false, cols);
}

void VDP_setWindowOnRight(u16 cols)
{
VDP_setWindowHPos(true, (screenWidth / 16) - cols);
}

void VDP_waitDMACompletion()
{
Expand Down

0 comments on commit 3a2d2e5

Please sign in to comment.