aboutsummaryrefslogtreecommitdiff
path: root/examples/rgb24/main.c
diff options
context:
space:
mode:
authorlameguy64 <lameguy64@gmail.com>2019-05-23 22:24:56 +0800
committerlameguy64 <lameguy64@gmail.com>2019-05-23 22:24:56 +0800
commit3ffebff2aad2ca438cf76db51fb3459c5639cd67 (patch)
treea234fc6158d3c09904c4c1fb2feee09afb479a4c /examples/rgb24/main.c
parente70cd149f41ea71f9ca9ee86c03d1e59005dad2a (diff)
downloadpsn00bsdk-3ffebff2aad2ca438cf76db51fb3459c5639cd67.tar.gz
Added BIOS Controller, BIOS CD, 2 new examples and custom exit handler in the works
Diffstat (limited to 'examples/rgb24/main.c')
-rw-r--r--examples/rgb24/main.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/examples/rgb24/main.c b/examples/rgb24/main.c
new file mode 100644
index 0000000..178ece2
--- /dev/null
+++ b/examples/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();
+
+ while(1) {
+ }
+
+ return 0;
+} \ No newline at end of file