Start off simple by just drawing lines or creating sound effects. It really is easy to do. Go into the Doc folder in the OSlib folder that you downloaded and read all the things that you can do with this library. To draw a color filled rectangle, all you would have to do is use this one function in their library:
Code:
void oslDrawFillRect(int x0, int y0, int x1, int y1, OSL_COLOR color);
And that would be it. The x0,y0,x1,y1 are your coordinates for your box, and color is the color you want your box to be filled as. It's that simple. In fact, take a look at all the predefined functions that are made for your use:
_______________________________________________________________________________________________ _______________________________________________________________________________________________
oslib.h
void oslInit(int useOwnCallbacks);
Initializes the library. This function should be called at the beginning of every program. If you put TRUE to useOwnCallbacks, you can manage the standard callbacks by yourself (update_thread, Exit Callback and Power Callback, that must call osl_powerCallback if it's not NULL!).
void oslQuit();
Quits the game immediately. You'll go back to the PSP game menu.
void oslInitGfx(int pixelFormat, int bDoubleBuffer);
Initializes the graphic part. You have to specify pixelFormat, which is in fact the size of a pixel on the screen, as well as if you wish to use double buffering or not.
void oslStartDrawing();
You have to call this function before drawing anything. The number of operations the GPU can do at the same time is limited, and the fact of restart the drawing permits you to start again.
void oslSyncDrawing();
Waits until all pending drawing operations are terminated. This operation can be very slow, because at normal time the GPU works in parallel to our program, and makes its tasks at its pace. This function waits that the GPU finished everything before continue. It is useful if you want to show an image which is going to change afterward (the GPU does not draw it immediately when you ask it to do it, but only when it has finish with the rest of pending operations, and thus meanwhile, the image could have changed and the display will be erroneous).
void oslEndDrawing();
End of the drawing code. It makes sure that everything was correctly drawn too. To be called before synchronizing the screen or swapping buffers.
void oslWaitVSync();
Waits the VSync (60 Hz).
void oslSwapBuffers();
In double buffering mode, swaps the visible and drawing buffer.
void oslEndGfx();
Ends the graphic part of the library. Then you can reset it with other parameters.
void oslFlushDataCache();
Flushes the data cache. Do not use.
int oslSyncFrame();
Synchronizes the screen, use it when you have finish all the drawings. This function will take charge itself swapping buffers or waiting for the VSync.
int oslSyncFrameEx();
Indicates the supplementary parameters for the synchronization.
Frameskip:
0: no frameskip (normal)
1: normal frameskip
>1: depends from vsync, skips 1 frame out of X
Max frameskip:
>=1: Maximum authorized frameskip
VSync:
0: no VSync
1: VSync enabled
+4: if you add 4, fixes the minimum frameskip (ex. with 2, the game will run at 60 fps, but 30 images per second)
+0: else, with frameskip > 1, synchronizes to the wanted framerate, ex. 2 -> 30 fps
Examples:
Code:
//30 fps (no frameskip)
oslSyncFrameEx(2,0,0);
Code:
//30 fps, game at 60, max frameskip is 2, this means no more than one frame skipped per one displayed
oslSyncFrameEx(2,2,4);
Code:
//synchronizes to 60 fps
oslSyncFrameEx(0,0,0);
void void oslSetTransparentColor(OSL_COLOR color);
Defines the color the transparent color. If a pixel of the image you want to draw is of this colour, it will not be drawn. It extends to anything (text, rectangles, etc.), that's why you should rather desactivate it once your image is drawn. During the loading of an image, pixels which have this color will take the alpha value 0, indicating that they are transparent, so you can activate the transparent color only when loading images and deactivate it when finished, it's simplier.
void oslDisableTransparentColor();
Deactivates the transparent color (all the pixels will be drawn, except those whose alpha is null).
float oslSin(int angle, int dist);
Computes the sinus from the specified angle, multiplying it by the specified ray.
float oslCos(int angle, int dist);
Idem for cosinus.
int oslGetNextPower2(int val);
Returns the next power of two for the passed number.
OSL_IMAGE *oslCreateImage(int larg, int haut, short location, short pixelFormat);
Creates a new image with the supplied parameters. Location can be OSL_IN_RAM (in RAM, 20 MB, slow) or OSL_IN_VRAM (in VRAM, 2 MB, fast). The VRAM is very limited, so use it only for the very often used images.
void oslDeleteImage(OSL_IMAGE *img);
Deletes the specified image. There is no VRAM manager by now, so if the image is in VRAM, you must have to erase the last created one, then the one which before it, in this order.
OSL_IMAGE *oslLoadImageFile(char *filename, int location, int pixelFormat);
Loads an image file (only the PNG is supported for the moment). You can choose where to put it as well as its pixelformat.
OSL_IMAGE *oslCreateImageTile(OSL_IMAGE *img, int offsetX0, int offsetY0, int offsetX1, int offsetY1);
Creates an image referencing a piece of another. You can use it to indicate a zone between (offsetX0, offsetY0) and (offsetX1, offsetY1) into img. The image contents is not copied, just referenced, but you have to call oslDeleteImage anyways when you finished with it.
OSL_IMAGE *oslCreateImageTileSize(OSL_IMAGE *img, int offsetX0, int offsetY0, int width, int height);
Idem, except that you specify the upper-left positions and the width/height of the zone.
void oslCopyImage(OSL_IMAGE *imgDst, OSL_IMAGE *imgSrc);
Copies an image to another. The format of both images must be the same.
void oslSwizzleImage(OSL_IMAGE *imgDst, OSL_IMAGE *imgSrc);
Creates an optimized copy of imgSrc to imgDst. imgSrc must be different than imgDst. The optimized version is faster to display with the GPU, but you cannot modify it after.
void oslClearImage(OSL_IMAGE *img, int color);
Erases the image entirely using the specified color.
Note: If the image is in RAM, the operation is made by the main processor. It is slower, and the color calculation is not the same as the one from the GPU. Furthermore, in 8 or 4 bits mode, the color specifies the palette index to fill the buffer, and not the real color to be looked for in the palette.
vvoid oslUncacheImage(OSL_IMAGE *img);[/i]
Flushes the specified image from the CPU cache. You have to call this function before displaying an image from which you modified the data.
OSL_IMAGE *oslCreateImageCopy(OSL_IMAGE *src, int newLocation);
Creates a copy of the specified image.
OSL_IMAGE *oslCreateSwizzledImage(OSL_IMAGE *src, int newLocation);
Idem, but the copy will be swizzled (optimized).
OSL_PALETTE *oslCreatePalette(int size, short pixelFormat);
Creates a new palette containing size colors of pixelFormat type.
OSL_PALETTE *oslLoadPalette(void *data, int size, short pixelFormat);
Creates a new palette from an array defined in your code.
void oslDrawImage(OSL_IMAGE *img);
Draws the specified image, using parameters contained in it.
void oslDrawImageSimple(OSL_IMAGE *img);
Draws the specified image. It's a faster version, but it doesn't support rotation.
void oslDrawLine(int x0, int y0, int x1, int y1, OSL_COLOR color);
Draws a line using a specified color between the points (x0, y0) and (x1, y1).
void oslDrawRect(int x0, int y0, int x1, int y1, OSL_COLOR color);
Draws a frame (empty rectangle).
void oslDrawFillRect(int x0, int y0, int x1, int y1, OSL_COLOR color);
Draws a filled rectangle.
void oslDrawGradientRect(int x0, int y0, int x1, int y1, OSL_COLOR c1, OSL_COLOR c2, OSL_COLOR c3, OSL_COLOR c4);
Draws a four-point gradient (c1: upper-left, c2: upper-right, c3: bottom-left, c4: bottom-right).
OSL_MAP *oslCreateMap(OSL_IMAGE *img, void *map_data, int tileX, int tileY, int mapSizeX, int mapSizeY, int map_format);
Create a new map. map_format must be OSL_MF_U16 (each element of the map is an unsigned short). img is the tileset (the width has to be a power of two), tileX and tileY the size of each tile, mapSizeX and mapSizeY the total size of the map.
void oslDrawMap(OSL_MAP *m);
Draws the specified map.
void oslDrawMapSimple(OSL_MAP *m);
Faster version, tileX, tileY and the tileset width must be powers of two.
void oslClearScreen(int backColor);
Clears the screen with the specified color.
void oslSetScreenClipping(int x0, int y0, int x1, int y1);
Sets the screen region on which you can draw. Anything outside this rectangle will not be drawn. It is useful for windowing for example.
void oslSetDrawBuffer(OSL_IMAGE *img);
Defines the image on which you want to draw. Pass OSL_DEFAULT_BUFFER to reset to the default screen and OSL_SECONDARY_BUFFER for the currently displayed buffer in double-buffering mode.
void oslSetAlpha(int effect, int coeff);
Defines the alpha parameters (transparency). The alpha type can be one of the following:
OSL_FX_NONE: no effect.
Formula: dst = src; (alpha is also copied to the destination, not computed)
[color=orangeOSL_FX_FLAT: Identical to OSL_FX_NONE, except that if alpha is null, the pixel will not be drawn.
Formula: dst = (src & 0xff000000) ? src : dst;
OSL_FX_RGBA: Takes the alpha channel in account for color computation. By calling this, you can for example draw a transparent blue box like this:
oslDrawFillRect(0,0,100,100,RGBA(0,0,255,128));
For the alpha channel, zero means transparent, and 255 opaque. Those values can also be used for each pixel of an image or each color of a
palette, allowing to render parts of your image transparent very easily. It's the default mode.
Formula: dst = src * asrc + dst * (1 - asrc);
OSL_FX_ALPHA: Alpha blend (normal transparency). The coefficient is multiplicated by the source color to define if your plane is
more or less transparent
Formula: dst = src * coeff + dst * (1 - coeff);
OSL_FX_ADD: Adds the source and destination, useful for "ghost" planes. You can also specify the coefficient, which is multiplicated
by the source value before the addition. If you want simple addition, pass 0xff as coefficient.
Formula: dst = src * coeff + dst;
OSL_FX_SUB: Substracts the source and destination. Useful for "mask" planes.
Formula: dst = src * coeff - dst;
OSL_FX_COLOR: Add (with an OR) to other effects so that you can define the transparency for each RGBA component. For example,
if you want to tint an image to red, you can do:
oslSetAlpha(OSL_FX_ALPHA|OSL_FX_COLOR, RGBA(0xff,0,0,0xff));
void oslSystemMessage(const char *message);
Displays the Sony system message. It is strange, but it doesn't work very well.
unsigned int oslMessageBox(const char *text, const char *title, unsigned int flags);
Displays a small dialog box.
int oslBenchmarkTestEx(int startend, int slot);
Makes an operation on the specified benchmark slot.
OSL_CONTROLLER *oslReadKeys();
Reads the current joypad state and stores it into the global variable named osl_keys. It also returns a pointer to those data.
int oslWaitKey();
Waits a key pressed and returns its code.
int oslKbhit();
Returns the last pressed key code, and if this code is not null, you can call oslWaitKey to get it (none of the keys pressed after will be stored until you called oslWaitKey).
void oslFlushKey();
Empty the key buffer, so that next pressed keys are taken in account.
_______________________________________________________________________________________________ _______________________________________________________________________________________________
audio.h
int oslInitAudio();
Initializes the audio part of the library. This function must be necessarily called if you want to play any sound from your program.
void oslDeinitAudio();
Destroyes the audio part of the library. After having called this function, it will not be possible to play sound anymore. Call it to free audio resources and make sure that any sound is stopped.
void oslPlaySound(OSL_SOUND *s, int voice);
Plays a sound on the specified audio channel. The channel number can be between 0 and 7, and if you play the sound on an already used channel, the new sound will replace the one which is currently being played.
int oslGetSoundChannel(OSL_SOUND *s);
Allows to know on which hardware audio channel a sound is currently played. The result is -1 if the sound is not played at the moment.
void oslStopSound(OSL_SOUND *s);
Stops a sound being played, and does nothing in the opposing case. To resume the sound, call oslPlaySound, the sound will be played since the beginning.
void oslPauseSound(OSL_SOUND *s, int pause);
Pauses a currently played sound. If the pause argument is 1, the sound is paused, if it's 0 the sound is resumed (from where it had been paused), if it's -1 the current state is inverted (play/pause).
void oslAudioVSync();
Call it in your main loop if you stream some sounds. Why? When you put your PSP in stand-by mode, the kernel closes all opened files! Then, obviously the audio system was crashing. Now OSLib manages that, but it is necessary to reopen files later to continue, and it's not possible directly when the PSP wakes up because the MS is not initialized yet. This function will verify that the MS is ready, and reload files and continue where they stopped if they were. If you do not call this function, any sound currently played in streaming will be stopped when the PSP wakes up. However, it will be reloaded automatically (but restart at the beginning) when you call oslPlaySound. Exactly the same for sounds which were opened in streaming but which were not playing at this moment.
OSL_SOUND *oslLoadSoundFile(const char *filename, int stream);
Loads a .wav or .bgm file. You just need to indicate the file name as well as if you wish to stream it from the Memory Stick. If you are streaming a sound, it will not be loaded in memory, that makes you spare loading time but especially many RAM space, because the PSP as "only" 20 MB, so imagine that if you load sound effects of 1 MB each, it will be quickly saturated (memory is also shared for your code, variables, images and sound). However, streaming affects performance, especially for a high sample rate. For better performances, I advise you to use small .wav loaded for the sound effects and streamed .bgm for musics. You can also stream sound effects, but only those which are very rarely played at normal time.
int oslDeleteSound();
Deletes a sound.
void oslSetSoundLoop(OSL_SOUND *s, int loop);
Sets up looping for a sound. If the sound is looped (loop = TRUE), the sound will be repeated when finished.
SELL CVV BINS. CC DOB. CC VBV. DUMPS TRACKS FULLZ SSN+DOB. fullz with Dl Number "EIN w2 1.2 PINS ATM.. Make money ONline - SALE CC FRESH 2019 - Home page Sell CVV Fullz Dumps Valid Pins ATM 2019...
Sell cvv bins. Cc dob. Cc vbv....