BEEP-8 Helper Lib 1.0.0
Loading...
Searching...
No Matches
bgprint.h File Reference

Header file for the bgprint library. More...

#include <b8/ppu.h>

Go to the source code of this file.

Classes

struct  bgprint::UvScroll
 
struct  bgprint::Context
 This structure is used to manage the context of the buffer output. More...
 
struct  bgprint::ExportPpuCmd
 
struct  bgprint::Info
 

Enumerations

enum  EnCmd { SET_SLOT_CONTEXT , SET_UV_SCROLL , EXPORT_PPU_CMD , GET_INFO }
 
enum  EnCh {
  CH0 , CH1 , CH2 , CH3 ,
  CH4 , CH5 , CH6 , CH7 ,
  CHMAX
}
 

Functions

void bgprint::Reset ()
 
FILE * bgprint::Open (EnCh ch_, char *buff, size_t buffsize, bgprint::Context &ctx)
 Open a specified channel, buffer it up to a specified size, and use the context provided.
 
void bgprint::SetUvScroll (FILE *fp_, const bgprint::UvScroll &uv_)
 
void bgprint::Export (FILE *fp_, const bgprint::ExportPpuCmd &epc)
 
void bgprint::Locate (FILE *fp_, s16 lx_, s16 ly_)
 
void bgprint::Pal (FILE *fp_, u8 pal_)
 
int bgprint::GetInfo (FILE *fp_, Info &dest)
 

Detailed Description

Header file for the bgprint library.

This library provides functionality to display strings on the BG layer through interfaces such as fprintf for writing strings to files. It includes features for cursor movement, palette selection, and context management for buffer output. This allows for formatted text output and manipulation of the display on a BG layer in a flexible and efficient manner.

Usage: Please refer to the sample for "bgprint" located at "./beep8/sdk/app/bgprint/"

// Example Usage: { bgprint::Context ctx; FILE* fp_bgprint = bgprint::Open( bgprint::CH3, nullptr, 256, ctx );

// printf fprintf(fp_bgprint, "Hello!\n" );

// moving cursor fprintf(fp_bgprint, "\e[2;2H" );

// select bg palette fprintf(fp_bgprint, "\e[3q SelectPal");

// clear the entire screen fprintf(fp_bgprint,"\e[2J" ); }

Function Documentation

◆ Open()

FILE * bgprint::Open ( EnCh ch_,
char * buff,
size_t buffsize,
bgprint::Context & ctx )

Open a specified channel, buffer it up to a specified size, and use the context provided.

Parameters
ch_Specifies the channel
buffSpecifies the address at the beginning of the stream buffer for FILE*, which is secured on the user side of this function. Specify nullptr if you want it to be automatically secured. The size is specified by buffsize.
buffsizeBuffers the results of fputs(), fwrite(), etc., up to the specified byte size. Recommended size is 256. At the very least, please specify a size larger than 1.
ctxSpecifies the context. For more information, refer to the description of bgprint::Context.
Returns
A pointer to FILE structure.