diff options
| author | John Wilbert M. Villamor <lameguy64@gmail.com> | 2020-04-24 19:01:28 +0800 |
|---|---|---|
| committer | John Wilbert M. Villamor <lameguy64@gmail.com> | 2020-04-24 19:01:28 +0800 |
| commit | 1aa0e17df7c325a41de8cf8a57f52ed853f08bf3 (patch) | |
| tree | 5ec7f69ca0104f2b0a41e2ee7d3cb0cf0c9c54c5 /examples/demos/n00bdemo/disp.c | |
| parent | e82da2abe4c264d4b48a48d79cf9b8e4c4fb8ab6 (diff) | |
| download | psn00bsdk-1aa0e17df7c325a41de8cf8a57f52ed853f08bf3.tar.gz | |
Refined toolchain instructions, organized examples, added automatic retry for CdRead(), added FIOCSCAN ioctl in psxsio TTY driver, added tty and console examples.
Diffstat (limited to 'examples/demos/n00bdemo/disp.c')
| -rw-r--r-- | examples/demos/n00bdemo/disp.c | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/examples/demos/n00bdemo/disp.c b/examples/demos/n00bdemo/disp.c new file mode 100644 index 0000000..d798ee9 --- /dev/null +++ b/examples/demos/n00bdemo/disp.c @@ -0,0 +1,72 @@ +#include <stdio.h> +#include <psxgpu.h> +#include <psxgte.h> +#include <inline_c.h> +#include "smd.h" +#include "disp.h" + +DISPENV disp; +DRAWENV draw; + +char pribuff[2][131072]; +unsigned int ot[2][OT_LEN]; +char *nextpri; +int db = 0; + +MATRIX mtx; + + +void initDisplay() { + + ResetGraph( 3 ); + + if( GetVideoMode() == MODE_NTSC ) { + SetDefDispEnv( &disp, 0, 0, 640, 480 ); + SetDefDrawEnv( &draw, 0, 0, 640, 480 ); + scSetClipRect( 0, 0, 640, 480 ); + printf("NTSC System.\n"); + } else { + SetDefDispEnv( &disp, 0, 0, 640, 512 ); + SetDefDrawEnv( &draw, 0, 0, 640, 512 ); + scSetClipRect( 0, 0, 640, 512 ); + disp.screen.y = 20; + disp.screen.h = 256; + printf("PAL System.\n"); + } + + disp.isinter = 1; + draw.isbg = 1; + + PutDispEnv( &disp ); + PutDrawEnv( &draw ); + + ClearOTagR( ot[0], OT_LEN ); + ClearOTagR( ot[1], OT_LEN ); + nextpri = pribuff[0]; + + InitGeom(); + gte_SetGeomScreen( 320 ); + + if( GetVideoMode() == MODE_NTSC ) { + gte_SetGeomOffset( 320, 240 ); + } else { + gte_SetGeomOffset( 320, 256 ); + } + +} + +void display() { + + DrawSync(0); + VSync(0); + + PutDrawEnv( &draw ); + DrawOTag( ot[db]+OT_LEN-1 ); + + db ^= 1; + ClearOTagR( ot[db], OT_LEN ); + nextpri = pribuff[db]; + + SetDispMask( 1 ); + +}
\ No newline at end of file |
