:: PlayerAdvance.org ::  

Précédent   :: PlayerAdvance.org :: > :: Forums Hébergés :: > OldSchool Library > Aide au développement

Aide au développement Aide sur l'utilisation d'OSLib

Publicité

Réponse
 
Outils de la discussion Modes d'affichage
Vieux 22/01/2009, 01h56   #1
pspmasterpro
Membre
 
Date d'inscription: 22/01/2009
Messages: 17
Par défaut [OSLIB] Problem Blank Screen

Hello I'm new here I'm using oslib to create a game I used the tutorials on this site http://oslib.playeradvance.org/doku.php?id=home . The problem is when I compile and run the game it loads a blank screen, none of the controls respond except for HOME but once you select YES, it freezes. It works without the OSLIB graphic functions. Well here is the code:

main.c
Code:
#include <stdio.h>
#include <string.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspdisplay.h>
#include <pspctrl.h>
#include <pspgu.h>
#include <pspgum.h>
#include <psppower.h>
#include <pspiofilemgr.h>
#include <stdio.h>
#include <pspaudio.h>
#include <pspaudiolib.h>
#include <stdlib.h>
#include <oslib/oslib.h>

#include "graphics.h"
#include "map.h"

PSP_MODULE_INFO("Test Game", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);

OSL_IMAGE *map_tileset;
OSL_MAP *map;
OSL_SOUND *menu, *select;

void newGame();

#define lightRed RGB(252,44,44)
#define lightGreen RGB(44,252,44)
#define green RGB(0,128,0)
#define orange RGB(255,128,0)

int main() 
{
 oslInit(0);						
 oslInitGfx(OSL_PF_8888, 1);		
 oslInitConsole();				
 oslInitAudio();
 
 map_tileset = oslLoadImageFile("Images/tileset.png", OSL_IN_RAM, OSL_PF_5551);
 map = oslCreateMap(
		map_tileset,						
		map_map,						
		16,16,							
		17,30,							
		OSL_MF_U16);

 menu = oslLoadSoundFile("sounds/beep.wav",OSL_FMT_NONE); 
 oslAssert(menu);
 select = oslLoadSoundFile("sounds/select.wav",OSL_FMT_NONE); 
 oslAssert(select);

 pspDebugScreenInit();
 initGraphics();
 SceCtrlData pad, lastpad;
 sceCtrlReadBufferPositive(&lastpad, 1);
 Image* Background;
 Background = loadImage("./Images/back.png");
 int selComponent = 1;
 const int BUFFER_SIZE = 64;
 char image_save[BUFFER_SIZE];
 int to_save = 0;
 Color NEW_GAME = lightGreen;
 Color LOAD_GAME = lightGreen;
 Color EXTRA = lightGreen;
 Color EXIT = lightGreen;
 while(!osl_quit)
 {
   oslStartDrawing();	
   sceCtrlReadBufferPositive(&pad, 1);
   blitAlphaImageToScreen(0, 0 , 480, 272, Background, 0, 0);
   
   if (pad.Buttons != lastpad.Buttons)
   {
    lastpad = pad;
    if (pad.Buttons & PSP_CTRL_UP)
	{
	 oslPlaySound(menu, 1);
	 selComponent--;
     if (selComponent < 1)
     selComponent = 4;
	}

    if (pad.Buttons & PSP_CTRL_DOWN)
	{
	 oslPlaySound(menu, 1);
	 selComponent++;
     if (selComponent > 4)
     selComponent = 1;
	}
   }
   
   if (selComponent == 1)
   {
     NEW_GAME = lightGreen;
     LOAD_GAME = green;
     EXTRA = green;
	 EXIT = green;
    }
   
   else if (selComponent == 2)
   {
     NEW_GAME = green;
     LOAD_GAME = lightGreen;
     EXTRA = green;
	 EXIT = green;
    }
   
   else if (selComponent == 3)
   {
     NEW_GAME = green;
     LOAD_GAME = green;
     EXTRA = lightGreen;
	 EXIT = green;
    }
   
   else if (selComponent == 4)
   {
     NEW_GAME = green;
     LOAD_GAME = green;
     EXTRA = green;
	 EXIT = lightGreen;
    }

   if(pad.Buttons & PSP_CTRL_CROSS) 
   {
    switch(selComponent) 
    { 
     case 1:
           oslPlaySound(select, 1);
           newGame();
           break;
     case 2:
	       sceKernelDelayThread(250000);
           oslPlaySound(select, 1);
           break;
     case 3:
	       sceKernelDelayThread(250000);
           oslPlaySound(select, 1);
           break;
     case 4:
	       sceKernelDelayThread(250000);
           oslPlaySound(select, 1);
           sceKernelExitGame();
		   break;
     default:
           //SHOULD NEVER EXECUTE
           break;
	}
   }

   if(pad.Buttons & PSP_CTRL_TRIANGLE)
   {
   	snprintf(image_save, BUFFER_SIZE, "ms0:/PICTURE/ScreenShot_%d.png", to_save);
	saveImage(image_save, getVramDisplayBuffer(), 480, 272, 512, 0);
	to_save++;  
   }

   printTextScreen(65, 120, "New Game", NEW_GAME);
   printTextScreen(65, 130, "Load Game", LOAD_GAME);
   printTextScreen(65, 140, "Extra", EXTRA);
   printTextScreen(65, 150, "Exit Game", EXIT);
   printTextScreen(5, 235, "Created by pspmasterpro :)", lightRed);
   sceDisplayWaitVblankStart();
   flipScreen();
   lastpad = pad;
   oslAudioVSync();
   oslEndDrawing();
   oslSyncFrame();
}
  oslEndGfx();
  oslQuit();
  return 0;
}

void newGame()
{
 oslCls();
 oslDrawMapSimple(map);
}
map.h
Code:
//Converti avec GBA Graphics par Brünni
//Map ("","C:\Users\Owner\Desktop\map.til.c",0,ffffffff)
//Taille: 16*16 * 30*17
//Mémoire: 1020 octets

const unsigned short map_map[17][30]=	{
	{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
	{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
	{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
	{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
	{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
	{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
	{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
	{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
	{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
	{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001,
0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009,
0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b},
	{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x000c, 0x000d,
0x000e, 0x000f, 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015,
0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017},
	{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0018, 0x0019,
0x001a, 0x001b, 0x001a, 0x001b, 0x001a, 0x001b, 0x001c, 0x001d,
0x001e, 0x001f, 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025,
0x0026, 0x0027, 0x0020, 0x0021, 0x0022, 0x0023},
	{0x0000, 0x0000, 0x0000, 0x0028, 0x000c, 0x000d, 0x0029, 0x002a,
0x002b, 0x002c, 0x002b, 0x002c, 0x002b, 0x002c, 0x002d, 0x002e,
0x002f, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036,
0x0037, 0x0038, 0x0031, 0x0032, 0x0033, 0x0034},
	{0x0000, 0x0000, 0x0039, 0x003a, 0x001c, 0x001d, 0x003b, 0x003c,
0x003d, 0x003e, 0x003f, 0x0040, 0x003b, 0x003c, 0x0041, 0x0042,
0x0043, 0x0044, 0x0024, 0x0025, 0x0026, 0x0027, 0x0020, 0x0021,
0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027},
	{0x0000, 0x0000, 0x0045, 0x0046, 0x002d, 0x002e, 0x0047, 0x0048,
0x0049, 0x004a, 0x004b, 0x004c, 0x0047, 0x0048, 0x004d, 0x004e,
0x004f, 0x0050, 0x0035, 0x0036, 0x0037, 0x0038, 0x0031, 0x0032,
0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038},
	{0x0000, 0x0000, 0x0051, 0x0052, 0x0024, 0x0025, 0x003d, 0x003e,
0x003f, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0041, 0x0042,
0x0043, 0x0044, 0x001e, 0x001f, 0x0053, 0x0054, 0x0024, 0x0025,
0x0026, 0x0027, 0x0020, 0x0021, 0x0022, 0x0023},
	{0x0000, 0x0028, 0x0055, 0x0056, 0x0035, 0x0036, 0x0049, 0x004a,
0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x004d, 0x004e,
0x004f, 0x0050, 0x002f, 0x0030, 0x0057, 0x0058, 0x0035, 0x0036,
0x0037, 0x0038, 0x0031, 0x0032, 0x0033, 0x0034}
};
makefile
Code:
TARGET = test
OBJS = graphics.o framebuffer.o main.o

INCDIR = 
CFLAGS = -G4 -Wall -O2
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

LIBDIR =
LDFLAGS =
STDLIBS =  -losl -lpng -lz \
                -lpspsdk -lpspgum -lpspctrl -lpspumd -lpsprtc -lpspgu -lmad -lm -lpspaudiolib -lpspaudio -lpsppower
LIBS=$(STDLIBS)$(YOURLIBS)

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Test Game

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
EDIT: I think graphics.h conflicts with the OSLIB graphics is this true?
pspmasterpro est déconnecté   Réponse avec citation

Publicité

Vieux 22/01/2009, 03h28   #2
Yodajr
Administrateur
 
Date d'inscription: 09/11/2005
Messages: 3 750
Par défaut

Citation:
Envoyé par pspmasterpro Voir le message
It works without the OSLIB graphic functions.
Sorry it doesn't help, but why don't you use the OSLib graphic functions ?
Yodajr est déconnecté   Réponse avec citation
Vieux 25/01/2009, 03h10   #3
pspmasterpro
Membre
 
Date d'inscription: 22/01/2009
Messages: 17
Par défaut

O.K. I fixed it I removed graphics.h. It seams that that OSLIB was conflicting with graphics.h
pspmasterpro est déconnecté   Réponse avec citation
Réponse

Liens sociaux

Tags
graphics, oslib, psp

Publicité



Utilisateurs regardant la discussion actuelle : 1 (0 membre(s) et 1 invité(s))
 
Outils de la discussion
Modes d'affichage

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Navigation rapide

Discussions similaires
Discussion Auteur Forum Réponses Dernier message
Wii Problem Twilight Hack marsupilami [WII] Divers 7 13/12/2008 17h29
PSP Résolu Try to load an splash screen Pro X Aide au développement 4 29/06/2008 00h54
µLibrary Aide Problem loading large image jplaza µLibrary 6 29/05/2008 23h51
A problem with image drawing, and a question. Netaro Aide au développement 2 05/10/2007 19h13
µLibrary Aide Using uLibrary&PALib at the same screen theNinjaBunny µLibrary 6 26/03/2007 21h28


Fuseau horaire GMT +2. Il est actuellement 23h03.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd. Tous droits réservés.
Version française #16 par l'association vBulletin francophone
Design par Ass-Itch, DJP et Dr.Vince