Kaynak kodu + eboot.pbp(binary) indirmek için:
http://www.megaupload.com/?d=ZN7Y8858
Video:
http://www.facebook.com/video/video.php?v=448383189177
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspdisplay.h>
#include <pspctrl.h>
#include <stdlib.h>
#include <time.h>
PSP_MODULE_INFO("Test Sallayicisi", 0, 1, 0);
#define printf pspDebugScreenPrintf
char asciiTag[180]=" ______ \n / ____/\n / /___ _____ _ __\n \\____ \\ / __| | | |_ \\\n _____/ / | |__| | | | | |\n/______/ \\___|_| |_| |_|\n /_/\n------------------------------\n";
int x=0;
/* 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;
}
void sorunoYaz(int soruno)
{
if(soruno<10)
{
printf("\n %i) ", soruno);
}
else if(soruno>=10)
{
printf("\n%i) ", soruno);
}
}
void soruSalla()
{
unsigned int iseed = (unsigned int)time(NULL);
srand (iseed);
int soruSayisi = 1;
int i = 0;
SceCtrlData pad;
printf("%sO:Arttir, []:Azalt, X:Onayla\nSoru sayisi: %i", asciiTag, soruSayisi);
while(1) {
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_CIRCLE && soruSayisi<25) {
pspDebugScreenClear();
soruSayisi++;
printf("%s", asciiTag);
printf("O:Arttir, []:Azalt, X:Onayla\nSoru sayisi: %i", soruSayisi);
for(i=0; i<10; i++) {
sceDisplayWaitVblankStart();
}
}
else if(pad.Buttons & PSP_CTRL_SQUARE && soruSayisi>1) {
pspDebugScreenClear();
soruSayisi--;
printf("%s", asciiTag);
printf("O:Arttir, []:Azalt, X:Onayla\nSoru sayisi: %i", soruSayisi);
for(i=0; i<10; i++) {
sceDisplayWaitVblankStart();
}
}
else if(pad.Buttons & PSP_CTRL_CROSS) {
break;
}
}
pspDebugScreenClear();
printf("%sYeni bir test sallamak icin /\\ tusuna basiniz.", asciiTag);
int soruno;
for (soruno=1; soruno<=soruSayisi; soruno++)
{
sorunoYaz(soruno);
switch(rand()%5) {
case 0:
printf("A |#----|");
break;
case 1:
printf("B |-#---|");
break;
case 2:
printf("C |--#--|");
break;
case 3:
printf("D |---#-|");
break;
case 4:
printf("E |----#|");
break;
}
}
x=0;
while(1)
{
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_TRIANGLE)
{
pspDebugScreenClear();
break;
}
}
}
int main() {
pspDebugScreenInit();
SetupCallbacks();
SceCtrlData pad;
printf("%sSan'in test sallayicisina hosgeldiniz!\nBu benim PSP icin C dilinde yazdigim ilk program.\n\nBaslamak icin /\\ tusuna basiniz!", asciiTag);
while(1)
{
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_TRIANGLE)
{
pspDebugScreenClear();
break;
}
}
while(1)
{
soruSalla();
}
sceKernelSleepThread();
return 0;
}
Hiç yorum yok:
Yorum Gönder