Skip to content

Commit

Permalink
Add user friendly setWindowXXX(...) and VDP_setWindowOff(), VDP_setWi…
Browse files Browse the repository at this point in the history
…ndowFullScreen() methods (#372)

* Add user friendly setWindowXXX(...) and VDP_setWindowOff() methods
* Add VDP_setWindowFullScreen()
  • Loading branch information
Leur68 authored Nov 22, 2024
1 parent d430517 commit ac20ad7
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
42 changes: 42 additions & 0 deletions inc/vdp.h
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,48 @@ 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
* Positions the window to full screen.
*/
void VDP_setWindowFullScreen();

/**
* \brief
Expand Down
30 changes: 30 additions & 0 deletions src/vdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,36 @@ 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_setWindowFullScreen()
{
VDP_setWindowVPos(false, screenHeight / 8);
}

void VDP_waitDMACompletion()
{
Expand Down

0 comments on commit ac20ad7

Please sign in to comment.