rendered paste body/*
NAME: IMAGE FILE
DATE: FEB/23/07
CREATOR: Min Lee/Minsin
////////////////////MAKEFILE//////////////////////
TARGET = hello
OBJS = main.o
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Hello World
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
//////////////////////////////////////////////////*/
#include <pspdisplay.h>
#include <pspctrl.h>
#include <pspkernel.h>
#include <pspdebug.h>
//bottom down is for image processing
#include <pspgu.h>
#include <png.h>
#include <stdio.h>
#include "graphics.h"
//This is necessary.
#define printf pspDebugScreenPrintf
//I don't know what the fuck this is.
#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
PSP_MODULE_INFO("IMAGE DISPLAYER", 0, 1, 1);
/*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*///
/* Exit callback */ //
int exit_callback(int arg1, int arg2, void *common) { //
sceKernelExitGame(); //
return 0; //
} //
//
/* Callback thread */ //
int CallbackThread(SceSize args, void *argp) { //
int cbid; //
//
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL); //
sceKernelRegisterExitCallback(cbid); //
//
sceKernelSleepThreadCB(); //
//
return 0; //
} //
//
/* Sets up the callback thread and returns its thread id */ //
int SetupCallbacks(void) { //
int thid = 0; //
//
thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0); //
if(thid >= 0) { //
sceKernelStartThread(thid, 0, 0); //
} //
//
return thid; //
} //
/*_+*{}*|:*"<*>?**_+*{}*|:*"<*>?**_+*{}*|:*"<*>?**_+*{}*|:*"<*>?**_+*{}*|:*"<*>?**_+*{}*|:*"<*>?**_+*{}*/
int main()
{
char buffer[200];
Image* ourImage;
pspDebugScreenInit();
SetupCallbacks();
initGraphics(); //For initializing graphics
sprintf(buffer, "ourImage.png");
ourImage = loadImage(buffer);
if (!ourImage)
{
//Image load failed
printf("Image load failed!\n");
}
else
{
int x = 0;
int y = 0;
sceDisplayWaitVblankStart();
while(x < 480)
{
while(y < 272)
{
blitAlphaImageToScreen(0 ,0 ,32, ourImage, x, y);
y +=32;
}
x += 32;
y = 0;
}
flipScreen();
}
sceKernelSleepThread(); //Freezes the Game so that we can see the output.
return 0;
}