[Interested?] OldSchool Library
-
- Posts: 87
- Joined: Mon Jan 08, 2007 12:16 pm
- Location: Australia
im currently using OSLib to write my app called psp Super Portable Calendar, i absolutely love it even though i have come accross some bugs that could only have been produced by the library its self, but i found work arounds for them so im okay, but what i wanted to know is there a way to use OSLib in prxs cause im currently up to writing a plugin for my app for the vsh and i want to overlay some graphics and text onto the vsh is this possible with oslib??
Hello :)
I've told you that I would release MMSPlus source code, here it is:
http://oslib.palib.info/samples/download/smspsp.7z
I've also told you that I would release the PC source code:
http://oslib.palib.info/OSLib_PC_src.7z
For the PC source code, open the MyOGL/MyOGL.sln, it should compile as long as you've got a working Visual C++ install with OSLib PC version.
By pressing Ctrl+F5 (execute) it will automatically execute the contents of the "blit.c" file (in OSLib directory).
The OSLib directory is a cut & paste version of the PSP folder. Files are used there for compiling.
MyOGL is an OpenGL wrapper that permits the PSP code to work.
The Library folder just containts the project that generates the OSLib.lib file. It's open at the same time with the MyOGL solution.
The PC directory contains all the files and an installation script (Install.bat), I think it's quite easy to understand ;)
For MMSPlus, you just need a working PSPSDK + OSLib install, and to type make -f Makefile.psp at command line prompt. This will specify to use Makefile.psp, because the original Makefile isn't designed for PSP.
If you've got any problem, please post there ;)
reefbarman> Please post there the problems you've got, and how you worked around them, so that I can fix them once for all ;)
I've told you that I would release MMSPlus source code, here it is:
http://oslib.palib.info/samples/download/smspsp.7z
I've also told you that I would release the PC source code:
http://oslib.palib.info/OSLib_PC_src.7z
For the PC source code, open the MyOGL/MyOGL.sln, it should compile as long as you've got a working Visual C++ install with OSLib PC version.
By pressing Ctrl+F5 (execute) it will automatically execute the contents of the "blit.c" file (in OSLib directory).
The OSLib directory is a cut & paste version of the PSP folder. Files are used there for compiling.
MyOGL is an OpenGL wrapper that permits the PSP code to work.
The Library folder just containts the project that generates the OSLib.lib file. It's open at the same time with the MyOGL solution.
The PC directory contains all the files and an installation script (Install.bat), I think it's quite easy to understand ;)
For MMSPlus, you just need a working PSPSDK + OSLib install, and to type make -f Makefile.psp at command line prompt. This will specify to use Makefile.psp, because the original Makefile isn't designed for PSP.
If you've got any problem, please post there ;)
reefbarman> Please post there the problems you've got, and how you worked around them, so that I can fix them once for all ;)
There is no official OSLib map editor. Personnaly I use GBA Graphics, it works quite good althrough it's lacking an export to a binary format, which would be extremely useful.NeoTechni wrote:Is there a standard map format? Or an editor?
If there is no editor I could make one for Windows
Lol I've tried, but I can't work very well in the train in fact. And I don't like my laptop's screen, which is very grainy (excessive antiglare coating), it's hard to work seriously if you add the fact that I'm usually more than tired. But 4h30 train per day wasn't possible, I didn't have any social life anymore :p So I've rented a room for the rest of my year, it should go by far better ^^dot_blank wrote:why not work on this library on your long train rides :)
i know that for me the train is a nice quiet place to get
great work done as you see the country side pass by
so use natures own inspiration
Sorry for my bad english
Oldschool library for PSP - PC version released
Oldschool library for PSP - PC version released
Thanks Brunni, you're a chief :)
In fact I did like to have a look at SMS Plus source code because I thought it had AdHoc network support ... but I was wrong. The only source code with AdHoc support I could find are NJ's emulators (MVSPSP, CPS1PSP ...), I can compile them but they crash (when I compile them without AdHoc support they run OK).
I really need some working AdHoc code to complete my OSLib game, it would be really wonderfull if someone post some :)
In fact I did like to have a look at SMS Plus source code because I thought it had AdHoc network support ... but I was wrong. The only source code with AdHoc support I could find are NJ's emulators (MVSPSP, CPS1PSP ...), I can compile them but they crash (when I compile them without AdHoc support they run OK).
I really need some working AdHoc code to complete my OSLib game, it would be really wonderfull if someone post some :)
Sorry, I can't help you, because I don't have two PSP (nor do I have a wifi network at home) so I've never been interested in wifi ^^
But I've heard that somebody did it with OSLib, but it was long ago. Anyway, it's no different from a standard software without using OSLib. You can look at the original SMSPlus port by Chris Swindle, it does feature Adhoc wifi ;)
But I've heard that somebody did it with OSLib, but it was long ago. Anyway, it's no different from a standard software without using OSLib. You can look at the original SMSPlus port by Chris Swindle, it does feature Adhoc wifi ;)
Sorry for my bad english
Oldschool library for PSP - PC version released
Oldschool library for PSP - PC version released
Hi! :)
I was asking because if I have "a lot" of text over an image I think it's faster to draw it once over the image and then draw only the image then drawing the image and all the text at every frame.
Ciaooo
Sakya
Thaks, I know. :)goebish wrote:You can use oslPrintf_xy to print text where you want on the screen. If you use this function after drawing your image the text can be printed on it.
I was asking because if I have "a lot" of text over an image I think it's faster to draw it once over the image and then draw only the image then drawing the image and all the text at every frame.
Ciaooo
Sakya
Hi! :)
Sorry for my english. :)
I want:
1.load an image
2.draw all the text over this image
3.draw this image at every frame
instead of
1.load an image
2.draw the image at every frame
3.draw all the text at every frame
Ciaooo
Sakya
Thanks for your reply.goebish wrote:Sorry, I can't understand what you want ... maybe you should have a look at the clipping functions, but I'm not sure.
Drawing a full screen of text on every frame should not drop performances too much anyway
Sorry for my english. :)
I want:
1.load an image
2.draw all the text over this image
3.draw this image at every frame
instead of
1.load an image
2.draw the image at every frame
3.draw all the text at every frame
Ciaooo
Sakya
Sorry for the late reply again, I was not at home these last days ^^
Sayka> You can, using oslSetDrawBuffer.
First, load your image, make sure to put it in VRAM, the GPU can't write to conventional RAM.
Set it as a drawbuffer (using oslSetDrawBuffer).
Draw your text on it like you would on the screen. It will be drawn to the image you set as drawbuffer instead of the screen.
Restore the original drawbuffer (the screen) using oslSetDrawBuffer(OSL_DEFAULT_BUFFER).
Do anything you want with your image ;)
Basically you've got an array in the current font (osl_curFont) containing the width of every character. Use osl_curFont->charWidths[yourCar] to get its width. The height is fixed for all characters in each fonts, you can get it with osl_curFont->charHeight. I think MMSPlus includes a function that calculates the width of a string, but I'm not sure anymore.
The (only) advantage of drawing text directly on an image is if you want to get the whole thing transparent, else you'll get a semi-transparent image plus a semi-transparent text over it, making a double-semi-transparent = 1/4 transparent text instead of 1/2. It's also okay if you want to scale or rotate your text.
Please note that putting an image to VRAM (for drawing) is not always a good idea. It's much faster for drawing but the VRAM is quite small (2 MB, minus the screen drawbuffer, that is 557 kB or 1.12 MB respectively for 16 or 32-bit mode) and should be reserved to critical images (drawn a lot of times, like map tilesets).
If you only use that image once per frame, you can copy it back to RAM after you finished drawing on it and delete the original one in VRAM to spare some VRAM.
Sayka> You can, using oslSetDrawBuffer.
First, load your image, make sure to put it in VRAM, the GPU can't write to conventional RAM.
Set it as a drawbuffer (using oslSetDrawBuffer).
Draw your text on it like you would on the screen. It will be drawn to the image you set as drawbuffer instead of the screen.
Restore the original drawbuffer (the screen) using oslSetDrawBuffer(OSL_DEFAULT_BUFFER).
Do anything you want with your image ;)
Look at the text.c file in the source, I think you'll understand easily how oslDrawString works.sakya wrote:Hi! :)
Is there a way to calculate the width/height of a text in pixel?
How can I adjust text to the right? :)
Many thanks
Ciaooo
Sakya
Basically you've got an array in the current font (osl_curFont) containing the width of every character. Use osl_curFont->charWidths[yourCar] to get its width. The height is fixed for all characters in each fonts, you can get it with osl_curFont->charHeight. I think MMSPlus includes a function that calculates the width of a string, but I'm not sure anymore.
Effectively it doesn't. Drawing your text directly on the image is a bit faster but it becomes only critical if you draw that image say 20 or 50 times per frame.goebish wrote:Drawing a full screen of text on every frame should not drop performances too much anyway
The (only) advantage of drawing text directly on an image is if you want to get the whole thing transparent, else you'll get a semi-transparent image plus a semi-transparent text over it, making a double-semi-transparent = 1/4 transparent text instead of 1/2. It's also okay if you want to scale or rotate your text.
Please note that putting an image to VRAM (for drawing) is not always a good idea. It's much faster for drawing but the VRAM is quite small (2 MB, minus the screen drawbuffer, that is 557 kB or 1.12 MB respectively for 16 or 32-bit mode) and should be reserved to critical images (drawn a lot of times, like map tilesets).
If you only use that image once per frame, you can copy it back to RAM after you finished drawing on it and delete the original one in VRAM to spare some VRAM.
Sorry for my bad english
Oldschool library for PSP - PC version released
Oldschool library for PSP - PC version released
Hi! :)
Ciaooo
Sakya
Wow, many thanks for the reply. I think I undestand (I'm not an experienced C/C++ coder). :)Brunni wrote:Sayka> You can, using oslSetDrawBuffer.
[...]
If you only use that image once per frame, you can copy it back to RAM after you finished drawing on it and delete the original one in VRAM to spare some VRAM.
Ciaooo
Sakya
You're welcome ^^sakya wrote:Hi! :)Wow, many thanks for the reply. I think I undestand (I'm not an experienced C/C++ coder). :)Brunni wrote:Sayka> You can, using oslSetDrawBuffer.
[...]
If you only use that image once per frame, you can copy it back to RAM after you finished drawing on it and delete the original one in VRAM to spare some VRAM.
Ciaooo
Sakya
Btw that not really has to do with C/C++, look at oslCreateImageCopy(sourceImage, newLocation) and oslDeleteImage(anyImage). Please remember that for images placed in VRAM OSLib acts like a stack, so the last image created must be the first deleted, and so on ;)
Sorry for my bad english
Oldschool library for PSP - PC version released
Oldschool library for PSP - PC version released
Hey Brunni! Thanks for this awsome lib, im using it to make my next (first!) game, and im loving it so far, but i have one small problem.
Im not sure if its a bug, or me not understanding exactly what a buffer is, but i have this code:
And 'menuBack' is being drawn under 'screen'. Shouldnt oslDrawImage draw onto the current buffer, which would be 'screen' in this case?
Im not sure if its a bug, or me not understanding exactly what a buffer is, but i have this code:
Code: Select all
#define draw oslDrawImage
...
// Create draw buffer in VRAM
OSL_IMAGE *screen = oslCreateImage(WIDTH,HEIGHT,OSL_IN_VRAM,OSL_PF_8888);
oslSetDrawBuffer(screen);
if (curState->menu == TRUE) {
menuBack->angle++;
if (menuBack->angle==360) menuBack->angle=0;
draw(menuBack);
}
oslSetDrawBuffer(OSL_DEFAULT_BUFFER); // Restore default buffer
screen->centerX = screen->sizeX/2; // Use center of screen buffer
screen->centerY = screen->sizeY/2;
screen->x = WIDTH/2;
screen->y = HEIGHT/2;
draw(screen);
oslDeleteImage(screen);
//End of display code
oslEndDrawing();
//Synchronization
oslSyncFrame();
Thanks :)
If I understand your code correctly, you are drawing 'menuback' on 'screen' and then drawing 'screen' on 'OSL_DEFAULT_BUFFER', so it's normal that 'menuback' appears, it's like if you draw a character (menuback) on a sheet of paper (screen) and then look at it with your eyes (OSL_DEFAULT_BUFFER), you'll see the character (menuback) ;)
If I understand your code correctly, you are drawing 'menuback' on 'screen' and then drawing 'screen' on 'OSL_DEFAULT_BUFFER', so it's normal that 'menuback' appears, it's like if you draw a character (menuback) on a sheet of paper (screen) and then look at it with your eyes (OSL_DEFAULT_BUFFER), you'll see the character (menuback) ;)
Sorry for my bad english
Oldschool library for PSP - PC version released
Oldschool library for PSP - PC version released
Thats the thing though, thats what i expect to happen, but menuback isnt being shown at all, like its underneath screen, or being drawn onto OSL_DEFAULT_BUFFER before screen.Brunni wrote:Thanks :)
If I understand your code correctly, you are drawing 'menuback' on 'screen' and then drawing 'screen' on 'OSL_DEFAULT_BUFFER', so it's normal that 'menuback' appears, it's like if you draw a character (menuback) on a sheet of paper (screen) and then look at it with your eyes (OSL_DEFAULT_BUFFER), you'll see the character (menuback) ;)
Maps Sample Freeze
Hi,
I've installed OSlib 1.0 from brunni.dev-fr.org and tried to compile the maps sample found at http://oslib.palib.info/samples/.
Everything compiled fine and the program loads on my PSP. Everything works (scrolling, sound, adding and removing layers) except the screenshot function just freezes when I press select? I have no choice but to shutdown the PSP and restart.
I am using 3.03oe-c and running this from the GAME150 directory would that cause any problems with the screenshot function in this example?
Thanks for a great programing lib! :)
I've installed OSlib 1.0 from brunni.dev-fr.org and tried to compile the maps sample found at http://oslib.palib.info/samples/.
Everything compiled fine and the program loads on my PSP. Everything works (scrolling, sound, adding and removing layers) except the screenshot function just freezes when I press select? I have no choice but to shutdown the PSP and restart.
I am using 3.03oe-c and running this from the GAME150 directory would that cause any problems with the screenshot function in this example?
Thanks for a great programing lib! :)
Re: Maps Sample Freeze
This is not normal. At least it works perfectly for me (3.10 OE-A'). Anyway I don't want to debug this now as I'm preparing the next version and a lot of things changed, however if you're still getting this problem with the next version, please contact me ;-)goonjamin wrote:I am using 3.03oe-c and running this from the GAME150 directory would that cause any problems with the screenshot function in this example?
Sorry for my bad english
Oldschool library for PSP - PC version released
Oldschool library for PSP - PC version released
Now that I think about it, you must make sure that the alpha in the drawbuffer is nonzero (or disable alpha by calling oslSetAlpha(OSL_FX_NONE, 0), or use a format that doesn't contain alpha: OSL_PF_5650) else nothing will be drawn because alpha=0 means a transparent pixel. You can clear the image by yourself if you want:seventoes wrote:Thats the thing though, thats what i expect to happen, but menuback isnt being shown at all, like its underneath screen, or being drawn onto OSL_DEFAULT_BUFFER before screen.Brunni wrote:Thanks :)
If I understand your code correctly, you are drawing 'menuback' on 'screen' and then drawing 'screen' on 'OSL_DEFAULT_BUFFER', so it's normal that 'menuback' appears, it's like if you draw a character (menuback) on a sheet of paper (screen) and then look at it with your eyes (OSL_DEFAULT_BUFFER), you'll see the character (menuback) ;)
Code: Select all
u32 backColor = oslConvertColor(image->pixelFormat, OSL_PF_8888, RGBA(0, 0, 0, 255));
oslClearImage(image, backColor);
Sorry for my bad english
Oldschool library for PSP - PC version released
Oldschool library for PSP - PC version released
Aha! That worked perfectly, thanks brunni! Cant wait for the next version of OSLib! (feature request: drawing an image with specific alpha ;) )Brunni wrote: Now that I think about it, you must make sure that the alpha in the drawbuffer is nonzero (or disable alpha by calling oslSetAlpha(OSL_FX_NONE, 0), or use a format that doesn't contain alpha: OSL_PF_5650) else nothing will be drawn because alpha=0 means a transparent pixel. You can clear the image by yourself if you want:Note that the convertcolor is not necessary, it's just here to ensure that the color will be in the same pixel format as the image. The important thing is: alpha is 255, that is, opaque.Code: Select all
u32 backColor = oslConvertColor(image->pixelFormat, OSL_PF_8888, RGBA(0, 0, 0, 255)); oslClearImage(image, backColor);
Thanks! I hope you'll be happy with it ;-)seventoes wrote:Aha! That worked perfectly, thanks brunni! Cant wait for the next version of OSLib!
Huh? I don't understand what you're requesting. Can't oslSetAlpha do what you want?seventoes wrote:(feature request: drawing an image with specific alpha ;) )
Sorry for my bad english
Oldschool library for PSP - PC version released
Oldschool library for PSP - PC version released
Not really, i mean kind of like oslDrawImageXY, but with alpha instead of XY, for example i could draw an image all blue and semi-transparent by calling oslDrawImageAlpha(image,RGBA(0,0,255,100));Brunni wrote:Huh? I don't understand what you're requesting. Can't oslSetAlpha do what you want?seventoes wrote:(feature request: drawing an image with specific alpha ;) )
Right now there isnt (or im not seeing!) a way to do anything like that. Any advice? :)
With this version:seventoes wrote:Not really, i mean kind of like oslDrawImageXY, but with alpha instead of XY, for example i could draw an image all blue and semi-transparent by calling oslDrawImageAlpha(image,RGBA(0,0,255,100));Brunni wrote:Huh? I don't understand what you're requesting. Can't oslSetAlpha do what you want?seventoes wrote:(feature request: drawing an image with specific alpha ;) )
Right now there isnt (or im not seeing!) a way to do anything like that. Any advice? :)
Code: Select all
void oslDrawImageAlpha(OSL_IMAGE *img, OSL_COLOR alpha)
{
//Save current alpha params
int oldEffect = osl_currentAlphaEffect, oldAlpha = osl_currentAlphaCoeff;
//Temporarily set alpha
oslSetAlpha(OSL_FX_ALPHA | OSL_FX_COLOR, alpha);
oslDrawImage(img);
//Restore old value
oslSetAlpha(oldEffect, oldAlpha);
}
Code: Select all
void oslDrawImageAlpha(OSL_IMAGE *img, OSL_COLOR alpha)
{
//Save current alpha params
OSL_ALPHA_PARAMS p;
oslGetAlphaEx(&p);
oslSetAlpha(OSL_FX_TINT, alpha);
oslDrawImage(img);
oslSetAlphaEx(&p);
}
Code: Select all
void oslDrawImageAlpha(OSL_IMAGE *img, OSL_COLOR alpha)
{
//Does not resotre original alpha value, so next images will also appear tinted unless you issue a oslSetAlpha(OSL_FX_DEFAULT, 0) after this call
sceGuAmbientColor(alpha);
oslDrawImage(img);
}
Sorry for my bad english
Oldschool library for PSP - PC version released
Oldschool library for PSP - PC version released
I don't know exactly yet, but there should be a beta very soon, and the final 2.0 (with new samples and documentation) in planned for summer (as Yodajr is unavailable until then) ;-)
Sorry for my bad english
Oldschool library for PSP - PC version released
Oldschool library for PSP - PC version released
Brunni , can you help me a little with your library?
Brunni, pouvez-vous m'aider avec votre bibliothèque ? (translation by babel fish)
Please because you're the only one who can.
Svp parce que vous êtes le seul qui peut. (translation by babel fish)
Here's my code for the animation!
Voici mon code pour l'animation ! (translation by babel fish)
Savez-vous je peux créer un nouvel exemple de l'objet chaque fois ?(translation by babel fish)
Brunni, pouvez-vous m'aider avec votre bibliothèque ? (translation by babel fish)
Please because you're the only one who can.
Svp parce que vous êtes le seul qui peut. (translation by babel fish)
Here's my code for the animation!
Voici mon code pour l'animation ! (translation by babel fish)
Do you know how i can create a new instance of the object every time?s++;
oslSetImageTileSize(Soldier_dead,(s * 30),0,30,47);
if (s>soldier_max_frame) s=0;
Savez-vous je peux créer un nouvel exemple de l'objet chaque fois ?(translation by babel fish)