forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Image Blitting on 3.71

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
kid101skater



Joined: 20 Jun 2007
Posts: 26

PostPosted: Thu Oct 18, 2007 8:08 am    Post subject: Image Blitting on 3.71 Reply with quote

Hello. i origionally dev'd for psp 1.50 and did some 2.8 projects... such as flashers, games and shells... and some little other things. anyways to the point. im trying to start on 3.71 and for some reason i cant get the damn graphics to load even simpily. i have this code below to load the image

Main.c
Code:


#include <kubridge.h>
#include <pspkernel.h>
#include <psppower.h>
#include <pspdebug.h>
#include <pspctrl.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <pspiofilemgr.h>
#include <pspdisplay.h>
#include <psputility.h>
#include <pspgu.h>
#include <pspgum.h>
#include <malloc.h>
#include <stdarg.h>
#include "framebuffer.h"
#include "graphics.h"
#include <math.h>
#include <png.h>
#include <pspsdk.h>


#define SCREEN_WIDTH 480
#define SCREEN_HEIGHT 272
#define DATA_WIDTH     240
#define DATA_HEIGHT       136
#define LINESIZE       512            //in short
#define FRAMESIZE      0xAA000         //in byte

#define printf pspDebugScreenPrintf
#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))

PSP_MODULE_INFO("test", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER);

#define printf    pspDebugScreenPrintf
#define RGB(r, g, b) ((r)|((g)<<8)|((b)<<16))


void ErrorExit(int milisecs, char *fmt, ...)
{
   va_list list;
   char msg[256];   

   va_start(list, fmt);
   vsprintf(msg, fmt, list);
   va_end(list);

   printf(msg);
   
   sceKernelDelayThread(milisecs*1000);
   sceKernelExitGame();
}


int main(void)
{
   
   pspDebugScreenInit();
   initGraphics();
   SceCtrlData pad;
   
   
    Image* player = loadImage("player.png");

    while(1){
       printf(" Loading player \n");
       blitAlphaImageToScreen(0, 0, 60, 60, player, 60, 60);
       flipScreen();
       printf("loaded correctly =] /n");
       }
}





Makefile
Code:


TARGET = Tester
OBJS = main.o graphics.o framebuffer.o

INCDIR = ./include
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS) -c

LIBDIR = ./lib
LDFLAGS =
LIBS = -lpspkubridge -lpspgu -lpng -lz -lm -lpsppower

PSP_FW_VERSION = 371

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Tester

BUILD_PRX = 1

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak

Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Thu Oct 18, 2007 12:00 pm    Post subject: Reply with quote

Talk about hammerimg the graphics. You're trying to blit the image as fast as humanly possible. Operations like this usually fail when trying to do that. As a test, you probably just want to do this:

Code:
    printf(" Loading player \n");
    blitAlphaImageToScreen(0, 0, 60, 60, player, 60, 60);
    flipScreen();
    printf("loaded correctly =] /n");
    sceKernelDelayThread(10*1000*1000); // wait 10 seconds


No while loop. If you want to keep the while loop, slow it down. Wait on the vert blank or something.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group