• Steam recently changed the default privacy settings for all users. This may impact tracking. Ensure your profile has the correct settings by following the guide on our forums.

VLF library. Lateral menu

BlackBurd

Original Gangstuh
[tutorial]PSP VLF library

This started off as me asking for help then it turned into a tutorial because alot of people dont really know how to use the vlf library. So as i learn how to do this i will update you guys on it okay:mellow:

so lets get started im attaching a file that includes the library its the makefile(have to use that one) and a very easy sample that just puts waves on the screen and sets the background color. wich ill also post here for viewing if you already have that. okay.

Sample1
[highlight=c]
//============================================
// Basic includes/start of program
//============================================
#include <pspkernel.h>
#include <stdlib.h>
#include "vlf.h"
#include "graphics.h"
#include <pspsdk.h>
#include <pspdebug.h>
#include <pspctrl.h>
#include <psppower.h>
#include <stdio.h>
#include "pspcallbacks.h"
#include <pspdebug.h>
//--------------------------------------------
PSP_MODULE_INFO("Basicvlf", 0x800, 1, 0);
PSP_MAIN_THREAD_ATTR(0);
//==================================================================================
// Global variables
//==================================================================================
void *ReadFileAllocEx(char *file, int seek, int size, int *retSize);
int done = 0;
//==================================================================================
// Main
//==================================================================================
int app_main(int argc, char *argv[]) /* as you can see you dont use int main */
{
SetupCallbacks();
vlfGuiSetBackgroundPlane(0xFC907000);/*SETS background(you must know u32 colors.*/
vlfGuiSetModelSystem();/* Sets the waves.*/
//-----------------------------------------------------------------------------------
/* I would suggest putting most of your code in this highlighted area.*/

//-----------------------------------------------------------------------------------
while (1)
{
vlfGuiDrawFrame();/* puts it all on the screen */
}
sceKernelExitGame();
return 0;
}
[/highlight]

I made it really simple all it does is puts waves on the screen. If you downloaded the attachment you have to put the prx's that are in the vlftest folder in the same folder as the eboot. If you dont it will just be a black screen. :closedeyes:

Now in a little bit i will show you how to add text png images and central menu and lateral menu. after that i will show you how to remove items from the screen and error message popups.

And also im still learning this library myself so when i learn how to do other things then what i mentioned up there i will keep you posted and tell you how to do that also.
-------------------------
simple vlf functions
-------------------------
[highlight=c]vlfGuiAddClock();[/highlight] ^ This adds the clock from the vsh


[highlight=c]Image = vlfGuiAddPictureFile("BURD.png", 2, 2);[/highlight] ^ this adds a pic to your app
[highlight=c]vlfGuiRemovePicture(image);[/highlight] ^ this removes the pic previously stated I.E image.

[highlight=c]vlfGuiAddText(240, 100, "Hello world");[/highlight] ^ This is how to add text. first numbers are the coordanance and the words are what shows up on the screen


[highlight=c]vlfGuiMessageDialog("Whats crackin gangstuh", VLF_MD_TYPE_ERROR | VLF_MD_BUTTONS_NONE);[/highlight] ^ This puts a error message on the screen.
************************************************
LATERAL MENU
************************************************

Incase you dont know what the lateral menu is ; navigate to your music section. when you press triangle over an item to delete or edit something that is the lateral menu. The new version of the vlf library adds this (1.0 version).


so first of all you need a char.

[highlight=c]
char *items[] = { "Start", "Exit" };
[/highlight]
These are change-able. you want to change them to whatever you need your menu to say. In this case though start and exit are enough.

Okay next part putting it on the screen.
[highlight=c] vlfGuiLateralMenu(2, items, 0, mini, 100);[/highlight]
^ Now lemme break it down for you. The first number is the amount of menu items in your char in this case 2 for start and exit.

Second: the part where it says items. if you look at the char its defined as items so if you named your char thug or whatever else you woul have to change this too.

Third the part were it says "0" you dont really need to know yet but know that it is required.

Fourth the "mini" part. Well this is where the info is stored in a second function. I dont think you need a case switch statement but ive only tried with case switch so whatever your coding style is thats you. so if you look below you will see an example of the seperate menu with a case switch statement.
[highlight=c]
int mini(int sel)
{
switch (sel)
{
case 0:
sceKernelExitGame();
break;

case 1:
sceKernelExitGame();
break;
}

return VLF_EV_RET_NOTHING;
}
[/highlight]

Fourth and final the "100" part of the menu. Too be honest i dont really know what this one does i might check it out and give you results and edit it when i find out exactly what it does.

************************************************
VLF CENTRAL MENU
************************************************
Okay this one is a lil bit more simple then the lateral menu (IN my opinion) Lateral menu is only available on version 1.0.

So again you need to start with a char
[highlight=c]
char *menud[] = { "Start", "Exit" };
[/highlight]
Okay simple right.
Now again were gonna put it all on the screen.
[highlight=c]
vlfGuiCentralMenu(2, Menud, sel, CentralMenu, 10, 40);
[/highlight]
Okay now for the switch case function again.
[highlight=c]
int CentralMenu(int sel)
{
switch (sel)
{
case 0:
sceKernelExitGame();
break;

case 1:
sceKernelExitGame();
break;
}

return VLF_EV_RET_NOTHING;
}
[/highlight]
Pretty straight forward if you have been reading everything.
[highlight=c][/highlight]
 

BlackBurd

Original Gangstuh
Okay i got the lateral menu working but i cant get audio playback.

Is there a audio library thats compatible with the vlf library.
 

eldiablov

Contributor
Not many people use VLF library. I would suggest testing things for yourself and then reporting the results to forum users so they know for future reference :)
 

BlackBurd

Original Gangstuh
Not many people use VLF library. I would suggest testing things for yourself and then reporting the results to forum users so they know for future reference :)

Okay.

I can tell you what i know so far.

Mp3 libraries are not working with it (the ones ive tried)

png libraries dont work but theres one built in so it doesnt matter.

what i plan on learning
-------------------------------------
loading bar.
license text. (its in the sample)
audio. (if it can be done)


BTW what i did up there was right i just had the wrong prx's in the folder so you can mess around with that.

Additional Comment:
updated.
 

BlackBurd

Original Gangstuh
Not too sure about mp3's. :p

The loading menu, still haven't figured it out eh?

Nah but your src did help a lil bit.:cool:

I plan on updating this today with how to do the central and lateral menu.
I been busy with pirating movies :eek:.
 

itdemo

New Member
Hey man!

Keep up the good work! This is so helpful and I will definatley use it!

BTW is there a table of those u32 colors because I do not know much about them.

Thanks,
ITDemo
 

BlackBurd

Original Gangstuh
Hey man!

Keep up the good work! This is so helpful and I will definatley use it!

BTW is there a table of those u32 colors because I do not know much about them.

Thanks,
ITDemo

I did search but couldnt find alot.

I made my on chart with alot of the colors by testing different number/letter combos but formated my hdd to install windows 7.

If you find one you tell me :p
 

BlackBurd

Original Gangstuh
Get a default HTML color chart, eg. this one, take their correspondig HEX value, put it the other way around and add an 0x at the beginning (eg. 9966FF becomes 0xFF6699).

I wish i would of new that at first. Would've saved 5 hours. so its just reversed.

THNX. :tup:

This html table is better (this is the site i learned html from when i was in 7th grade)
HTML Color Names
 
Top