-
Notifications
You must be signed in to change notification settings - Fork 4
/
vlf.h
2034 lines (1837 loc) · 59.7 KB
/
vlf.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#ifndef __VLF_H__
#define __VLF_H__
typedef struct _VlfText *VlfText;
typedef struct _VlfPicture *VlfPicture;
typedef struct _VlfShadowedPicture *VlfShadowedPicture;
typedef struct _VlfBatteryIcon *VlfBatteryIcon;
typedef struct _VlfSpin *VlfSpin;
typedef struct _VlfCheckBox *VlfCheckBox;
typedef struct _VlfProgressBar *VlfProgressBar;
typedef struct _VlfScrollBar *VlfScrollBar;
typedef struct _VlfInputBox *VlfInputBox;
#define VLF_DEFAULT -1
#define VLF_TITLEBAR_HEIGHT 22
#define VLF_ERROR_INVALID_INPUT (-1)
#define VLF_ERROR_INVALID_INPUT_DATA (-2)
#define VLF_ERROR_UNSUPPORTED_FORMAT (-3)
#define VLF_ERROR_OBJECT_OVERFLOW (-4)
#define VLF_ERROR_OBJECT_NOT_FOUND (-5)
#define VLF_ERROR_NO_MEMORY (-6)
#define VLF_ERROR_SYSTEM (-7)
#define VLF_ERROR_DUPLICATED (-8)
#define VLF_EV_RET_NOTHING 0
#define VLF_EV_RET_REMOVE_EVENT 1
#define VLF_EV_RET_REMOVE_OBJECTS 2
#define VLF_EV_RET_REMOVE_HANDLERS 4
#define VLF_EV_RET_REFRESH_ON_DELAY 8
#define VLF_EV_RET_DELAY 0x80000000 /* Delay VLF_EV_RET_DELAY | (X << 16), 0 <= X <= 32767 milisecs */
#define VLF_EV_RET_DELAY_FRAME (VLF_EV_RET_DELAY | 0x40000000) /* Delay VLF_EV_RET_DELAY_FRAME| (X << 16), 0 <= X <= 4095 */
/* Alignment */
enum VlfObjects
{
VLF_TEXT = 0,
VLF_PIC = 1,
VLF_SHADOWED_PIC = 2,
VLF_PROGRESS_BAR = 3
};
enum VlfTextAlignment
{
VLF_ALIGNMENT_LEFT = 0,
VLF_ALIGNMENT_CENTER = 0x200,
VLF_ALIGNMENT_RIGHT = 0x400
};
enum VlfButtonIcon
{
VLF_ENTER = 0,
VLF_CANCEL = 1,
VLF_CROSS = 2,
VLF_CIRCLE = 3,
VLF_TRIANGLE = 4,
VLF_SQUARE = 5
};
/** Fade modes */
enum VlfFadeModesFlags
{
VLF_FADE_MODE_IN = 1,
VLF_FADE_MODE_OUT = 2,
VLF_FADE_MODE_REPEAT = 4,
};
enum VlfFadeSpeed
{
VLF_FADE_SPEED_STANDARD,
VLF_FADE_SPEED_FAST,
VLF_FADE_SPEED_VERY_FAST,
VLF_FADE_SPEED_SLOW,
VLF_FADE_SPEED_SUPER_FAST
};
enum VlfBatteryIconStatus
{
VLF_BATTERY_ICON_HIGH,
VLF_BATTERY_ICON_MEDIUM,
VLF_BATTERY_ICON_LOW,
VLF_BATTERY_ICON_LOWEST
};
enum RCOType
{
RCO_GRAPHIC,
RCO_OBJECT,
RCO_SOUND,
RCO_LABEL,
RCO_FILEPARAM,
RCO_ANIMPARAM
};
enum VLF_MDType
{
VLF_MD_TYPE_ERROR,
VLF_MD_TYPE_NORMAL,
};
enum VLF_MD_Buttons
{
VLF_MD_BUTTONS_NONE = 0,
VLF_MD_BUTTONS_YESNO = 0x10,
};
enum VLF_MD_InitalCursor
{
VLF_MD_INITIAL_CURSOR_YES = 0,
VLF_MD_INITIAL_CURSOR_NO = 0x100,
};
enum VLF_MD_ButtonRes
{
VLF_MD_NONE,
VLF_MD_YES,
VLF_MD_NO,
VLF_MD_BACK
};
enum VLF_DialogItem
{
VLF_DI_ENTER,
VLF_DI_CANCEL,
VLF_DI_BACK,
VLF_DI_YES,
VLF_DI_NO,
VLF_DI_EDIT,
};
enum VLF_SpinState
{
VLF_SPIN_STATE_NOT_FOCUS, // Spin control has not focus, buttons are not listened
VLF_SPIN_STATE_FOCUS, // Spin control text has focus but arrow is not shown, buttons are not listened
VLF_SPIN_STATE_ACTIVE, // Spin control has focus, and it is active (arrows are shown, up and down buttons are listened)
};
enum VLF_InputBoxType
{
VLF_INPUTBOX_TYPE_NORMAL,
VLF_INPUTBOX_TYPE_PASSWORD
};
enum PspCtrlExtension
{
PSP_CTRL_ENTER = 0x40000000,
PSP_CTRL_CANCEL = 0x80000000
};
/**
* Inits VLF library
*
* @param heap_size - The heap size to be allocated. It can be negative.
* @param app_main - The program main application.
*/
void vlfGuiInit(int heap_size, int (* app_main)(int argc, char *argv[]));
/**
* Performs typical application initialization tasks (adding background, system model, and optionally battery icon and clock).
*
* @param battery - Inidicates if a battery icon should be added.
* @param clock - Indicates if a clock should be added.
* @param notuserwp - If user configuration is set to use a custom background and this param is 1, then the custom wallpaper won't be used.
*
* @returns 0 on success
*
* @Notes: If an user wallpaper is used, the background model ("waves") won't be added.
*/
int vlfGuiSystemSetup(int battery, int clock, int notuserwp);
/**
* Gets language used by vlf application
*
* @returns - The language set to be used by current vlf application
* By default is initialized to user language.
*/
int vlfGuiGetLanguage();
/**
* Sets language to be used by blf application
*
* @param lang - The language to be set.
* This only sets the language to be used by current vlf application,
* it doesn't overwrite user preferences in flash.
*/
void vlfGuiSetLanguage(int lang);
/**
* Gets the button configuration used by vlf application (0 -> circle is enter, 1 -> cross is enter)
*
* @returns - The button configuration set to be used by current vlf application.
* By default is initialized with user preferences.
*/
int vlfGuiGetButtonConfig();
/**
* Sets the button configuration to be used by current vlf application.
*
* @param config - The button configuration to be set (0 -> circle is enter, 1 -> cross is enter)
* This only sets the button configuration to be used by current vlf application,
* it doesn't overwrite user preferences in flash.
*/
void vlfGuiSetButtonConfig(int config);
/**
* Sets the directories where resources are located.
*
* @param dir - The directory that will be used to locate resources (max 256 chars including '\0')
* By default is initialized to flash0:/vsh/resource
*/
void vlfGuiSetResourceDir(char *dir);
/**
* Performs the draw of next frame
*/
void vlfGuiDrawFrame();
/**
* Loads resources from a rco file
*
* @param rco - It can be one of following things:
* - path relative to the <resource_dir> directory without extension (e.g. "system_plugin_bg")
* - path relative to the <resource_dir> directory with extension (e.g. "system_plugin_bg.rco")
* - path to a file (e.g. "flash0:/vsh/resource/system_plugin_bg.rco", "ms0:/myresfile.rco")
*
* RCO param is evaluated in the order given above, so if a rco file exists in current directory with name
* "system_plugin_bg.rco", it would load the one of <resource_dir> and not the one of current directory. (in such a case, use "./system_plugin_bg.rco")
*
* @param n - The number of resources to loads
* @param names (IN) - An array with the names of resources
* @param types (IN) - An array with the types of the resources (one of RCOType)
* @param datas (OUT) - A pointer to a variable that will receive an array of pointers to the content of each resource,
* or NULL if a specific resource has not been found.
* Pointers returned are allocated with malloc, and should be deallocated by the application.
*
* @param sizes (OUT) - It will receive the sizes of the resources
* @param pntable (OUT) - A pointer that will receive the string table. Pass NULL if no required.
* Returned pointer is allocated with malloc and should be deallocated by the application.
*
* @returns - the number of resources loaded, or < 0 if there is an error.
*
* @Example: Load battery icon pic and shadow
*
* char *names[2];
* void *datas[2];
* int types[2], sizes[2];
*
* names[0] = "tex_battery";
* names[1] = "tex_battery_shadow";
* types[0] = types[1] = RCO_GRAPHIC;
*
* int res = vlfGuiLoadResources("system_plugin_fg", 2, names, types, datas, sizes, NULL);
* if (res != 2) // error or not all resources loaded
* {
* if (res > 0)
* {
* if (datas[0])
* free(datas[0]);
* if (datas[1])
* free(datas[1]);
* }
* }
* else
* {
* void *bat;
* vlfGuiAddShadowedPicture(&bat, datas[0], sizes[0], datas[1], sizes[1], 441, 4, 1, 1, 1);
* free(datas[0]);
* free(datas[1]);
* }
*
*/
int vlfGuiLoadResources(char *rco, int n, char **names, int *types, void **datas, int *sizes, char **pntable);
/**
* Caches a resource in RAM, so it doesn't have to be loaded from storage device anymore.
*
* @param rco - The resource. Same rules apply to this param
*
* @returns - < 0 on error.
*/
int vlfGuiCacheResource(char *rco);
/**
* Uncaches a resource previously cached.
*
* @param rco - The resource to be uncached.
*
* @returns - < 0 on error.
*/
int vlfGuiUncacheResource(char *rco);
//int vlfGuiGetResourceSubParam(void *entry, int insize, char *ntable, char *name, void **data, int *size);
/**
* Loads an unicode string from a resource.
*
* @param str - Buffer that receives the string
* @param rco - The resource file to load the label from.
* @param name - The name of the resource
*
* @returns - < 0 on error.
*/
int vlfGuiLoadLabel(u16 *str, char *rco, char *name);
/**
* Sets the background from 8888 texture data
*
* @param texture - The texture data in 8888 format
* @param width - The width of texture. Must be a power of 2.
* @param height - The height of texture. Must be multiple of 8.
* @param swizzled - Indicates if the texture is already in the psp GE fast texture format
* @param scale_x - The x scale to apply
* @param scale_y - The y scale to apply
*
* @returns 0 on success, or < 0 on error (params invalid)
*/
int vlfGuiSetBackground(u32 *texture, int width, int height, int swizzled, float scale_x, float scale_y);
/**
* Sets the background from a file buffer.
* Supported formats are currently: BMP, TIM, GIM and PNG, with a depth of 24 or 32 bits.
*
* @param data - The buffer with the file data
* @param size - The size of the data
* @param scale - Wether to scale the image. If it is 0, the image will be centered and filled by black.
*
* @returns - 0 on success, < 0 on error.
*/
int vlfGuiSetBackgroundFileBuffer(void *data, int size, int scale);
/**
* Sets the background from a file
* Supported formats are currently: BMP, TIM, GIM and PNG, with a depth of 24 or 32 bits.
*
* @param file - Path to the file.
* @param scale - Wether to scale the image. If it is 0, the image will be centered and filled by black.
*
* @returns - 0 on success, < 0 on error.
*/
int vlfGuiSetBackgroundFile(char *file, int scale);
/**
* Sets one of system backgrounds based on the index.
*
* @param index - The index of the background, valid values are 1-27
* (note that 13-27 is only available on slim and will return an error on old psp)
*
* @returns 0 on success, < 0 on error
*/
int vlfGuiSetBackgroundIndex(int index);
/**
* Sets one of system backgrounds based on the current date
*
* @returns 0 on success, < 0 on error
*/
int vlfGuiSetBackgroundDate();
/**
* Sets a background of a single color
*
* @param color - The color in XXBBGGRR format (XX is ignored).
*
* @returns - this functions always succeeds returning 0
*/
int vlfGuiSetBackgroundPlane(u32 color);
/**
* Sets the background according to the system configuration
*
* @returns - 0 on success, < 0 on error.
*/
int vlfGuiSetBackgroundSystem(int notuserwp);
/**
* Sets the system color, used in titlebars or menus
*
* @param index - the index of the color, 1-27
*/
void vlfGuiSetSystemColor(int index);
/**
* Sets the background model from a buffer.
*
* @param data - The buffer with the model in GMO format
* @param size - The size of the model
*
* @returns - 0 on success, < 0 on error.
*/
int vlfGuiSetModel(void *data, int size);
/**
* Sets the background model from a file.
*
* @param file - The file with the model in GMO format
*
* @returns - 0 on success, < 0 on error.
*/
int vlfGuiSetModelFile(char *file);
/**
* Sets the background model from a resource.
*
* @param rco - The path to the RCO file
* @param name - The name of the resource
*
* @returns - 0 on success, < 0 on error.
*/
int vlfGuiSetModelResource(char *rco, char *name);
/**
* Sets the background model of the system, and applies the proper world matrix to it.
*
* @returns 0 on success, < 0 on error.
*/
int vlfGuiSetModelSystem();
/**
* Sets the world matrix for the model. (by default, the world matrix is the identity
* after a model has been loaded, except when calling vlfGuiSetModelSystem).
*
* @param matrix - The matrix to set.
*
* @Example: Load waves (this sample assumes the default scale of 8.5)
*
* int res = vlfGuiSetModelResource("system_plugin_bg", "mdl_bg");
* if (res < 0) process_error;
*
* ScePspFMatrix4 matrix;
* ScePspFVector3 scale;
*
* scale.x = scale.y = scale.z = 8.5f;
* gumLoadIdentity(&matrix);
* gumScale(&matrix, &scale);
* vlfGuiSetModelWorldMatrix(&matrix);
*/
void vlfGuiSetModelWorldMatrix(ScePspFMatrix4 *matrix);
/**
* Gets the world matrix of the model
*
* @returns a pointer to the model world matrix
*/
ScePspFMatrix4 *vlfGuiGetModelWorldMatrix();
/**
* Sets the model speed
*
* @param speed - The speed, default model speed is 1.0f/60.0f
*/
void vlfGuiSetModelSpeed(float speed);
/**
* Sets a title bar with the current system color.
*
* @param text - Text of the title bar. Pass NULL if no required.
* @param pic - Picture of the title bar. Pass NULL if no required.
* @param visible - If the tile bar will be visible
* @param hideobj - If 1, it will hide objects that were current added within the area of the title bar.
*/
void vlfGuiSetTitleBar(VlfText text, VlfPicture pic, int visible, int hideobj);
/**
* Sets a title bar with the desired color.
*
* @param text - Text of the title bar. Pass NULL if no required.
* @param pic - Picture of the title bar. Pass NULL if no required.
* @param visible - If the tile bar will be visible
* @param hideobj - If 1, it will hide objects that were current added within the area of the title bar.
* @param color - The color of the title bar.
*/
void vlfGuiSetTitleBarEx(VlfText text, VlfPicture pic, int visible, int hideobj, u32 color);
/**
* Sets the tile bar visibility.
*/
void vlfGuiSetTitleBarVisibility(int visible);
/**
* Adds a new text item from an ascii string.
*
* @param x - x position
* @param y - y position
* @param string - ascii string with the desired text
*
* @returns a VlfText item on success, NULL on error.
*/
VlfText vlfGuiAddText(int x, int y, char *string);
/**
* Adds a new text item from an unicode string.
*
* @param x - x position
* @param y - y position
* @param string - unicode string with the desired text
*
* @returns a VlfText item on success, NULL on error.
*/
VlfText vlfGuiAddTextW(int x, int y, u16 *string);
/**
* Adds a new text item from a string with format
*
* @param x - x position
* @param y - y position
* @param fmt - string with format
*
* @returns a VlfText item on success, NULL on error.
*/
VlfText vlfGuiAddTextF(int x, int y, char *fmt, ...);
/**
* Adds a new text item from a resource label
*
* @param rco - The resource file to load the label from.
* @param name - The name of the resource.
* @param x - x position
* @param y - y position
*
* @returns a VlfText item on success, NULL on error.
*/
VlfText vlfGuiAddTextResource(char *rco, char *name, int x, int y);
/**
* Removes a text item.
*
* @param text - The text item to remove
*
* @returns - < 0 on error.
*/
int vlfGuiRemoveText(VlfText text);
/**
* Sets the text of a VlfText item from an ascii string.
*
* @param text - The text item
* @param string - The ascii string to set.
*
* @returns - < 0 on error.
*/
int vlfGuiSetText(VlfText text, char *string);
/**
* Sets the text of a VlfText item from an unicode string.
*
* @param text - The text item
* @param string - The unicode string to set.
*
* @returns - < 0 on error.
*/
int vlfGuiSetTextW(VlfText text, u16 *string);
/**
* Sets the text of a VlfText item from a string with format.
*
* @param text - The text item
* @param fmt - The string with format.
*
* @returns - < 0 on error.
*/
int vlfGuiSetTextF(VlfText text, char *fmt, ...);
/**
* Sets the text of a VlfText item from a resource label.
*
* @param text - The text item
* @param rco - The resource file to load the label from.
* @param name - The name of the resource.
*
* @returns - < 0 on error.
*/
int vlfGuiSetTextResource(VlfText text, char *rco, char *name);
/**
* Sets focus on a VlfText item.
*
* @param text - The text item to set the focus.
*
* @returns - < 0 on error.
*
* @Note: this function should only be used with a text with a single line, and
* with default font size.
*/
int vlfGuiSetTextFocus(VlfText text);
/**
* Removes focus on a VlfText item previously focused.
*
* @param text - The text item to remove focus.
*
* @returns - < 0 on error.
*/
int vlfGuiRemoveTextFocus(VlfText text, int keepres);
/**
* Sets the visibility of a VlfText item.
*
* @param text - The text item.
* @param visible - boolean for the visibility.
*
* @returns - < 0 on error.
*/
int vlfGuiSetTextVisibility(VlfText text, int visible);
/**
* Makes a VlfText item to blink.
*
* @param text - The text item to set blinking.
* @param nshow - The number of frames the item will be shown.
* @param nhide - The number of frames the item wil be hidden.
*
* @returns - < 0 on error
*
* @Notes: To remove blinking, pass both params to 0.
*/
int vlfGuiSetTextBlinking(VlfText text, u32 nshow, u32 nhide);
/**
* Makes a VlfText item to fade.
*
* @param text - The text item to fade.
* @param mode - Whatever OR combination of VlfFadeModesFlags
* @param speed - The fade speed, one of VlfFadeSpeed
* @param direction_out - If both, VLF_FADE_MODE_IN and VLF_FADE_MODE_OUT, were specified, this param indicates
* wether to start from direction out or in. Otherwise, it is ignored.
*
* @returns - < 0 on error.
*/
int vlfGuiSetTextFade(VlfText text, int mode, int speed, int direction_out);
/**
* Cancels a VlfText item fade.
*
* @param text - The text item to remove fade.
*
* @returns - < 0 on error
*/
int vlfGuiCancelTextFade(VlfText text);
/**
* Sets a callback to report the end of a fade.
*
* @param text - The text item fading.
* @param callback - The callback function that will be called at end of fade.
* @param param - param that will be passed to the callback function
* @param delay - The delay between the end of fade and the call to the callback
*
* @returns - < 0 on error
*/
int vlfGuiSetTextFadeFinishCallback(VlfText text, void (* callback)(void *), void *param, int delay);
/**
* Sets text item alignment
*
* @param text - The text item to set alignment
* @param alignment - One of VlfTextAlignment values
*
* @returns - < 0 on error
*/
int vlfGuiSetTextAlignment(VlfText text, int alignment);
/**
* Sets text position
*
* @param text - The text item to set position
* @param x - The x position
* @param y - The y position
*
* @returns - < 0 on error
*/
int vlfGuiSetTextXY(VlfText text, int x, int y);
/**
* Sets the font size of a text item
*
* @param text - The text to set font size
* @param size - The size of the font
*
* @returns - < 0 on error
*/
int vlfGuiSetTextFontSize(VlfText text, float size);
/**
* Returns the size of a text item.
*
* @param text - The text item yo get size from
* @param width - pointer to a variable that receives the width
* @param height - pointer to a variable that receivs the height
*
* @returns - < 0 on error
*/
int vlfGuiGetTextSize(VlfText text, int *width, int *height);
/**
* Sets a scrollbar in the specified text item.
*
* @param text - The text item
* @param height - The height of the scrollbar
*
* @returns - < 0 on error
*/
int vlfGuiSetTextScrollBar(VlfText text, int height);
/**
* Sets a scrollbar in the specified text item (with more options)
*
* @param text - The text item
* @param height - The height of the scrollbar
* @param dispx - displacement between text and scrollbar in X axis
* @param dispy - displacement between text and scrollbar in Y axis
*
* @returns - < 0 on error
*/
int vlfGuiSetTextScrollBarEx(VlfText text, int height, int dispx, int dispy);
/**
* Removes a scrollbar of a text item
*
* @param text - The text item
*
* @returns - < 0 on error
*/
int vlfGuiRemoveTextScrollBar(VlfText text);
/**
* Sets a character that will be replaced by a button icon
*
* @param ch - The character that will be replaced.
* @param button - The button used for the replacement, one of VlfButtonIcon
*
* @returns - < 0 on error
*/
int vlfGuiChangeCharacterByButton(u16 ch, int button);
/**
* Adds a new picture item from a buffer.
* Supported formats are GIM, TIM, BMP and PNG.
*
* @param data - The buffer with the picture
* @param size - The size of data buffer
* @param x - x position
* @param y - y position
*
* @returns - a new VlfPivture on success, NULL on error
*/
VlfPicture vlfGuiAddPicture(void *data, int size, int x, int y);
/**
* Adds a new picture item from a file.
* Supported formats are GIM, TIM, BMP and PNG.
*
* @param file - The file with the picture
* @param x - x position
* @param y - y position
*
* @returns - a new VlfPivture on success, NULL on error
*/
VlfPicture vlfGuiAddPictureFile(char *file, int x, int y);
/**
* Adds a new picture item from a resource.
* Supported formats are GIM, TIM, BMP and PNG.
*
* @param rco - The rco
* @param name - The name of the resource
* @param x - x position
* @param y - y position
*
* @returns - a new VlfPivture on success, NULL on error
*/
VlfPicture vlfGuiAddPictureResource(char *rco, char *name, int x, int y);
/**
* Removes a picture
*
* @param pic - The picture to remove
*
* @returns - < 0 on error.
*/
int vlfGuiRemovePicture(VlfPicture pic);
/**
* Sets a picture position.
*
* @param pic - The picture
* @param x - x position
* @param y - y position
*
* @returns - < 0 on error
*/
int vlfGuiSetPictureXY(VlfPicture pic, int x, int y);
/**
* Gets a picture size.
*
* @param pic - The picture
* @param width - pointer to a variable that receives the width
* @param height - pointer to a variable that receives the height
*
* @returns - < 0 on error
*/
int vlfGuiGetPictureSize(VlfPicture pic, int *width, int *height);
/**
* Sets the picture display area
*
* @param pic - The picture
* @param x - x position of the display area, relative to the top left corner of the picture.
* @param y - y position of the display area, relative to the top left corner of the picture.
* @param width - the width of the rectangle display area
* @param height - The height of the rectangle display area
*
* @returns - < 0 on error
*/
int vlfGuiSetPictureDisplayArea(VlfPicture pic, int x, int y, int width, int height);
/**
* Sets picture alpha blend operation.
*
* @param pic - the picture
* @param op - Blending operation (see pspgu.h)
* @param src - Blending function for source operand (see pspgu.h)
* @param dst - Blending function for dest operand (see pspgu.h)
* @param srcfix - Fix value for GU_FIX (source operand)
* @param destfix - Fix value for GU_FIX (dest operand)
*
* @returns - < 0 on error
*/
int vlfGuiSetPictureAlphaBlend(VlfPicture pic, int op, int src, int dst, u32 srcfix, u32 dstfix);
/**
* Clones (duplicate) a picture
*
* @param pic - The picture to clone
* @param real - If 0, then the picture is not totally copied, but only a reference. Otherwise, a total duplication is performed.
* @param x - The x position for the cloned picture
* @param y - The y position for the cloned picture
*
* @returns - The cloned picture
*/
VlfPicture vlfGuiClonePicture(VlfPicture pic, int real, int x, int y);
/**
* Sets picture visibility
*
* @param pic - The picture
* @param visible - boolean indicating visibility
*
* @returns - < 0 on error
*/
int vlfGuiSetPictureVisibility(VlfPicture pic, int visible);
/**
* Makes a picture blink
*
* @param pic - The picture to blink
* @param nshow - The number of frames the picture will be shown
* @param nhide - The number of frames the picture will be hidden
*
* @returns - < 0 on error
*/
int vlfGuiSetPictureBlinking(VlfPicture pic, u32 nshow, u32 nhide);
/**
* Animates a picture.
* Frames are created from rectangle areas of the picture.
*
* @param pic - The picture to animate
* @param w - The width of each frame, must be a divisor of picture width
* @param h - The height of each frame, must be a divisor of picture height
* @param frames - The number of frames each frame is drawn.
* @param vertical - If 0, animaction is created from rectangles in horizontal direction. Otherwise, from vertical direction.
*
* @returns - < 0 on error
*/
int vlfGuiAnimatePicture(VlfPicture pic, int w, int h, int frames, int vertical);
/**
* Makes a VlfPicture item to fade.
*
* @param pic - The picture item to fade.
* @param mode - Whatever OR combination of VlfFadeModesFlags
* @param speed - The fade speed, one of VlfFadeSpeed
* @param direction_out - If both, VLF_FADE_MODE_IN and VLF_FADE_MODE_OUT, were specified, this param indicates
* wether to start from direction out or in. Otherwise, it is ignored.
*
* @returns - < 0 on error.
*/
int vlfGuiSetPictureFade(VlfPicture pic, int mode, int effect, int direction_out);
/**
* Cancels a VlfPicture item fade.
*
* @param pic - The picture item to remove fade.
*
* @returns - < 0 on error
*/
int vlfGuiCancelPictureFade(VlfPicture pic);
/**
* Sets a callback to report the end of a fade.
*
* @param pic - The picture item fading.
* @param callback - The callback function that will be called at end of fade.
* @param param - param that will be passed to the callback function
* @param delay - The delay between the end of fade and the call to the callback
*
* @returns - < 0 on error
*/
int vlfGuiSetPictureFadeFinishCallback(VlfPicture pic, void (* callback)(void *), void *param, int delay);
/**
* Adds a new shadowed picture from two buffers.
*
* @param pic - The buffer with the main picture
* @param pic_size - The size of the pic buffer
* @param shpic - The buffer with the shadow picture
* @param shpic_size - The size of the shpic buffer
* @param x - x position
* @param y - y position
* @param sh_offsx - distance between the main picture and the shadow (x)
* @param sh_offsy - distance between the main picture and the shadow (y)
* @param shadow_before - indicates if shadow should be painted before
*
* @returns - a new shadowed picture on success, NULL on error
*/
VlfShadowedPicture vlfGuiAddShadowedPicture(void *pic, int pic_size, void *shpic, int shpic_size, int x, int y, int sh_offsx, int sh_offsy, int shadow_before);
/**
* Adds a new shadowed picture from two files
*
* @param pic - The file with the main picture
* @param shpic - The file with the shadow picture
* @param x - x position
* @param y - y position
* @param sh_offsx - distance between the main picture and the shadow (x)
* @param sh_offsy - distance between the main picture and the shadow (y)
* @param shadow_before - indicates if shadow should be painted before
*
* @returns - a new shadowed picture on success, NULL on error
*/
VlfShadowedPicture vlfGuiAddShadowedPictureFile(char *pic, char *shpic, int x, int y, int sh_offsx, int sh_offsy, int shadow_before);
/**
* Adds a new shadowed picture from two resources.
*
* @param rco .- The resource file
* @param pic - The name of the resource with the main picture
* @param shpic - The name of the resource with the shadow picture
* @param x - x position
* @param y - y position
* @param sh_offsx - distance between the main picture and the shadow (x)
* @param sh_offsy - distance between the main picture and the shadow (y)
* @param shadow_before - indicates if shadow should be painted before
*
* @returns - a new shadowed picture on success, NULL on error
*/
VlfShadowedPicture vlfGuiAddShadowedPictureResource(char *rco, char *pic, char *shpic, int x, int y, int sh_offsx, int sh_offsy, int shadow_before);
/**
* Removes a shadowed picture
*
* @param sp - The shadowed picture to remove
*
* @returns - < 0 on error.
*/
int vlfGuiRemoveShadowedPicture(VlfShadowedPicture sp);
/**
* Sets shadowed picture visibility
*
* @param sp - The shadowed picture
* @param visible - boolean indicating visibility
*
* @returns - < 0 on error
*/
int vlfGuiSetShadowedPictureVisibility(VlfShadowedPicture sp, int visible);
/**
* Makes a shadowed picture blink
*
* @param sp - The shadowed picture to blink
* @param nshow - The number of frames the picture will be shown
* @param nhide - The number of frames the picture will be hidden
*
* @returns - < 0 on error
*/
int vlfGuiSetShadowedPictureBlinking(VlfShadowedPicture sp, u32 nshow, u32 nhide);
/**
* Animates a shadowed picture.
* Frames are created from rectangle areas of the picture.
*
* @param sp - The shadowed picture to animate
* @param w - The width of each frame of main picture, must be a divisor of main picture width