aboutsummaryrefslogtreecommitdiff
path: root/examples/graphics/rgb24/main.c
diff options
context:
space:
mode:
authorJohn Wilbert M. Villamor <lameguy64@gmail.com>2020-04-24 19:01:28 +0800
committerJohn Wilbert M. Villamor <lameguy64@gmail.com>2020-04-24 19:01:28 +0800
commit1aa0e17df7c325a41de8cf8a57f52ed853f08bf3 (patch)
tree5ec7f69ca0104f2b0a41e2ee7d3cb0cf0c9c54c5 /examples/graphics/rgb24/main.c
parente82da2abe4c264d4b48a48d79cf9b8e4c4fb8ab6 (diff)
downloadpsn00bsdk-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/graphics/rgb24/main.c')
-rw-r--r--examples/graphics/rgb24/main.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/examples/graphics/rgb24/main.c b/examples/graphics/rgb24/main.c
new file mode 100644
index 0000000..9f1a647
--- /dev/null
+++ b/examples/graphics/rgb24/main.c
@@ -0,0 +1,52 @@
+/* LibPSn00b Example Programs
+ * Part of the PSn00bSDK Project
+ *
+ * RGB24 Example by Lameguy64
+ *
+ *
+ * This example demonstrates the 24-bit color mode of the PS1. This mode is
+ * not practical for gameplay as the GPU can only draw graphics primitives
+ * in 16-bit color depth so this feature would normally be used only for
+ * fullscreen graphic illustrations or FMV sequences.
+ *
+ *
+ * Changelog:
+ *
+ * 05-03-2019 - Initial version.
+ *
+ */
+
+#include <stdio.h>
+#include <psxgte.h>
+#include <psxgpu.h>
+
+// So data from tim.s can be accessed
+extern unsigned int tim_image[];
+
+int main() {
+
+ DISPENV disp;
+ TIM_IMAGE tim;
+
+ // Reset GPU
+ ResetGraph(0);
+
+ // Setup 640x480 24-bit video mode
+ SetDefDispEnv(&disp, 0, 0, 640, 480);
+ disp.isrgb24 = 1;
+ disp.isinter = 1;
+
+ // Apply and enable display
+ PutDispEnv(&disp);
+ SetDispMask(1);
+
+ // Upload image to VRAM
+ GetTimInfo(tim_image, &tim);
+ LoadImage(tim.prect, tim.paddr);
+ DrawSync(0);
+
+ while(1) {
+ }
+
+ return 0;
+} \ No newline at end of file