├── CHANGELOG ├── Doxyfile ├── LICENSE ├── Makefile ├── README ├── glib2d.c ├── glib2d.h └── sample ├── Makefile ├── callbacks.h ├── clock ├── Makefile └── main.c ├── coordinates ├── Makefile └── main.c ├── deform ├── Makefile └── main.c ├── depth ├── Makefile └── main.c ├── objcontrol ├── Makefile ├── main.c └── tex.png ├── screensaver ├── Makefile └── main.c └── transform ├── Makefile └── main.c /CHANGELOG: -------------------------------------------------------------------------------- 1 | Beta 5 : 2 | - Improved support of intraFont 3 | - Renamed g* functions to g2d* 4 | - Removed g2dSetCoord*Relative's third argument 5 | - Using constants instead of bools for some g2d* functions (better readability) 6 | - Dynamic allocation of the display list, no more artifacts with a small heap 7 | - Replaced G2D_FALSE and G2D_TRUE by false and true 8 | - Added a global scale factor : g2d(Set/Get/Reset)GlobalScale 9 | - Better scaling quality 10 | - Lots of code rework 11 | - No more swizzling artifacts 12 | - Smaller display list size, saves 3/4 megabyte 13 | - Forced coordmode with an inverted object is no longer applied 14 | - Corrected documentation 15 | 16 | Beta 4 : 17 | - Refactored code parts 18 | - Corrected a scaling bug 19 | - Modified gBegin to gBeginRects 20 | - Added line object support (gBeginLines), line strip support 21 | - Added quad object support (gBeginQuads) 22 | - Added point object support (gBeginPoints) 23 | - Added a new "deform" sample 24 | - Added texture repeat control (gSetTexRepeat) 25 | - Draw & display buffers defined as textures (possibility to get 26 | framebuffer pointer) 27 | 28 | Beta 3 : 29 | - Small code cleanup 30 | - Bug resolved when gAdd() was not called between gBegin()/gEnd() 31 | - Bug resolved with gPop() 32 | - Bug resolved when an image is inverted via scaling 33 | - Bug resolved when an alpha value was applied to a single object 34 | - Added gGet* functions 35 | - Added scissor functions 36 | - New samples 37 | 38 | Beta 2 : 39 | - Texture slicing (6x faster with 480*272 texture) 40 | - PDF Documentation 41 | - Minor corrections 42 | 43 | Beta 1 : 44 | - Initial release 45 | -------------------------------------------------------------------------------- /Doxyfile: -------------------------------------------------------------------------------- 1 | # Doxyfile 1.7.1 2 | 3 | # This file describes the settings to be used by the documentation system 4 | # doxygen (www.doxygen.org) for a project 5 | # 6 | # All text after a hash (#) is considered a comment and will be ignored 7 | # The format is: 8 | # TAG = value [value, ...] 9 | # For lists items can also be appended using: 10 | # TAG += value [value, ...] 11 | # Values that contain spaces should be placed between quotes (" ") 12 | 13 | #--------------------------------------------------------------------------- 14 | # Project related configuration options 15 | #--------------------------------------------------------------------------- 16 | 17 | # This tag specifies the encoding used for all characters in the config file 18 | # that follow. The default is UTF-8 which is also the encoding used for all 19 | # text before the first occurrence of this tag. Doxygen uses libiconv (or the 20 | # iconv built into libc) for the transcoding. See 21 | # http://www.gnu.org/software/libiconv for the list of possible encodings. 22 | 23 | DOXYFILE_ENCODING = UTF-8 24 | 25 | # The PROJECT_NAME tag is a single word (or a sequence of words surrounded 26 | # by quotes) that should identify the project. 27 | 28 | PROJECT_NAME = gLib2D 29 | 30 | # The PROJECT_NUMBER tag can be used to enter a project or revision number. 31 | # This could be handy for archiving the generated documentation or 32 | # if some version control system is used. 33 | 34 | PROJECT_NUMBER = Beta 5 35 | 36 | # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 37 | # base path where the generated documentation will be put. 38 | # If a relative path is entered, it will be relative to the location 39 | # where doxygen was started. If left blank the current directory will be used. 40 | 41 | OUTPUT_DIRECTORY = 42 | 43 | # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 44 | # 4096 sub-directories (in 2 levels) under the output directory of each output 45 | # format and will distribute the generated files over these directories. 46 | # Enabling this option can be useful when feeding doxygen a huge amount of 47 | # source files, where putting all generated files in the same directory would 48 | # otherwise cause performance problems for the file system. 49 | 50 | CREATE_SUBDIRS = NO 51 | 52 | # The OUTPUT_LANGUAGE tag is used to specify the language in which all 53 | # documentation generated by doxygen is written. Doxygen will use this 54 | # information to generate all constant output in the proper language. 55 | # The default language is English, other supported languages are: 56 | # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, 57 | # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, 58 | # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English 59 | # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, 60 | # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, 61 | # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. 62 | 63 | OUTPUT_LANGUAGE = English 64 | 65 | # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 66 | # include brief member descriptions after the members that are listed in 67 | # the file and class documentation (similar to JavaDoc). 68 | # Set to NO to disable this. 69 | 70 | BRIEF_MEMBER_DESC = YES 71 | 72 | # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 73 | # the brief description of a member or function before the detailed description. 74 | # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 75 | # brief descriptions will be completely suppressed. 76 | 77 | REPEAT_BRIEF = YES 78 | 79 | # This tag implements a quasi-intelligent brief description abbreviator 80 | # that is used to form the text in various listings. Each string 81 | # in this list, if found as the leading text of the brief description, will be 82 | # stripped from the text and the result after processing the whole list, is 83 | # used as the annotated text. Otherwise, the brief description is used as-is. 84 | # If left blank, the following values are used ("$name" is automatically 85 | # replaced with the name of the entity): "The $name class" "The $name widget" 86 | # "The $name file" "is" "provides" "specifies" "contains" 87 | # "represents" "a" "an" "the" 88 | 89 | ABBREVIATE_BRIEF = 90 | 91 | # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 92 | # Doxygen will generate a detailed section even if there is only a brief 93 | # description. 94 | 95 | ALWAYS_DETAILED_SEC = NO 96 | 97 | # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all 98 | # inherited members of a class in the documentation of that class as if those 99 | # members were ordinary class members. Constructors, destructors and assignment 100 | # operators of the base classes will not be shown. 101 | 102 | INLINE_INHERITED_MEMB = NO 103 | 104 | # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 105 | # path before files name in the file list and in the header files. If set 106 | # to NO the shortest path that makes the file name unique will be used. 107 | 108 | FULL_PATH_NAMES = YES 109 | 110 | # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 111 | # can be used to strip a user-defined part of the path. Stripping is 112 | # only done if one of the specified strings matches the left-hand part of 113 | # the path. The tag can be used to show relative paths in the file list. 114 | # If left blank the directory from which doxygen is run is used as the 115 | # path to strip. 116 | 117 | STRIP_FROM_PATH = 118 | 119 | # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of 120 | # the path mentioned in the documentation of a class, which tells 121 | # the reader which header file to include in order to use a class. 122 | # If left blank only the name of the header file containing the class 123 | # definition is used. Otherwise one should specify the include paths that 124 | # are normally passed to the compiler using the -I flag. 125 | 126 | STRIP_FROM_INC_PATH = 127 | 128 | # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 129 | # (but less readable) file names. This can be useful is your file systems 130 | # doesn't support long names like on DOS, Mac, or CD-ROM. 131 | 132 | SHORT_NAMES = NO 133 | 134 | # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 135 | # will interpret the first line (until the first dot) of a JavaDoc-style 136 | # comment as the brief description. If set to NO, the JavaDoc 137 | # comments will behave just like regular Qt-style comments 138 | # (thus requiring an explicit @brief command for a brief description.) 139 | 140 | JAVADOC_AUTOBRIEF = NO 141 | 142 | # If the QT_AUTOBRIEF tag is set to YES then Doxygen will 143 | # interpret the first line (until the first dot) of a Qt-style 144 | # comment as the brief description. If set to NO, the comments 145 | # will behave just like regular Qt-style comments (thus requiring 146 | # an explicit \brief command for a brief description.) 147 | 148 | QT_AUTOBRIEF = NO 149 | 150 | # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen 151 | # treat a multi-line C++ special comment block (i.e. a block of //! or /// 152 | # comments) as a brief description. This used to be the default behaviour. 153 | # The new default is to treat a multi-line C++ comment block as a detailed 154 | # description. Set this tag to YES if you prefer the old behaviour instead. 155 | 156 | MULTILINE_CPP_IS_BRIEF = NO 157 | 158 | # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 159 | # member inherits the documentation from any documented member that it 160 | # re-implements. 161 | 162 | INHERIT_DOCS = YES 163 | 164 | # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce 165 | # a new page for each member. If set to NO, the documentation of a member will 166 | # be part of the file/class/namespace that contains it. 167 | 168 | SEPARATE_MEMBER_PAGES = NO 169 | 170 | # The TAB_SIZE tag can be used to set the number of spaces in a tab. 171 | # Doxygen uses this value to replace tabs by spaces in code fragments. 172 | 173 | TAB_SIZE = 8 174 | 175 | # This tag can be used to specify a number of aliases that acts 176 | # as commands in the documentation. An alias has the form "name=value". 177 | # For example adding "sideeffect=\par Side Effects:\n" will allow you to 178 | # put the command \sideeffect (or @sideeffect) in the documentation, which 179 | # will result in a user-defined paragraph with heading "Side Effects:". 180 | # You can put \n's in the value part of an alias to insert newlines. 181 | 182 | ALIASES = 183 | 184 | # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C 185 | # sources only. Doxygen will then generate output that is more tailored for C. 186 | # For instance, some of the names that are used will be different. The list 187 | # of all members will be omitted, etc. 188 | 189 | OPTIMIZE_OUTPUT_FOR_C = YES 190 | 191 | # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java 192 | # sources only. Doxygen will then generate output that is more tailored for 193 | # Java. For instance, namespaces will be presented as packages, qualified 194 | # scopes will look different, etc. 195 | 196 | OPTIMIZE_OUTPUT_JAVA = NO 197 | 198 | # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran 199 | # sources only. Doxygen will then generate output that is more tailored for 200 | # Fortran. 201 | 202 | OPTIMIZE_FOR_FORTRAN = NO 203 | 204 | # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL 205 | # sources. Doxygen will then generate output that is tailored for 206 | # VHDL. 207 | 208 | OPTIMIZE_OUTPUT_VHDL = NO 209 | 210 | # Doxygen selects the parser to use depending on the extension of the files it 211 | # parses. With this tag you can assign which parser to use for a given extension. 212 | # Doxygen has a built-in mapping, but you can override or extend it using this 213 | # tag. The format is ext=language, where ext is a file extension, and language 214 | # is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, 215 | # C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make 216 | # doxygen treat .inc files as Fortran files (default is PHP), and .f files as C 217 | # (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions 218 | # you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. 219 | 220 | EXTENSION_MAPPING = 221 | 222 | # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want 223 | # to include (a tag file for) the STL sources as input, then you should 224 | # set this tag to YES in order to let doxygen match functions declarations and 225 | # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. 226 | # func(std::string) {}). This also make the inheritance and collaboration 227 | # diagrams that involve STL classes more complete and accurate. 228 | 229 | BUILTIN_STL_SUPPORT = NO 230 | 231 | # If you use Microsoft's C++/CLI language, you should set this option to YES to 232 | # enable parsing support. 233 | 234 | CPP_CLI_SUPPORT = NO 235 | 236 | # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. 237 | # Doxygen will parse them like normal C++ but will assume all classes use public 238 | # instead of private inheritance when no explicit protection keyword is present. 239 | 240 | SIP_SUPPORT = NO 241 | 242 | # For Microsoft's IDL there are propget and propput attributes to indicate getter 243 | # and setter methods for a property. Setting this option to YES (the default) 244 | # will make doxygen to replace the get and set methods by a property in the 245 | # documentation. This will only work if the methods are indeed getting or 246 | # setting a simple type. If this is not the case, or you want to show the 247 | # methods anyway, you should set this option to NO. 248 | 249 | IDL_PROPERTY_SUPPORT = YES 250 | 251 | # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 252 | # tag is set to YES, then doxygen will reuse the documentation of the first 253 | # member in the group (if any) for the other members of the group. By default 254 | # all members of a group must be documented explicitly. 255 | 256 | DISTRIBUTE_GROUP_DOC = NO 257 | 258 | # Set the SUBGROUPING tag to YES (the default) to allow class member groups of 259 | # the same type (for instance a group of public functions) to be put as a 260 | # subgroup of that type (e.g. under the Public Functions section). Set it to 261 | # NO to prevent subgrouping. Alternatively, this can be done per class using 262 | # the \nosubgrouping command. 263 | 264 | SUBGROUPING = YES 265 | 266 | # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum 267 | # is documented as struct, union, or enum with the name of the typedef. So 268 | # typedef struct TypeS {} TypeT, will appear in the documentation as a struct 269 | # with name TypeT. When disabled the typedef will appear as a member of a file, 270 | # namespace, or class. And the struct will be named TypeS. This can typically 271 | # be useful for C code in case the coding convention dictates that all compound 272 | # types are typedef'ed and only the typedef is referenced, never the tag name. 273 | 274 | TYPEDEF_HIDES_STRUCT = NO 275 | 276 | # The SYMBOL_CACHE_SIZE determines the size of the internal cache use to 277 | # determine which symbols to keep in memory and which to flush to disk. 278 | # When the cache is full, less often used symbols will be written to disk. 279 | # For small to medium size projects (<1000 input files) the default value is 280 | # probably good enough. For larger projects a too small cache size can cause 281 | # doxygen to be busy swapping symbols to and from disk most of the time 282 | # causing a significant performance penality. 283 | # If the system has enough physical memory increasing the cache will improve the 284 | # performance by keeping more symbols in memory. Note that the value works on 285 | # a logarithmic scale so increasing the size by one will rougly double the 286 | # memory usage. The cache size is given by this formula: 287 | # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, 288 | # corresponding to a cache size of 2^16 = 65536 symbols 289 | 290 | SYMBOL_CACHE_SIZE = 0 291 | 292 | #--------------------------------------------------------------------------- 293 | # Build related configuration options 294 | #--------------------------------------------------------------------------- 295 | 296 | # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 297 | # documentation are documented, even if no documentation was available. 298 | # Private class members and static file members will be hidden unless 299 | # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES 300 | 301 | EXTRACT_ALL = NO 302 | 303 | # If the EXTRACT_PRIVATE tag is set to YES all private members of a class 304 | # will be included in the documentation. 305 | 306 | EXTRACT_PRIVATE = NO 307 | 308 | # If the EXTRACT_STATIC tag is set to YES all static members of a file 309 | # will be included in the documentation. 310 | 311 | EXTRACT_STATIC = NO 312 | 313 | # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 314 | # defined locally in source files will be included in the documentation. 315 | # If set to NO only classes defined in header files are included. 316 | 317 | EXTRACT_LOCAL_CLASSES = YES 318 | 319 | # This flag is only useful for Objective-C code. When set to YES local 320 | # methods, which are defined in the implementation section but not in 321 | # the interface are included in the documentation. 322 | # If set to NO (the default) only methods in the interface are included. 323 | 324 | EXTRACT_LOCAL_METHODS = NO 325 | 326 | # If this flag is set to YES, the members of anonymous namespaces will be 327 | # extracted and appear in the documentation as a namespace called 328 | # 'anonymous_namespace{file}', where file will be replaced with the base 329 | # name of the file that contains the anonymous namespace. By default 330 | # anonymous namespace are hidden. 331 | 332 | EXTRACT_ANON_NSPACES = NO 333 | 334 | # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 335 | # undocumented members of documented classes, files or namespaces. 336 | # If set to NO (the default) these members will be included in the 337 | # various overviews, but no documentation section is generated. 338 | # This option has no effect if EXTRACT_ALL is enabled. 339 | 340 | HIDE_UNDOC_MEMBERS = NO 341 | 342 | # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 343 | # undocumented classes that are normally visible in the class hierarchy. 344 | # If set to NO (the default) these classes will be included in the various 345 | # overviews. This option has no effect if EXTRACT_ALL is enabled. 346 | 347 | HIDE_UNDOC_CLASSES = NO 348 | 349 | # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all 350 | # friend (class|struct|union) declarations. 351 | # If set to NO (the default) these declarations will be included in the 352 | # documentation. 353 | 354 | HIDE_FRIEND_COMPOUNDS = NO 355 | 356 | # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any 357 | # documentation blocks found inside the body of a function. 358 | # If set to NO (the default) these blocks will be appended to the 359 | # function's detailed documentation block. 360 | 361 | HIDE_IN_BODY_DOCS = NO 362 | 363 | # The INTERNAL_DOCS tag determines if documentation 364 | # that is typed after a \internal command is included. If the tag is set 365 | # to NO (the default) then the documentation will be excluded. 366 | # Set it to YES to include the internal documentation. 367 | 368 | INTERNAL_DOCS = NO 369 | 370 | # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 371 | # file names in lower-case letters. If set to YES upper-case letters are also 372 | # allowed. This is useful if you have classes or files whose names only differ 373 | # in case and if your file system supports case sensitive file names. Windows 374 | # and Mac users are advised to set this option to NO. 375 | 376 | CASE_SENSE_NAMES = YES 377 | 378 | # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 379 | # will show members with their full class and namespace scopes in the 380 | # documentation. If set to YES the scope will be hidden. 381 | 382 | HIDE_SCOPE_NAMES = NO 383 | 384 | # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 385 | # will put a list of the files that are included by a file in the documentation 386 | # of that file. 387 | 388 | SHOW_INCLUDE_FILES = YES 389 | 390 | # If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen 391 | # will list include files with double quotes in the documentation 392 | # rather than with sharp brackets. 393 | 394 | FORCE_LOCAL_INCLUDES = NO 395 | 396 | # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 397 | # is inserted in the documentation for inline members. 398 | 399 | INLINE_INFO = YES 400 | 401 | # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 402 | # will sort the (detailed) documentation of file and class members 403 | # alphabetically by member name. If set to NO the members will appear in 404 | # declaration order. 405 | 406 | SORT_MEMBER_DOCS = YES 407 | 408 | # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the 409 | # brief documentation of file, namespace and class members alphabetically 410 | # by member name. If set to NO (the default) the members will appear in 411 | # declaration order. 412 | 413 | SORT_BRIEF_DOCS = NO 414 | 415 | # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen 416 | # will sort the (brief and detailed) documentation of class members so that 417 | # constructors and destructors are listed first. If set to NO (the default) 418 | # the constructors will appear in the respective orders defined by 419 | # SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. 420 | # This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO 421 | # and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. 422 | 423 | SORT_MEMBERS_CTORS_1ST = NO 424 | 425 | # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the 426 | # hierarchy of group names into alphabetical order. If set to NO (the default) 427 | # the group names will appear in their defined order. 428 | 429 | SORT_GROUP_NAMES = NO 430 | 431 | # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be 432 | # sorted by fully-qualified names, including namespaces. If set to 433 | # NO (the default), the class list will be sorted only by class name, 434 | # not including the namespace part. 435 | # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. 436 | # Note: This option applies only to the class list, not to the 437 | # alphabetical list. 438 | 439 | SORT_BY_SCOPE_NAME = NO 440 | 441 | # The GENERATE_TODOLIST tag can be used to enable (YES) or 442 | # disable (NO) the todo list. This list is created by putting \todo 443 | # commands in the documentation. 444 | 445 | GENERATE_TODOLIST = YES 446 | 447 | # The GENERATE_TESTLIST tag can be used to enable (YES) or 448 | # disable (NO) the test list. This list is created by putting \test 449 | # commands in the documentation. 450 | 451 | GENERATE_TESTLIST = YES 452 | 453 | # The GENERATE_BUGLIST tag can be used to enable (YES) or 454 | # disable (NO) the bug list. This list is created by putting \bug 455 | # commands in the documentation. 456 | 457 | GENERATE_BUGLIST = YES 458 | 459 | # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or 460 | # disable (NO) the deprecated list. This list is created by putting 461 | # \deprecated commands in the documentation. 462 | 463 | GENERATE_DEPRECATEDLIST= YES 464 | 465 | # The ENABLED_SECTIONS tag can be used to enable conditional 466 | # documentation sections, marked by \if sectionname ... \endif. 467 | 468 | ENABLED_SECTIONS = 469 | 470 | # The MAX_INITIALIZER_LINES tag determines the maximum number of lines 471 | # the initial value of a variable or define consists of for it to appear in 472 | # the documentation. If the initializer consists of more lines than specified 473 | # here it will be hidden. Use a value of 0 to hide initializers completely. 474 | # The appearance of the initializer of individual variables and defines in the 475 | # documentation can be controlled using \showinitializer or \hideinitializer 476 | # command in the documentation regardless of this setting. 477 | 478 | MAX_INITIALIZER_LINES = 30 479 | 480 | # Set the SHOW_USED_FILES tag to NO to disable the list of files generated 481 | # at the bottom of the documentation of classes and structs. If set to YES the 482 | # list will mention the files that were used to generate the documentation. 483 | 484 | SHOW_USED_FILES = YES 485 | 486 | # If the sources in your project are distributed over multiple directories 487 | # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy 488 | # in the documentation. The default is NO. 489 | 490 | SHOW_DIRECTORIES = NO 491 | 492 | # Set the SHOW_FILES tag to NO to disable the generation of the Files page. 493 | # This will remove the Files entry from the Quick Index and from the 494 | # Folder Tree View (if specified). The default is YES. 495 | 496 | SHOW_FILES = YES 497 | 498 | # Set the SHOW_NAMESPACES tag to NO to disable the generation of the 499 | # Namespaces page. 500 | # This will remove the Namespaces entry from the Quick Index 501 | # and from the Folder Tree View (if specified). The default is YES. 502 | 503 | SHOW_NAMESPACES = YES 504 | 505 | # The FILE_VERSION_FILTER tag can be used to specify a program or script that 506 | # doxygen should invoke to get the current version for each file (typically from 507 | # the version control system). Doxygen will invoke the program by executing (via 508 | # popen()) the command , where is the value of 509 | # the FILE_VERSION_FILTER tag, and is the name of an input file 510 | # provided by doxygen. Whatever the program writes to standard output 511 | # is used as the file version. See the manual for examples. 512 | 513 | FILE_VERSION_FILTER = 514 | 515 | # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed 516 | # by doxygen. The layout file controls the global structure of the generated 517 | # output files in an output format independent way. The create the layout file 518 | # that represents doxygen's defaults, run doxygen with the -l option. 519 | # You can optionally specify a file name after the option, if omitted 520 | # DoxygenLayout.xml will be used as the name of the layout file. 521 | 522 | LAYOUT_FILE = 523 | 524 | #--------------------------------------------------------------------------- 525 | # configuration options related to warning and progress messages 526 | #--------------------------------------------------------------------------- 527 | 528 | # The QUIET tag can be used to turn on/off the messages that are generated 529 | # by doxygen. Possible values are YES and NO. If left blank NO is used. 530 | 531 | QUIET = NO 532 | 533 | # The WARNINGS tag can be used to turn on/off the warning messages that are 534 | # generated by doxygen. Possible values are YES and NO. If left blank 535 | # NO is used. 536 | 537 | WARNINGS = YES 538 | 539 | # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 540 | # for undocumented members. If EXTRACT_ALL is set to YES then this flag will 541 | # automatically be disabled. 542 | 543 | WARN_IF_UNDOCUMENTED = YES 544 | 545 | # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for 546 | # potential errors in the documentation, such as not documenting some 547 | # parameters in a documented function, or documenting parameters that 548 | # don't exist or using markup commands wrongly. 549 | 550 | WARN_IF_DOC_ERROR = YES 551 | 552 | # This WARN_NO_PARAMDOC option can be abled to get warnings for 553 | # functions that are documented, but have no documentation for their parameters 554 | # or return value. If set to NO (the default) doxygen will only warn about 555 | # wrong or incomplete parameter documentation, but not about the absence of 556 | # documentation. 557 | 558 | WARN_NO_PARAMDOC = NO 559 | 560 | # The WARN_FORMAT tag determines the format of the warning messages that 561 | # doxygen can produce. The string should contain the $file, $line, and $text 562 | # tags, which will be replaced by the file and line number from which the 563 | # warning originated and the warning text. Optionally the format may contain 564 | # $version, which will be replaced by the version of the file (if it could 565 | # be obtained via FILE_VERSION_FILTER) 566 | 567 | WARN_FORMAT = "$file:$line: $text" 568 | 569 | # The WARN_LOGFILE tag can be used to specify a file to which warning 570 | # and error messages should be written. If left blank the output is written 571 | # to stderr. 572 | 573 | WARN_LOGFILE = 574 | 575 | #--------------------------------------------------------------------------- 576 | # configuration options related to the input files 577 | #--------------------------------------------------------------------------- 578 | 579 | # The INPUT tag can be used to specify the files and/or directories that contain 580 | # documented source files. You may enter file names like "myfile.cpp" or 581 | # directories like "/usr/src/myproject". Separate the files or directories 582 | # with spaces. 583 | 584 | INPUT = glib2d.h 585 | 586 | # This tag can be used to specify the character encoding of the source files 587 | # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is 588 | # also the default input encoding. Doxygen uses libiconv (or the iconv built 589 | # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for 590 | # the list of possible encodings. 591 | 592 | INPUT_ENCODING = UTF-8 593 | 594 | # If the value of the INPUT tag contains directories, you can use the 595 | # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 596 | # and *.h) to filter out the source-files in the directories. If left 597 | # blank the following patterns are tested: 598 | # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx 599 | # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 600 | 601 | FILE_PATTERNS = 602 | 603 | # The RECURSIVE tag can be used to turn specify whether or not subdirectories 604 | # should be searched for input files as well. Possible values are YES and NO. 605 | # If left blank NO is used. 606 | 607 | RECURSIVE = NO 608 | 609 | # The EXCLUDE tag can be used to specify files and/or directories that should 610 | # excluded from the INPUT source files. This way you can easily exclude a 611 | # subdirectory from a directory tree whose root is specified with the INPUT tag. 612 | 613 | EXCLUDE = 614 | 615 | # The EXCLUDE_SYMLINKS tag can be used select whether or not files or 616 | # directories that are symbolic links (a Unix filesystem feature) are excluded 617 | # from the input. 618 | 619 | EXCLUDE_SYMLINKS = NO 620 | 621 | # If the value of the INPUT tag contains directories, you can use the 622 | # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 623 | # certain files from those directories. Note that the wildcards are matched 624 | # against the file with absolute path, so to exclude all test directories 625 | # for example use the pattern */test/* 626 | 627 | EXCLUDE_PATTERNS = 628 | 629 | # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names 630 | # (namespaces, classes, functions, etc.) that should be excluded from the 631 | # output. The symbol name can be a fully qualified name, a word, or if the 632 | # wildcard * is used, a substring. Examples: ANamespace, AClass, 633 | # AClass::ANamespace, ANamespace::*Test 634 | 635 | EXCLUDE_SYMBOLS = 636 | 637 | # The EXAMPLE_PATH tag can be used to specify one or more files or 638 | # directories that contain example code fragments that are included (see 639 | # the \include command). 640 | 641 | EXAMPLE_PATH = 642 | 643 | # If the value of the EXAMPLE_PATH tag contains directories, you can use the 644 | # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 645 | # and *.h) to filter out the source-files in the directories. If left 646 | # blank all files are included. 647 | 648 | EXAMPLE_PATTERNS = 649 | 650 | # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 651 | # searched for input files to be used with the \include or \dontinclude 652 | # commands irrespective of the value of the RECURSIVE tag. 653 | # Possible values are YES and NO. If left blank NO is used. 654 | 655 | EXAMPLE_RECURSIVE = NO 656 | 657 | # The IMAGE_PATH tag can be used to specify one or more files or 658 | # directories that contain image that are included in the documentation (see 659 | # the \image command). 660 | 661 | IMAGE_PATH = 662 | 663 | # The INPUT_FILTER tag can be used to specify a program that doxygen should 664 | # invoke to filter for each input file. Doxygen will invoke the filter program 665 | # by executing (via popen()) the command , where 666 | # is the value of the INPUT_FILTER tag, and is the name of an 667 | # input file. Doxygen will then use the output that the filter program writes 668 | # to standard output. 669 | # If FILTER_PATTERNS is specified, this tag will be 670 | # ignored. 671 | 672 | INPUT_FILTER = 673 | 674 | # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern 675 | # basis. 676 | # Doxygen will compare the file name with each pattern and apply the 677 | # filter if there is a match. 678 | # The filters are a list of the form: 679 | # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further 680 | # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER 681 | # is applied to all files. 682 | 683 | FILTER_PATTERNS = 684 | 685 | # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 686 | # INPUT_FILTER) will be used to filter the input files when producing source 687 | # files to browse (i.e. when SOURCE_BROWSER is set to YES). 688 | 689 | FILTER_SOURCE_FILES = NO 690 | 691 | #--------------------------------------------------------------------------- 692 | # configuration options related to source browsing 693 | #--------------------------------------------------------------------------- 694 | 695 | # If the SOURCE_BROWSER tag is set to YES then a list of source files will 696 | # be generated. Documented entities will be cross-referenced with these sources. 697 | # Note: To get rid of all source code in the generated output, make sure also 698 | # VERBATIM_HEADERS is set to NO. 699 | 700 | SOURCE_BROWSER = NO 701 | 702 | # Setting the INLINE_SOURCES tag to YES will include the body 703 | # of functions and classes directly in the documentation. 704 | 705 | INLINE_SOURCES = NO 706 | 707 | # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 708 | # doxygen to hide any special comment blocks from generated source code 709 | # fragments. Normal C and C++ comments will always remain visible. 710 | 711 | STRIP_CODE_COMMENTS = YES 712 | 713 | # If the REFERENCED_BY_RELATION tag is set to YES 714 | # then for each documented function all documented 715 | # functions referencing it will be listed. 716 | 717 | REFERENCED_BY_RELATION = NO 718 | 719 | # If the REFERENCES_RELATION tag is set to YES 720 | # then for each documented function all documented entities 721 | # called/used by that function will be listed. 722 | 723 | REFERENCES_RELATION = NO 724 | 725 | # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) 726 | # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from 727 | # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will 728 | # link to the source code. 729 | # Otherwise they will link to the documentation. 730 | 731 | REFERENCES_LINK_SOURCE = YES 732 | 733 | # If the USE_HTAGS tag is set to YES then the references to source code 734 | # will point to the HTML generated by the htags(1) tool instead of doxygen 735 | # built-in source browser. The htags tool is part of GNU's global source 736 | # tagging system (see http://www.gnu.org/software/global/global.html). You 737 | # will need version 4.8.6 or higher. 738 | 739 | USE_HTAGS = NO 740 | 741 | # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 742 | # will generate a verbatim copy of the header file for each class for 743 | # which an include is specified. Set to NO to disable this. 744 | 745 | VERBATIM_HEADERS = YES 746 | 747 | #--------------------------------------------------------------------------- 748 | # configuration options related to the alphabetical class index 749 | #--------------------------------------------------------------------------- 750 | 751 | # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 752 | # of all compounds will be generated. Enable this if the project 753 | # contains a lot of classes, structs, unions or interfaces. 754 | 755 | ALPHABETICAL_INDEX = YES 756 | 757 | # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 758 | # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 759 | # in which this list will be split (can be a number in the range [1..20]) 760 | 761 | COLS_IN_ALPHA_INDEX = 5 762 | 763 | # In case all classes in a project start with a common prefix, all 764 | # classes will be put under the same header in the alphabetical index. 765 | # The IGNORE_PREFIX tag can be used to specify one or more prefixes that 766 | # should be ignored while generating the index headers. 767 | 768 | IGNORE_PREFIX = 769 | 770 | #--------------------------------------------------------------------------- 771 | # configuration options related to the HTML output 772 | #--------------------------------------------------------------------------- 773 | 774 | # If the GENERATE_HTML tag is set to YES (the default) Doxygen will 775 | # generate HTML output. 776 | 777 | GENERATE_HTML = YES 778 | 779 | # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 780 | # If a relative path is entered the value of OUTPUT_DIRECTORY will be 781 | # put in front of it. If left blank `html' will be used as the default path. 782 | 783 | HTML_OUTPUT = html 784 | 785 | # The HTML_FILE_EXTENSION tag can be used to specify the file extension for 786 | # each generated HTML page (for example: .htm,.php,.asp). If it is left blank 787 | # doxygen will generate files with .html extension. 788 | 789 | HTML_FILE_EXTENSION = .html 790 | 791 | # The HTML_HEADER tag can be used to specify a personal HTML header for 792 | # each generated HTML page. If it is left blank doxygen will generate a 793 | # standard header. 794 | 795 | HTML_HEADER = 796 | 797 | # The HTML_FOOTER tag can be used to specify a personal HTML footer for 798 | # each generated HTML page. If it is left blank doxygen will generate a 799 | # standard footer. 800 | 801 | HTML_FOOTER = 802 | 803 | # The HTML_STYLESHEET tag can be used to specify a user-defined cascading 804 | # style sheet that is used by each HTML page. It can be used to 805 | # fine-tune the look of the HTML output. If the tag is left blank doxygen 806 | # will generate a default style sheet. Note that doxygen will try to copy 807 | # the style sheet file to the HTML output directory, so don't put your own 808 | # stylesheet in the HTML output directory as well, or it will be erased! 809 | 810 | HTML_STYLESHEET = 811 | 812 | # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. 813 | # Doxygen will adjust the colors in the stylesheet and background images 814 | # according to this color. Hue is specified as an angle on a colorwheel, 815 | # see http://en.wikipedia.org/wiki/Hue for more information. 816 | # For instance the value 0 represents red, 60 is yellow, 120 is green, 817 | # 180 is cyan, 240 is blue, 300 purple, and 360 is red again. 818 | # The allowed range is 0 to 359. 819 | 820 | HTML_COLORSTYLE_HUE = 220 821 | 822 | # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of 823 | # the colors in the HTML output. For a value of 0 the output will use 824 | # grayscales only. A value of 255 will produce the most vivid colors. 825 | 826 | HTML_COLORSTYLE_SAT = 100 827 | 828 | # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to 829 | # the luminance component of the colors in the HTML output. Values below 830 | # 100 gradually make the output lighter, whereas values above 100 make 831 | # the output darker. The value divided by 100 is the actual gamma applied, 832 | # so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, 833 | # and 100 does not change the gamma. 834 | 835 | HTML_COLORSTYLE_GAMMA = 80 836 | 837 | # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML 838 | # page will contain the date and time when the page was generated. Setting 839 | # this to NO can help when comparing the output of multiple runs. 840 | 841 | HTML_TIMESTAMP = YES 842 | 843 | # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 844 | # files or namespaces will be aligned in HTML using tables. If set to 845 | # NO a bullet list will be used. 846 | 847 | HTML_ALIGN_MEMBERS = YES 848 | 849 | # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML 850 | # documentation will contain sections that can be hidden and shown after the 851 | # page has loaded. For this to work a browser that supports 852 | # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox 853 | # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). 854 | 855 | HTML_DYNAMIC_SECTIONS = NO 856 | 857 | # If the GENERATE_DOCSET tag is set to YES, additional index files 858 | # will be generated that can be used as input for Apple's Xcode 3 859 | # integrated development environment, introduced with OSX 10.5 (Leopard). 860 | # To create a documentation set, doxygen will generate a Makefile in the 861 | # HTML output directory. Running make will produce the docset in that 862 | # directory and running "make install" will install the docset in 863 | # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find 864 | # it at startup. 865 | # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html 866 | # for more information. 867 | 868 | GENERATE_DOCSET = NO 869 | 870 | # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the 871 | # feed. A documentation feed provides an umbrella under which multiple 872 | # documentation sets from a single provider (such as a company or product suite) 873 | # can be grouped. 874 | 875 | DOCSET_FEEDNAME = "Doxygen generated docs" 876 | 877 | # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that 878 | # should uniquely identify the documentation set bundle. This should be a 879 | # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen 880 | # will append .docset to the name. 881 | 882 | DOCSET_BUNDLE_ID = org.doxygen.Project 883 | 884 | # When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify 885 | # the documentation publisher. This should be a reverse domain-name style 886 | # string, e.g. com.mycompany.MyDocSet.documentation. 887 | 888 | DOCSET_PUBLISHER_ID = org.doxygen.Publisher 889 | 890 | # The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. 891 | 892 | DOCSET_PUBLISHER_NAME = Publisher 893 | 894 | # If the GENERATE_HTMLHELP tag is set to YES, additional index files 895 | # will be generated that can be used as input for tools like the 896 | # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) 897 | # of the generated HTML documentation. 898 | 899 | GENERATE_HTMLHELP = NO 900 | 901 | # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can 902 | # be used to specify the file name of the resulting .chm file. You 903 | # can add a path in front of the file if the result should not be 904 | # written to the html output directory. 905 | 906 | CHM_FILE = 907 | 908 | # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can 909 | # be used to specify the location (absolute path including file name) of 910 | # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run 911 | # the HTML help compiler on the generated index.hhp. 912 | 913 | HHC_LOCATION = 914 | 915 | # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 916 | # controls if a separate .chi index file is generated (YES) or that 917 | # it should be included in the master .chm file (NO). 918 | 919 | GENERATE_CHI = NO 920 | 921 | # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING 922 | # is used to encode HtmlHelp index (hhk), content (hhc) and project file 923 | # content. 924 | 925 | CHM_INDEX_ENCODING = 926 | 927 | # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 928 | # controls whether a binary table of contents is generated (YES) or a 929 | # normal table of contents (NO) in the .chm file. 930 | 931 | BINARY_TOC = NO 932 | 933 | # The TOC_EXPAND flag can be set to YES to add extra items for group members 934 | # to the contents of the HTML help documentation and to the tree view. 935 | 936 | TOC_EXPAND = NO 937 | 938 | # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and 939 | # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated 940 | # that can be used as input for Qt's qhelpgenerator to generate a 941 | # Qt Compressed Help (.qch) of the generated HTML documentation. 942 | 943 | GENERATE_QHP = NO 944 | 945 | # If the QHG_LOCATION tag is specified, the QCH_FILE tag can 946 | # be used to specify the file name of the resulting .qch file. 947 | # The path specified is relative to the HTML output folder. 948 | 949 | QCH_FILE = 950 | 951 | # The QHP_NAMESPACE tag specifies the namespace to use when generating 952 | # Qt Help Project output. For more information please see 953 | # http://doc.trolltech.com/qthelpproject.html#namespace 954 | 955 | QHP_NAMESPACE = org.doxygen.Project 956 | 957 | # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating 958 | # Qt Help Project output. For more information please see 959 | # http://doc.trolltech.com/qthelpproject.html#virtual-folders 960 | 961 | QHP_VIRTUAL_FOLDER = doc 962 | 963 | # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to 964 | # add. For more information please see 965 | # http://doc.trolltech.com/qthelpproject.html#custom-filters 966 | 967 | QHP_CUST_FILTER_NAME = 968 | 969 | # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the 970 | # custom filter to add. For more information please see 971 | # 972 | # Qt Help Project / Custom Filters. 973 | 974 | QHP_CUST_FILTER_ATTRS = 975 | 976 | # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this 977 | # project's 978 | # filter section matches. 979 | # 980 | # Qt Help Project / Filter Attributes. 981 | 982 | QHP_SECT_FILTER_ATTRS = 983 | 984 | # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can 985 | # be used to specify the location of Qt's qhelpgenerator. 986 | # If non-empty doxygen will try to run qhelpgenerator on the generated 987 | # .qhp file. 988 | 989 | QHG_LOCATION = 990 | 991 | # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files 992 | # will be generated, which together with the HTML files, form an Eclipse help 993 | # plugin. To install this plugin and make it available under the help contents 994 | # menu in Eclipse, the contents of the directory containing the HTML and XML 995 | # files needs to be copied into the plugins directory of eclipse. The name of 996 | # the directory within the plugins directory should be the same as 997 | # the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before 998 | # the help appears. 999 | 1000 | GENERATE_ECLIPSEHELP = NO 1001 | 1002 | # A unique identifier for the eclipse help plugin. When installing the plugin 1003 | # the directory name containing the HTML and XML files should also have 1004 | # this name. 1005 | 1006 | ECLIPSE_DOC_ID = org.doxygen.Project 1007 | 1008 | # The DISABLE_INDEX tag can be used to turn on/off the condensed index at 1009 | # top of each HTML page. The value NO (the default) enables the index and 1010 | # the value YES disables it. 1011 | 1012 | DISABLE_INDEX = NO 1013 | 1014 | # This tag can be used to set the number of enum values (range [1..20]) 1015 | # that doxygen will group on one line in the generated HTML documentation. 1016 | 1017 | ENUM_VALUES_PER_LINE = 4 1018 | 1019 | # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index 1020 | # structure should be generated to display hierarchical information. 1021 | # If the tag value is set to YES, a side panel will be generated 1022 | # containing a tree-like index structure (just like the one that 1023 | # is generated for HTML Help). For this to work a browser that supports 1024 | # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). 1025 | # Windows users are probably better off using the HTML help feature. 1026 | 1027 | GENERATE_TREEVIEW = NO 1028 | 1029 | # By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, 1030 | # and Class Hierarchy pages using a tree view instead of an ordered list. 1031 | 1032 | USE_INLINE_TREES = NO 1033 | 1034 | # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 1035 | # used to set the initial width (in pixels) of the frame in which the tree 1036 | # is shown. 1037 | 1038 | TREEVIEW_WIDTH = 250 1039 | 1040 | # When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open 1041 | # links to external symbols imported via tag files in a separate window. 1042 | 1043 | EXT_LINKS_IN_WINDOW = NO 1044 | 1045 | # Use this tag to change the font size of Latex formulas included 1046 | # as images in the HTML documentation. The default is 10. Note that 1047 | # when you change the font size after a successful doxygen run you need 1048 | # to manually remove any form_*.png images from the HTML output directory 1049 | # to force them to be regenerated. 1050 | 1051 | FORMULA_FONTSIZE = 10 1052 | 1053 | # Use the FORMULA_TRANPARENT tag to determine whether or not the images 1054 | # generated for formulas are transparent PNGs. Transparent PNGs are 1055 | # not supported properly for IE 6.0, but are supported on all modern browsers. 1056 | # Note that when changing this option you need to delete any form_*.png files 1057 | # in the HTML output before the changes have effect. 1058 | 1059 | FORMULA_TRANSPARENT = YES 1060 | 1061 | # When the SEARCHENGINE tag is enabled doxygen will generate a search box 1062 | # for the HTML output. The underlying search engine uses javascript 1063 | # and DHTML and should work on any modern browser. Note that when using 1064 | # HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets 1065 | # (GENERATE_DOCSET) there is already a search function so this one should 1066 | # typically be disabled. For large projects the javascript based search engine 1067 | # can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. 1068 | 1069 | SEARCHENGINE = YES 1070 | 1071 | # When the SERVER_BASED_SEARCH tag is enabled the search engine will be 1072 | # implemented using a PHP enabled web server instead of at the web client 1073 | # using Javascript. Doxygen will generate the search PHP script and index 1074 | # file to put on the web server. The advantage of the server 1075 | # based approach is that it scales better to large projects and allows 1076 | # full text search. The disadvances is that it is more difficult to setup 1077 | # and does not have live searching capabilities. 1078 | 1079 | SERVER_BASED_SEARCH = NO 1080 | 1081 | #--------------------------------------------------------------------------- 1082 | # configuration options related to the LaTeX output 1083 | #--------------------------------------------------------------------------- 1084 | 1085 | # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 1086 | # generate Latex output. 1087 | 1088 | GENERATE_LATEX = YES 1089 | 1090 | # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 1091 | # If a relative path is entered the value of OUTPUT_DIRECTORY will be 1092 | # put in front of it. If left blank `latex' will be used as the default path. 1093 | 1094 | LATEX_OUTPUT = latex 1095 | 1096 | # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be 1097 | # invoked. If left blank `latex' will be used as the default command name. 1098 | # Note that when enabling USE_PDFLATEX this option is only used for 1099 | # generating bitmaps for formulas in the HTML output, but not in the 1100 | # Makefile that is written to the output directory. 1101 | 1102 | LATEX_CMD_NAME = latex 1103 | 1104 | # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to 1105 | # generate index for LaTeX. If left blank `makeindex' will be used as the 1106 | # default command name. 1107 | 1108 | MAKEINDEX_CMD_NAME = makeindex 1109 | 1110 | # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 1111 | # LaTeX documents. This may be useful for small projects and may help to 1112 | # save some trees in general. 1113 | 1114 | COMPACT_LATEX = NO 1115 | 1116 | # The PAPER_TYPE tag can be used to set the paper type that is used 1117 | # by the printer. Possible values are: a4, a4wide, letter, legal and 1118 | # executive. If left blank a4wide will be used. 1119 | 1120 | PAPER_TYPE = a4wide 1121 | 1122 | # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 1123 | # packages that should be included in the LaTeX output. 1124 | 1125 | EXTRA_PACKAGES = 1126 | 1127 | # The LATEX_HEADER tag can be used to specify a personal LaTeX header for 1128 | # the generated latex document. The header should contain everything until 1129 | # the first chapter. If it is left blank doxygen will generate a 1130 | # standard header. Notice: only use this tag if you know what you are doing! 1131 | 1132 | LATEX_HEADER = 1133 | 1134 | # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 1135 | # is prepared for conversion to pdf (using ps2pdf). The pdf file will 1136 | # contain links (just like the HTML output) instead of page references 1137 | # This makes the output suitable for online browsing using a pdf viewer. 1138 | 1139 | PDF_HYPERLINKS = YES 1140 | 1141 | # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 1142 | # plain latex in the generated Makefile. Set this option to YES to get a 1143 | # higher quality PDF documentation. 1144 | 1145 | USE_PDFLATEX = YES 1146 | 1147 | # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 1148 | # command to the generated LaTeX files. This will instruct LaTeX to keep 1149 | # running if errors occur, instead of asking the user for help. 1150 | # This option is also used when generating formulas in HTML. 1151 | 1152 | LATEX_BATCHMODE = NO 1153 | 1154 | # If LATEX_HIDE_INDICES is set to YES then doxygen will not 1155 | # include the index chapters (such as File Index, Compound Index, etc.) 1156 | # in the output. 1157 | 1158 | LATEX_HIDE_INDICES = NO 1159 | 1160 | # If LATEX_SOURCE_CODE is set to YES then doxygen will include 1161 | # source code with syntax highlighting in the LaTeX output. 1162 | # Note that which sources are shown also depends on other settings 1163 | # such as SOURCE_BROWSER. 1164 | 1165 | LATEX_SOURCE_CODE = NO 1166 | 1167 | #--------------------------------------------------------------------------- 1168 | # configuration options related to the RTF output 1169 | #--------------------------------------------------------------------------- 1170 | 1171 | # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 1172 | # The RTF output is optimized for Word 97 and may not look very pretty with 1173 | # other RTF readers or editors. 1174 | 1175 | GENERATE_RTF = NO 1176 | 1177 | # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 1178 | # If a relative path is entered the value of OUTPUT_DIRECTORY will be 1179 | # put in front of it. If left blank `rtf' will be used as the default path. 1180 | 1181 | RTF_OUTPUT = rtf 1182 | 1183 | # If the COMPACT_RTF tag is set to YES Doxygen generates more compact 1184 | # RTF documents. This may be useful for small projects and may help to 1185 | # save some trees in general. 1186 | 1187 | COMPACT_RTF = NO 1188 | 1189 | # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 1190 | # will contain hyperlink fields. The RTF file will 1191 | # contain links (just like the HTML output) instead of page references. 1192 | # This makes the output suitable for online browsing using WORD or other 1193 | # programs which support those fields. 1194 | # Note: wordpad (write) and others do not support links. 1195 | 1196 | RTF_HYPERLINKS = NO 1197 | 1198 | # Load stylesheet definitions from file. Syntax is similar to doxygen's 1199 | # config file, i.e. a series of assignments. You only have to provide 1200 | # replacements, missing definitions are set to their default value. 1201 | 1202 | RTF_STYLESHEET_FILE = 1203 | 1204 | # Set optional variables used in the generation of an rtf document. 1205 | # Syntax is similar to doxygen's config file. 1206 | 1207 | RTF_EXTENSIONS_FILE = 1208 | 1209 | #--------------------------------------------------------------------------- 1210 | # configuration options related to the man page output 1211 | #--------------------------------------------------------------------------- 1212 | 1213 | # If the GENERATE_MAN tag is set to YES (the default) Doxygen will 1214 | # generate man pages 1215 | 1216 | GENERATE_MAN = NO 1217 | 1218 | # The MAN_OUTPUT tag is used to specify where the man pages will be put. 1219 | # If a relative path is entered the value of OUTPUT_DIRECTORY will be 1220 | # put in front of it. If left blank `man' will be used as the default path. 1221 | 1222 | MAN_OUTPUT = man 1223 | 1224 | # The MAN_EXTENSION tag determines the extension that is added to 1225 | # the generated man pages (default is the subroutine's section .3) 1226 | 1227 | MAN_EXTENSION = .3 1228 | 1229 | # If the MAN_LINKS tag is set to YES and Doxygen generates man output, 1230 | # then it will generate one additional man file for each entity 1231 | # documented in the real man page(s). These additional files 1232 | # only source the real man page, but without them the man command 1233 | # would be unable to find the correct page. The default is NO. 1234 | 1235 | MAN_LINKS = NO 1236 | 1237 | #--------------------------------------------------------------------------- 1238 | # configuration options related to the XML output 1239 | #--------------------------------------------------------------------------- 1240 | 1241 | # If the GENERATE_XML tag is set to YES Doxygen will 1242 | # generate an XML file that captures the structure of 1243 | # the code including all documentation. 1244 | 1245 | GENERATE_XML = NO 1246 | 1247 | # The XML_OUTPUT tag is used to specify where the XML pages will be put. 1248 | # If a relative path is entered the value of OUTPUT_DIRECTORY will be 1249 | # put in front of it. If left blank `xml' will be used as the default path. 1250 | 1251 | XML_OUTPUT = xml 1252 | 1253 | # The XML_SCHEMA tag can be used to specify an XML schema, 1254 | # which can be used by a validating XML parser to check the 1255 | # syntax of the XML files. 1256 | 1257 | XML_SCHEMA = 1258 | 1259 | # The XML_DTD tag can be used to specify an XML DTD, 1260 | # which can be used by a validating XML parser to check the 1261 | # syntax of the XML files. 1262 | 1263 | XML_DTD = 1264 | 1265 | # If the XML_PROGRAMLISTING tag is set to YES Doxygen will 1266 | # dump the program listings (including syntax highlighting 1267 | # and cross-referencing information) to the XML output. Note that 1268 | # enabling this will significantly increase the size of the XML output. 1269 | 1270 | XML_PROGRAMLISTING = YES 1271 | 1272 | #--------------------------------------------------------------------------- 1273 | # configuration options for the AutoGen Definitions output 1274 | #--------------------------------------------------------------------------- 1275 | 1276 | # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will 1277 | # generate an AutoGen Definitions (see autogen.sf.net) file 1278 | # that captures the structure of the code including all 1279 | # documentation. Note that this feature is still experimental 1280 | # and incomplete at the moment. 1281 | 1282 | GENERATE_AUTOGEN_DEF = NO 1283 | 1284 | #--------------------------------------------------------------------------- 1285 | # configuration options related to the Perl module output 1286 | #--------------------------------------------------------------------------- 1287 | 1288 | # If the GENERATE_PERLMOD tag is set to YES Doxygen will 1289 | # generate a Perl module file that captures the structure of 1290 | # the code including all documentation. Note that this 1291 | # feature is still experimental and incomplete at the 1292 | # moment. 1293 | 1294 | GENERATE_PERLMOD = NO 1295 | 1296 | # If the PERLMOD_LATEX tag is set to YES Doxygen will generate 1297 | # the necessary Makefile rules, Perl scripts and LaTeX code to be able 1298 | # to generate PDF and DVI output from the Perl module output. 1299 | 1300 | PERLMOD_LATEX = NO 1301 | 1302 | # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be 1303 | # nicely formatted so it can be parsed by a human reader. 1304 | # This is useful 1305 | # if you want to understand what is going on. 1306 | # On the other hand, if this 1307 | # tag is set to NO the size of the Perl module output will be much smaller 1308 | # and Perl will parse it just the same. 1309 | 1310 | PERLMOD_PRETTY = YES 1311 | 1312 | # The names of the make variables in the generated doxyrules.make file 1313 | # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. 1314 | # This is useful so different doxyrules.make files included by the same 1315 | # Makefile don't overwrite each other's variables. 1316 | 1317 | PERLMOD_MAKEVAR_PREFIX = 1318 | 1319 | #--------------------------------------------------------------------------- 1320 | # Configuration options related to the preprocessor 1321 | #--------------------------------------------------------------------------- 1322 | 1323 | # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 1324 | # evaluate all C-preprocessor directives found in the sources and include 1325 | # files. 1326 | 1327 | ENABLE_PREPROCESSING = YES 1328 | 1329 | # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 1330 | # names in the source code. If set to NO (the default) only conditional 1331 | # compilation will be performed. Macro expansion can be done in a controlled 1332 | # way by setting EXPAND_ONLY_PREDEF to YES. 1333 | 1334 | MACRO_EXPANSION = NO 1335 | 1336 | # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 1337 | # then the macro expansion is limited to the macros specified with the 1338 | # PREDEFINED and EXPAND_AS_DEFINED tags. 1339 | 1340 | EXPAND_ONLY_PREDEF = NO 1341 | 1342 | # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 1343 | # in the INCLUDE_PATH (see below) will be search if a #include is found. 1344 | 1345 | SEARCH_INCLUDES = YES 1346 | 1347 | # The INCLUDE_PATH tag can be used to specify one or more directories that 1348 | # contain include files that are not input files but should be processed by 1349 | # the preprocessor. 1350 | 1351 | INCLUDE_PATH = 1352 | 1353 | # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 1354 | # patterns (like *.h and *.hpp) to filter out the header-files in the 1355 | # directories. If left blank, the patterns specified with FILE_PATTERNS will 1356 | # be used. 1357 | 1358 | INCLUDE_FILE_PATTERNS = 1359 | 1360 | # The PREDEFINED tag can be used to specify one or more macro names that 1361 | # are defined before the preprocessor is started (similar to the -D option of 1362 | # gcc). The argument of the tag is a list of macros of the form: name 1363 | # or name=definition (no spaces). If the definition and the = are 1364 | # omitted =1 is assumed. To prevent a macro definition from being 1365 | # undefined via #undef or recursively expanded use the := operator 1366 | # instead of the = operator. 1367 | 1368 | PREDEFINED = 1369 | 1370 | # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then 1371 | # this tag can be used to specify a list of macro names that should be expanded. 1372 | # The macro definition that is found in the sources will be used. 1373 | # Use the PREDEFINED tag if you want to use a different macro definition. 1374 | 1375 | EXPAND_AS_DEFINED = 1376 | 1377 | # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 1378 | # doxygen's preprocessor will remove all function-like macros that are alone 1379 | # on a line, have an all uppercase name, and do not end with a semicolon. Such 1380 | # function macros are typically used for boiler-plate code, and will confuse 1381 | # the parser if not removed. 1382 | 1383 | SKIP_FUNCTION_MACROS = YES 1384 | 1385 | #--------------------------------------------------------------------------- 1386 | # Configuration::additions related to external references 1387 | #--------------------------------------------------------------------------- 1388 | 1389 | # The TAGFILES option can be used to specify one or more tagfiles. 1390 | # Optionally an initial location of the external documentation 1391 | # can be added for each tagfile. The format of a tag file without 1392 | # this location is as follows: 1393 | # 1394 | # TAGFILES = file1 file2 ... 1395 | # Adding location for the tag files is done as follows: 1396 | # 1397 | # TAGFILES = file1=loc1 "file2 = loc2" ... 1398 | # where "loc1" and "loc2" can be relative or absolute paths or 1399 | # URLs. If a location is present for each tag, the installdox tool 1400 | # does not have to be run to correct the links. 1401 | # Note that each tag file must have a unique name 1402 | # (where the name does NOT include the path) 1403 | # If a tag file is not located in the directory in which doxygen 1404 | # is run, you must also specify the path to the tagfile here. 1405 | 1406 | TAGFILES = 1407 | 1408 | # When a file name is specified after GENERATE_TAGFILE, doxygen will create 1409 | # a tag file that is based on the input files it reads. 1410 | 1411 | GENERATE_TAGFILE = 1412 | 1413 | # If the ALLEXTERNALS tag is set to YES all external classes will be listed 1414 | # in the class index. If set to NO only the inherited external classes 1415 | # will be listed. 1416 | 1417 | ALLEXTERNALS = NO 1418 | 1419 | # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed 1420 | # in the modules index. If set to NO, only the current project's groups will 1421 | # be listed. 1422 | 1423 | EXTERNAL_GROUPS = YES 1424 | 1425 | # The PERL_PATH should be the absolute path and name of the perl script 1426 | # interpreter (i.e. the result of `which perl'). 1427 | 1428 | PERL_PATH = /usr/bin/perl 1429 | 1430 | #--------------------------------------------------------------------------- 1431 | # Configuration options related to the dot tool 1432 | #--------------------------------------------------------------------------- 1433 | 1434 | # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 1435 | # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base 1436 | # or super classes. Setting the tag to NO turns the diagrams off. Note that 1437 | # this option is superseded by the HAVE_DOT option below. This is only a 1438 | # fallback. It is recommended to install and use dot, since it yields more 1439 | # powerful graphs. 1440 | 1441 | CLASS_DIAGRAMS = YES 1442 | 1443 | # You can define message sequence charts within doxygen comments using the \msc 1444 | # command. Doxygen will then run the mscgen tool (see 1445 | # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the 1446 | # documentation. The MSCGEN_PATH tag allows you to specify the directory where 1447 | # the mscgen tool resides. If left empty the tool is assumed to be found in the 1448 | # default search path. 1449 | 1450 | MSCGEN_PATH = 1451 | 1452 | # If set to YES, the inheritance and collaboration graphs will hide 1453 | # inheritance and usage relations if the target is undocumented 1454 | # or is not a class. 1455 | 1456 | HIDE_UNDOC_RELATIONS = YES 1457 | 1458 | # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 1459 | # available from the path. This tool is part of Graphviz, a graph visualization 1460 | # toolkit from AT&T and Lucent Bell Labs. The other options in this section 1461 | # have no effect if this option is set to NO (the default) 1462 | 1463 | HAVE_DOT = NO 1464 | 1465 | # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is 1466 | # allowed to run in parallel. When set to 0 (the default) doxygen will 1467 | # base this on the number of processors available in the system. You can set it 1468 | # explicitly to a value larger than 0 to get control over the balance 1469 | # between CPU load and processing speed. 1470 | 1471 | DOT_NUM_THREADS = 0 1472 | 1473 | # By default doxygen will write a font called FreeSans.ttf to the output 1474 | # directory and reference it in all dot files that doxygen generates. This 1475 | # font does not include all possible unicode characters however, so when you need 1476 | # these (or just want a differently looking font) you can specify the font name 1477 | # using DOT_FONTNAME. You need need to make sure dot is able to find the font, 1478 | # which can be done by putting it in a standard location or by setting the 1479 | # DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory 1480 | # containing the font. 1481 | 1482 | DOT_FONTNAME = FreeSans.ttf 1483 | 1484 | # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. 1485 | # The default size is 10pt. 1486 | 1487 | DOT_FONTSIZE = 10 1488 | 1489 | # By default doxygen will tell dot to use the output directory to look for the 1490 | # FreeSans.ttf font (which doxygen will put there itself). If you specify a 1491 | # different font using DOT_FONTNAME you can set the path where dot 1492 | # can find it using this tag. 1493 | 1494 | DOT_FONTPATH = 1495 | 1496 | # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 1497 | # will generate a graph for each documented class showing the direct and 1498 | # indirect inheritance relations. Setting this tag to YES will force the 1499 | # the CLASS_DIAGRAMS tag to NO. 1500 | 1501 | CLASS_GRAPH = YES 1502 | 1503 | # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 1504 | # will generate a graph for each documented class showing the direct and 1505 | # indirect implementation dependencies (inheritance, containment, and 1506 | # class references variables) of the class with other documented classes. 1507 | 1508 | COLLABORATION_GRAPH = YES 1509 | 1510 | # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen 1511 | # will generate a graph for groups, showing the direct groups dependencies 1512 | 1513 | GROUP_GRAPHS = YES 1514 | 1515 | # If the UML_LOOK tag is set to YES doxygen will generate inheritance and 1516 | # collaboration diagrams in a style similar to the OMG's Unified Modeling 1517 | # Language. 1518 | 1519 | UML_LOOK = NO 1520 | 1521 | # If set to YES, the inheritance and collaboration graphs will show the 1522 | # relations between templates and their instances. 1523 | 1524 | TEMPLATE_RELATIONS = NO 1525 | 1526 | # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 1527 | # tags are set to YES then doxygen will generate a graph for each documented 1528 | # file showing the direct and indirect include dependencies of the file with 1529 | # other documented files. 1530 | 1531 | INCLUDE_GRAPH = YES 1532 | 1533 | # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 1534 | # HAVE_DOT tags are set to YES then doxygen will generate a graph for each 1535 | # documented header file showing the documented files that directly or 1536 | # indirectly include this file. 1537 | 1538 | INCLUDED_BY_GRAPH = YES 1539 | 1540 | # If the CALL_GRAPH and HAVE_DOT options are set to YES then 1541 | # doxygen will generate a call dependency graph for every global function 1542 | # or class method. Note that enabling this option will significantly increase 1543 | # the time of a run. So in most cases it will be better to enable call graphs 1544 | # for selected functions only using the \callgraph command. 1545 | 1546 | CALL_GRAPH = NO 1547 | 1548 | # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then 1549 | # doxygen will generate a caller dependency graph for every global function 1550 | # or class method. Note that enabling this option will significantly increase 1551 | # the time of a run. So in most cases it will be better to enable caller 1552 | # graphs for selected functions only using the \callergraph command. 1553 | 1554 | CALLER_GRAPH = NO 1555 | 1556 | # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 1557 | # will graphical hierarchy of all classes instead of a textual one. 1558 | 1559 | GRAPHICAL_HIERARCHY = YES 1560 | 1561 | # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES 1562 | # then doxygen will show the dependencies a directory has on other directories 1563 | # in a graphical way. The dependency relations are determined by the #include 1564 | # relations between the files in the directories. 1565 | 1566 | DIRECTORY_GRAPH = YES 1567 | 1568 | # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 1569 | # generated by dot. Possible values are png, jpg, or gif 1570 | # If left blank png will be used. 1571 | 1572 | DOT_IMAGE_FORMAT = png 1573 | 1574 | # The tag DOT_PATH can be used to specify the path where the dot tool can be 1575 | # found. If left blank, it is assumed the dot tool can be found in the path. 1576 | 1577 | DOT_PATH = 1578 | 1579 | # The DOTFILE_DIRS tag can be used to specify one or more directories that 1580 | # contain dot files that are included in the documentation (see the 1581 | # \dotfile command). 1582 | 1583 | DOTFILE_DIRS = 1584 | 1585 | # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of 1586 | # nodes that will be shown in the graph. If the number of nodes in a graph 1587 | # becomes larger than this value, doxygen will truncate the graph, which is 1588 | # visualized by representing a node as a red box. Note that doxygen if the 1589 | # number of direct children of the root node in a graph is already larger than 1590 | # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note 1591 | # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. 1592 | 1593 | DOT_GRAPH_MAX_NODES = 50 1594 | 1595 | # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the 1596 | # graphs generated by dot. A depth value of 3 means that only nodes reachable 1597 | # from the root by following a path via at most 3 edges will be shown. Nodes 1598 | # that lay further from the root node will be omitted. Note that setting this 1599 | # option to 1 or 2 may greatly reduce the computation time needed for large 1600 | # code bases. Also note that the size of a graph can be further restricted by 1601 | # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. 1602 | 1603 | MAX_DOT_GRAPH_DEPTH = 0 1604 | 1605 | # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent 1606 | # background. This is disabled by default, because dot on Windows does not 1607 | # seem to support this out of the box. Warning: Depending on the platform used, 1608 | # enabling this option may lead to badly anti-aliased labels on the edges of 1609 | # a graph (i.e. they become hard to read). 1610 | 1611 | DOT_TRANSPARENT = NO 1612 | 1613 | # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output 1614 | # files in one run (i.e. multiple -o and -T options on the command line). This 1615 | # makes dot run faster, but since only newer versions of dot (>1.8.10) 1616 | # support this, this feature is disabled by default. 1617 | 1618 | DOT_MULTI_TARGETS = YES 1619 | 1620 | # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 1621 | # generate a legend page explaining the meaning of the various boxes and 1622 | # arrows in the dot generated graphs. 1623 | 1624 | GENERATE_LEGEND = YES 1625 | 1626 | # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 1627 | # remove the intermediate dot files that are used to generate 1628 | # the various graphs. 1629 | 1630 | DOT_CLEANUP = YES 1631 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | PSPSDK = $(shell psp-config --pspsdk-path) 2 | PSPDIR = $(shell psp-config --psp-prefix) 3 | 4 | CFLAGS = -O2 -G0 -g 5 | 6 | OBJS = glib2d.o 7 | TARGET_LIB = libglib2d.a 8 | 9 | include $(PSPSDK)/lib/build.mak 10 | 11 | install: all 12 | mkdir -p $(PSPDIR)/include $(PSPDIR)/lib 13 | cp *.h $(PSPDIR)/include 14 | cp *.a $(PSPDIR)/lib 15 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | * Introduction * 2 | 3 | gLib2D by Geecko - A simple, fast, light-weight 2D graphics library. 4 | This library has been designed to replace the old graphics.c library 5 | and to simplify the use of pspgu. 6 | The goals : keep it simple, keep it small, keep it fast. 7 | 8 | * Known limitations * 9 | 10 | - Draw & display buffers can't actually be used as real textures. Just a way 11 | to get the vram pointer. 12 | - No support for multiples contexts (e.g. sharing coordinates between 13 | textures using some g2dBegin calls at a time). 14 | - Manipulating textures (clear, get pixel info...) is not possible. 15 | - When some 512*512 rotated, colorized and scaled textures are rendered 16 | at a time, the framerate *could* go under 60 fps. 17 | 18 | * Installation * 19 | 20 | - Simply put glib2d.c and glib2d.h in your source directory. 21 | - Then add glib2d.o and link "-lpng -ljpeg -lz -lpspgu -lm -lpspvram" 22 | in your Makefile. 23 | - You're done ! 24 | 25 | * License * 26 | 27 | This work is licensed under the LGPLv3 License. 28 | See the LICENSE file for more details. 29 | You can support the library by marking your homebrew with 30 | "Using gLib2D by Geecko". 31 | 32 | * Contact * 33 | 34 | Please report bugs or submit ideas at : 35 | geecko.dev@free.fr 36 | 37 | Get the full documentation on : 38 | http://geecko.dev.free.fr 39 | 40 | Also stay tuned on... 41 | https://github.com/GeeckoDev (contributors would be a plus!) 42 | http://twitter.com/GeeckoDev 43 | -------------------------------------------------------------------------------- /glib2d.c: -------------------------------------------------------------------------------- 1 | /* 2 | * gLib2D - A simple, fast, light-weight 2D graphics library. 3 | * 4 | * Copyright 2012 Clément Guérin 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include "glib2d.h" 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #ifdef USE_PNG 30 | #include 31 | #endif 32 | 33 | #ifdef USE_JPEG 34 | #include 35 | #endif 36 | 37 | /* Defines */ 38 | 39 | #define DLIST_SIZE (524288) 40 | #define LINE_SIZE (512) 41 | #define PIXEL_SIZE (4) 42 | #define FRAMEBUFFER_SIZE (LINE_SIZE*G2D_SCR_H*PIXEL_SIZE) 43 | #define MALLOC_STEP (128) 44 | #define TSTACK_MAX (64) 45 | #define SLICE_WIDTH (64.f) 46 | #define M_180_PI (57.29578f) 47 | #define M_PI_180 (0.017453292f) 48 | 49 | #define DEFAULT_SIZE (10) 50 | #define DEFAULT_COORD_MODE (G2D_UP_LEFT) 51 | #define DEFAULT_X (0.f) 52 | #define DEFAULT_Y (0.f) 53 | #define DEFAULT_Z (0.f) 54 | #define DEFAULT_COLOR (WHITE) 55 | #define DEFAULT_ALPHA (0xFF) 56 | 57 | #define OBJ rctx.obj[rctx.n-1] 58 | #define OBJ_I rctx.obj[i] 59 | #define TRANSFORM tstack[tstack_size-1] 60 | 61 | /* Enumerations */ 62 | 63 | typedef enum 64 | { 65 | RECTS, LINES, QUADS, POINTS 66 | } Obj_Type; 67 | 68 | /* Structures */ 69 | 70 | typedef struct 71 | { 72 | float x, y, z; 73 | float rot, rot_sin, rot_cos; 74 | float scale_w, scale_h; 75 | } Transform; 76 | 77 | typedef struct 78 | { 79 | float x, y, z; 80 | float rot_x, rot_y; // Rotation center 81 | float rot, rot_sin, rot_cos; 82 | int crop_x, crop_y; 83 | int crop_w, crop_h; 84 | float scale_w, scale_h; 85 | g2dColor color; 86 | g2dAlpha alpha; 87 | } Object; 88 | 89 | typedef struct 90 | { 91 | Object *obj; 92 | Object cur_obj; 93 | unsigned int n; 94 | Obj_Type type; 95 | g2dTexture *tex; 96 | 97 | bool use_strip; 98 | bool use_z; 99 | bool use_vert_color; 100 | bool use_rot; 101 | bool use_tex_linear; 102 | bool use_tex_repeat; 103 | bool use_int; 104 | unsigned int color_count; 105 | g2dCoord_Mode coord_mode; 106 | } RenderContext; 107 | 108 | /* Local variables */ 109 | 110 | static int *dlist; 111 | 112 | static RenderContext rctx; 113 | 114 | static Transform tstack[TSTACK_MAX]; 115 | static unsigned int tstack_size; 116 | 117 | static bool init = false; 118 | static bool start = false; 119 | static bool begin = false; 120 | static bool zclear = true; 121 | static bool scissor = false; 122 | 123 | static float global_scale; 124 | 125 | /* Global variables */ 126 | 127 | g2dTexture g2d_draw_buffer = 128 | { 129 | 512, 512, 130 | G2D_SCR_W, G2D_SCR_H, 131 | (float)G2D_SCR_W/G2D_SCR_H, 132 | false, 133 | (g2dColor*)FRAMEBUFFER_SIZE 134 | }; 135 | 136 | g2dTexture g2d_disp_buffer = 137 | { 138 | 512, 512, 139 | G2D_SCR_W, G2D_SCR_H, 140 | (float)G2D_SCR_W/G2D_SCR_H, 141 | false, 142 | (g2dColor*)0 143 | }; 144 | 145 | /* Internal functions */ 146 | 147 | void _g2dStart() 148 | { 149 | if (!init) 150 | g2dInit(); 151 | 152 | sceKernelDcacheWritebackRange(dlist, DLIST_SIZE); 153 | sceGuStart(GU_DIRECT, dlist); 154 | start = true; 155 | } 156 | 157 | 158 | void* _g2dSetVertex(void *vp, int i, float vx, float vy) 159 | { 160 | // Vertex order: [texture uv] [color] [coord] 161 | short *vp_short; 162 | g2dColor *vp_color; 163 | float *vp_float; 164 | 165 | // Texture coordinates 166 | vp_short = (short*)vp; 167 | 168 | if (rctx.tex != NULL) 169 | { 170 | *(vp_short++) = OBJ_I.crop_x + vx * OBJ_I.crop_w; 171 | *(vp_short++) = OBJ_I.crop_y + vy * OBJ_I.crop_h; 172 | } 173 | 174 | // Color 175 | vp_color = (g2dColor*)vp_short; 176 | 177 | if (rctx.use_vert_color) 178 | { 179 | *(vp_color++) = OBJ_I.color; 180 | } 181 | 182 | // Coordinates 183 | vp_float = (float*)vp_color; 184 | 185 | vp_float[0] = OBJ_I.x; 186 | vp_float[1] = OBJ_I.y; 187 | 188 | if (rctx.type == RECTS) 189 | { 190 | vp_float[0] += vx * OBJ_I.scale_w; 191 | vp_float[1] += vy * OBJ_I.scale_h; 192 | 193 | if (rctx.use_rot) // Apply a rotation 194 | { 195 | float tx = vp_float[0] - OBJ_I.rot_x; 196 | float ty = vp_float[1] - OBJ_I.rot_y; 197 | 198 | vp_float[0] = OBJ_I.rot_x - OBJ_I.rot_sin*ty + OBJ_I.rot_cos*tx, 199 | vp_float[1] = OBJ_I.rot_y + OBJ_I.rot_cos*ty + OBJ_I.rot_sin*tx; 200 | } 201 | } 202 | 203 | if (rctx.use_int) // Pixel perfect 204 | { 205 | vp_float[0] = floorf(vp_float[0]); 206 | vp_float[1] = floorf(vp_float[1]); 207 | } 208 | vp_float[2] = OBJ_I.z; 209 | 210 | return (void*)(vp_float + 3); 211 | } 212 | 213 | 214 | #ifdef USE_VFPU 215 | void vfpu_sincosf(float x, float *s, float *c) 216 | { 217 | __asm__ volatile ( 218 | "mtv %2, s000\n" // s000 = x 219 | "vcst.s s001, VFPU_2_PI\n" // s001 = 2/pi 220 | "vmul.s s000, s000, s001\n" // s000 = s000*s001 221 | "vrot.p c010, s000, [s, c]\n" // s010 = sinf(s000), s011 = cosf(s000) 222 | "mfv %0, s010\n" // *s = s010 223 | "mfv %1, S011\n" // *c = s011 224 | : "=r"(*s), "=r"(*c) : "r"(x) 225 | ); 226 | } 227 | #endif 228 | 229 | /* Main functions */ 230 | 231 | void g2dInit() 232 | { 233 | if (init) 234 | return; 235 | 236 | // Display list allocation 237 | dlist = malloc(DLIST_SIZE); 238 | 239 | // Setup GU 240 | sceGuInit(); 241 | sceGuStart(GU_DIRECT, dlist); 242 | 243 | sceGuDrawBuffer(GU_PSM_8888, g2d_draw_buffer.data, LINE_SIZE); 244 | sceGuDispBuffer(G2D_SCR_W, G2D_SCR_H, g2d_disp_buffer.data, LINE_SIZE); 245 | sceGuDepthBuffer((void*)(FRAMEBUFFER_SIZE*2), LINE_SIZE); 246 | sceGuOffset(2048-G2D_SCR_W/2, 2048-G2D_SCR_H/2); 247 | sceGuViewport(2048, 2048, G2D_SCR_W, G2D_SCR_H); 248 | 249 | g2d_draw_buffer.data = vabsptr(g2d_draw_buffer.data); 250 | g2d_disp_buffer.data = vabsptr(g2d_disp_buffer.data); 251 | 252 | sceGuDepthRange(65535, 0); 253 | sceGuClearDepth(65535); 254 | sceGuAlphaFunc(GU_GREATER, 0, 255); 255 | sceGuDepthFunc(GU_LEQUAL); 256 | sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0); 257 | sceGuTexFunc(GU_TFX_MODULATE, GU_TCC_RGBA); 258 | sceGuTexFilter(GU_LINEAR, GU_LINEAR); 259 | sceGuShadeModel(GU_SMOOTH); 260 | 261 | sceGuDisable(GU_CULL_FACE); 262 | sceGuDisable(GU_CLIP_PLANES); 263 | sceGuDisable(GU_DITHER); 264 | sceGuEnable(GU_ALPHA_TEST); 265 | sceGuEnable(GU_SCISSOR_TEST); 266 | sceGuEnable(GU_BLEND); 267 | 268 | g2dResetGlobalScale(); 269 | g2dResetScissor(); 270 | 271 | sceGuFinish(); 272 | sceGuSync(0, 0); 273 | sceDisplayWaitVblankStart(); 274 | sceGuDisplay(GU_TRUE); 275 | 276 | init = true; 277 | } 278 | 279 | 280 | void g2dTerm() 281 | { 282 | if (!init) 283 | return; 284 | 285 | sceGuTerm(); 286 | 287 | free(dlist); 288 | 289 | init = false; 290 | } 291 | 292 | void g2dClear(g2dColor color) 293 | { 294 | if (!start) 295 | _g2dStart(); 296 | 297 | sceGuClearColor(color); 298 | sceGuClear(GU_COLOR_BUFFER_BIT | 299 | GU_FAST_CLEAR_BIT | 300 | (zclear ? GU_DEPTH_BUFFER_BIT : 0)); 301 | 302 | zclear = false; 303 | } 304 | 305 | 306 | void g2dClearZ() 307 | { 308 | if (!start) 309 | _g2dStart(); 310 | 311 | sceGuClear(GU_DEPTH_BUFFER_BIT | GU_FAST_CLEAR_BIT); 312 | zclear = true; 313 | } 314 | 315 | 316 | void _g2dBeginCommon(Obj_Type type, g2dTexture *tex) 317 | { 318 | if (begin) 319 | return; 320 | 321 | if (!start) 322 | _g2dStart(); 323 | 324 | // Reset render context 325 | rctx.obj = realloc(rctx.obj, MALLOC_STEP * sizeof(Object)); 326 | rctx.n = 0; 327 | rctx.type = type; 328 | rctx.tex = tex; 329 | rctx.use_strip = false; 330 | rctx.use_z = false; 331 | rctx.use_vert_color = false; 332 | rctx.use_rot = false; 333 | rctx.use_tex_linear = true; 334 | rctx.use_tex_repeat = false; 335 | rctx.use_int = false; 336 | rctx.color_count = 0; 337 | rctx.coord_mode = DEFAULT_COORD_MODE; 338 | 339 | // Reset current object 340 | g2dReset(); 341 | 342 | begin = true; 343 | } 344 | 345 | 346 | void g2dBeginRects(g2dTexture *tex) 347 | { 348 | _g2dBeginCommon(RECTS, tex); 349 | } 350 | 351 | 352 | void g2dBeginLines(g2dLine_Mode mode) 353 | { 354 | _g2dBeginCommon(LINES, NULL); 355 | 356 | rctx.use_strip = (mode & G2D_STRIP); 357 | } 358 | 359 | 360 | void g2dBeginQuads(g2dTexture *tex) 361 | { 362 | _g2dBeginCommon(QUADS, tex); 363 | } 364 | 365 | 366 | void g2dBeginPoints() 367 | { 368 | _g2dBeginCommon(POINTS, NULL); 369 | } 370 | 371 | 372 | void _g2dEndRects() 373 | { 374 | // Define vertices properties 375 | int v_prim = (rctx.use_rot ? GU_TRIANGLES : GU_SPRITES); 376 | int v_obj_nbr = (rctx.use_rot ? 6 : 2); 377 | int v_nbr; 378 | int v_coord_size = 3; 379 | int v_tex_size = (rctx.tex != NULL ? 2 : 0); 380 | int v_color_size = (rctx.use_vert_color ? 1 : 0); 381 | int v_size = v_tex_size * sizeof(short) + 382 | v_color_size * sizeof(g2dColor) + 383 | v_coord_size * sizeof(float); 384 | int v_type = GU_VERTEX_32BITF | GU_TRANSFORM_2D; 385 | int i; 386 | 387 | if (rctx.tex != NULL) v_type |= GU_TEXTURE_16BIT; 388 | if (rctx.use_vert_color) v_type |= GU_COLOR_8888; 389 | 390 | // Count how many vertices to allocate. 391 | if (rctx.tex == NULL || rctx.use_rot) // No slicing 392 | { 393 | v_nbr = v_obj_nbr * rctx.n; 394 | } 395 | else // Can use texture slicing for tremendous performance :) 396 | { 397 | v_nbr = 0; 398 | 399 | for (i=0; i1.f ? 1.f : u+step), 1.f); 435 | } 436 | } 437 | } 438 | 439 | // Then put it in the display list. 440 | sceGuDrawArray(v_prim, v_type, v_nbr, NULL, v); 441 | } 442 | 443 | 444 | void _g2dEndLines() 445 | { 446 | // Define vertices properties 447 | int v_prim = (rctx.use_strip ? GU_LINE_STRIP : GU_LINES); 448 | int v_obj_nbr = (rctx.use_strip ? 1 : 2); 449 | int v_nbr = v_obj_nbr * (rctx.use_strip ? rctx.n : rctx.n/2); 450 | int v_coord_size = 3; 451 | int v_color_size = (rctx.use_vert_color ? 1 : 0); 452 | int v_size = v_color_size * sizeof(g2dColor) + 453 | v_coord_size * sizeof(float); 454 | int v_type = GU_VERTEX_32BITF | GU_TRANSFORM_2D; 455 | int i; 456 | 457 | if (rctx.use_vert_color) v_type |= GU_COLOR_8888; 458 | 459 | // Allocate vertex list memory 460 | void *v = sceGuGetMemory(v_nbr * v_size); 461 | void *vi = v; 462 | 463 | // Build the vertex list 464 | if (rctx.use_strip) 465 | { 466 | vi = _g2dSetVertex(vi, 0, 0.f, 0.f); 467 | 468 | for (i=1; iswizzled); 589 | sceGuTexImage(0, rctx.tex->tw, rctx.tex->th, 590 | rctx.tex->tw, rctx.tex->data); 591 | } 592 | 593 | switch (rctx.type) 594 | { 595 | case RECTS: 596 | _g2dEndRects(); 597 | break; 598 | 599 | case LINES: 600 | _g2dEndLines(); 601 | break; 602 | 603 | case QUADS: 604 | _g2dEndQuads(); 605 | break; 606 | 607 | case POINTS: 608 | _g2dEndPoints(); 609 | break; 610 | } 611 | 612 | sceGuColor(WHITE); 613 | 614 | if (rctx.use_z) 615 | zclear = true; 616 | 617 | begin = false; 618 | } 619 | 620 | 621 | void g2dReset() 622 | { 623 | g2dResetCoord(); 624 | g2dResetScale(); 625 | g2dResetColor(); 626 | g2dResetAlpha(); 627 | g2dResetRotation(); 628 | g2dResetCrop(); 629 | g2dResetTex(); 630 | } 631 | 632 | 633 | void g2dFlip(g2dFlip_Mode mode) 634 | { 635 | if (scissor) 636 | g2dResetScissor(); 637 | 638 | sceGuFinish(); 639 | sceGuSync(0, 0); 640 | 641 | if (mode & G2D_VSYNC) 642 | sceDisplayWaitVblankStart(); 643 | 644 | g2d_disp_buffer.data = g2d_draw_buffer.data; 645 | g2d_draw_buffer.data = vabsptr(sceGuSwapBuffers()); 646 | 647 | start = false; 648 | } 649 | 650 | 651 | void g2dAdd() 652 | { 653 | if (!begin || rctx.cur_obj.scale_w == 0.f || rctx.cur_obj.scale_h == 0.f) 654 | return; 655 | 656 | if (rctx.n % MALLOC_STEP == 0) 657 | { 658 | rctx.obj = realloc(rctx.obj, 659 | (rctx.n+MALLOC_STEP) * sizeof(Object)); 660 | } 661 | 662 | rctx.n++; 663 | OBJ = rctx.cur_obj; 664 | 665 | // Coordinate mode stuff 666 | OBJ.rot_x = OBJ.x; 667 | OBJ.rot_y = OBJ.y; 668 | 669 | switch (rctx.coord_mode) 670 | { 671 | case G2D_UP_RIGHT: 672 | OBJ.x -= OBJ.scale_w; 673 | break; 674 | 675 | case G2D_DOWN_RIGHT: 676 | OBJ.x -= OBJ.scale_w; 677 | OBJ.y -= OBJ.scale_h; 678 | break; 679 | 680 | case G2D_DOWN_LEFT: 681 | OBJ.y -= OBJ.scale_h; 682 | break; 683 | 684 | case G2D_CENTER: 685 | OBJ.x -= OBJ.scale_w / 2.f; 686 | OBJ.y -= OBJ.scale_h / 2.f; 687 | break; 688 | 689 | case G2D_UP_LEFT: 690 | default: 691 | break; 692 | }; 693 | 694 | // Alpha stuff 695 | OBJ.color = G2D_MODULATE(OBJ.color, 255, rctx.cur_obj.alpha); 696 | } 697 | 698 | 699 | void g2dPush() 700 | { 701 | if (tstack_size >= TSTACK_MAX) 702 | return; 703 | 704 | tstack_size++; 705 | 706 | TRANSFORM.x = rctx.cur_obj.x; 707 | TRANSFORM.y = rctx.cur_obj.y; 708 | TRANSFORM.z = rctx.cur_obj.z; 709 | TRANSFORM.rot = rctx.cur_obj.rot; 710 | TRANSFORM.rot_sin = rctx.cur_obj.rot_sin; 711 | TRANSFORM.rot_cos = rctx.cur_obj.rot_cos; 712 | TRANSFORM.scale_w = rctx.cur_obj.scale_w; 713 | TRANSFORM.scale_h = rctx.cur_obj.scale_h; 714 | } 715 | 716 | 717 | void g2dPop() 718 | { 719 | if (tstack_size <= 0) 720 | return; 721 | 722 | rctx.cur_obj.x = TRANSFORM.x; 723 | rctx.cur_obj.y = TRANSFORM.y; 724 | rctx.cur_obj.z = TRANSFORM.z; 725 | rctx.cur_obj.rot = TRANSFORM.rot; 726 | rctx.cur_obj.rot_sin = TRANSFORM.rot_sin; 727 | rctx.cur_obj.rot_cos = TRANSFORM.rot_cos; 728 | rctx.cur_obj.scale_w = TRANSFORM.scale_w; 729 | rctx.cur_obj.scale_h = TRANSFORM.scale_h; 730 | 731 | tstack_size--; 732 | 733 | if (rctx.cur_obj.rot != 0.f) rctx.use_rot = true; 734 | if (rctx.cur_obj.z != 0.f) rctx.use_z = true; 735 | } 736 | 737 | /* Coord functions */ 738 | 739 | void g2dResetCoord() 740 | { 741 | rctx.cur_obj.x = DEFAULT_X; 742 | rctx.cur_obj.y = DEFAULT_Y; 743 | rctx.cur_obj.z = DEFAULT_Z; 744 | } 745 | 746 | 747 | void g2dSetCoordMode(g2dCoord_Mode mode) 748 | { 749 | if (mode > G2D_CENTER) 750 | return; 751 | 752 | rctx.coord_mode = mode; 753 | } 754 | 755 | 756 | void g2dGetCoordXYZ(float *x, float *y, float *z) 757 | { 758 | if (x != NULL) *x = rctx.cur_obj.x; 759 | if (y != NULL) *y = rctx.cur_obj.y; 760 | if (z != NULL) *z = rctx.cur_obj.z; 761 | } 762 | 763 | 764 | void g2dSetCoordXY(float x, float y) 765 | { 766 | rctx.cur_obj.x = x * global_scale; 767 | rctx.cur_obj.y = y * global_scale; 768 | rctx.cur_obj.z = 0.f; 769 | } 770 | 771 | 772 | void g2dSetCoordXYZ(float x, float y, float z) 773 | { 774 | rctx.cur_obj.x = x * global_scale; 775 | rctx.cur_obj.y = y * global_scale; 776 | rctx.cur_obj.z = z * global_scale; 777 | 778 | if (z != 0.f) 779 | rctx.use_z = true; 780 | } 781 | 782 | 783 | void g2dSetCoordXYRelative(float x, float y) 784 | { 785 | float inc_x = x; 786 | float inc_y = y; 787 | 788 | if (rctx.cur_obj.rot_cos != 1.f) 789 | { 790 | inc_x = -rctx.cur_obj.rot_sin*y + rctx.cur_obj.rot_cos*x; 791 | inc_y = rctx.cur_obj.rot_cos*y + rctx.cur_obj.rot_sin*x; 792 | } 793 | 794 | rctx.cur_obj.x += inc_x * global_scale; 795 | rctx.cur_obj.y += inc_y * global_scale; 796 | } 797 | 798 | 799 | void g2dSetCoordXYZRelative(float x, float y, float z) 800 | { 801 | g2dSetCoordXYRelative(x, y); 802 | 803 | rctx.cur_obj.z += z * global_scale; 804 | 805 | if (z != 0.f) 806 | rctx.use_z = true; 807 | } 808 | 809 | 810 | void g2dSetCoordInteger(bool use) 811 | { 812 | rctx.use_int = use; 813 | } 814 | 815 | /* Scale functions */ 816 | 817 | void g2dResetGlobalScale() 818 | { 819 | global_scale = 1.f; 820 | } 821 | 822 | 823 | void g2dResetScale() 824 | { 825 | if (rctx.tex == NULL) 826 | { 827 | rctx.cur_obj.scale_w = DEFAULT_SIZE; 828 | rctx.cur_obj.scale_h = DEFAULT_SIZE; 829 | } 830 | else 831 | { 832 | rctx.cur_obj.scale_w = rctx.tex->w; 833 | rctx.cur_obj.scale_h = rctx.tex->h; 834 | } 835 | 836 | rctx.cur_obj.scale_w *= global_scale; 837 | rctx.cur_obj.scale_h *= global_scale; 838 | } 839 | 840 | 841 | void g2dGetGlobalScale(float *scale) 842 | { 843 | if (scale != NULL) 844 | *scale = global_scale; 845 | } 846 | 847 | 848 | void g2dGetScaleWH(float *w, float *h) 849 | { 850 | if (w != NULL) *w = rctx.cur_obj.scale_w; 851 | if (h != NULL) *h = rctx.cur_obj.scale_h; 852 | } 853 | 854 | 855 | void g2dSetGlobalScale(float scale) 856 | { 857 | global_scale = scale; 858 | } 859 | 860 | 861 | void g2dSetScale(float w, float h) 862 | { 863 | g2dResetScale(); 864 | 865 | g2dSetScaleRelative(w, h); 866 | } 867 | 868 | 869 | void g2dSetScaleWH(float w, float h) 870 | { 871 | rctx.cur_obj.scale_w = w * global_scale; 872 | rctx.cur_obj.scale_h = h * global_scale; 873 | 874 | // A trick to prevent an unexpected behavior when mirroring with GU_SPRITES. 875 | if (rctx.cur_obj.scale_w < 0 || rctx.cur_obj.scale_h < 0) 876 | rctx.use_rot = true; 877 | } 878 | 879 | 880 | void g2dSetScaleRelative(float w, float h) 881 | { 882 | rctx.cur_obj.scale_w *= w; 883 | rctx.cur_obj.scale_h *= h; 884 | 885 | if (rctx.cur_obj.scale_w < 0 || rctx.cur_obj.scale_h < 0) 886 | rctx.use_rot = true; 887 | } 888 | 889 | 890 | void g2dSetScaleWHRelative(float w, float h) 891 | { 892 | rctx.cur_obj.scale_w += w * global_scale; 893 | rctx.cur_obj.scale_h += h * global_scale; 894 | 895 | if (rctx.cur_obj.scale_w < 0 || rctx.cur_obj.scale_h < 0) 896 | rctx.use_rot = true; 897 | } 898 | 899 | /* Color functions */ 900 | 901 | void g2dResetColor() 902 | { 903 | rctx.cur_obj.color = DEFAULT_COLOR; 904 | } 905 | 906 | 907 | void g2dResetAlpha() 908 | { 909 | rctx.cur_obj.alpha = DEFAULT_ALPHA; 910 | } 911 | 912 | 913 | void g2dGetAlpha(g2dAlpha *alpha) 914 | { 915 | if (alpha != NULL) 916 | *alpha = rctx.cur_obj.alpha; 917 | } 918 | 919 | 920 | void g2dSetColor(g2dColor color) 921 | { 922 | rctx.cur_obj.color = color; 923 | 924 | if (++rctx.color_count > 1) 925 | rctx.use_vert_color = true; 926 | } 927 | 928 | 929 | void g2dSetAlpha(g2dAlpha alpha) 930 | { 931 | if (alpha < 0) alpha = 0; 932 | if (alpha > 255) alpha = 255; 933 | 934 | rctx.cur_obj.alpha = alpha; 935 | 936 | if (++rctx.color_count > 1) 937 | rctx.use_vert_color = true; 938 | } 939 | 940 | 941 | void g2dSetAlphaRelative(int alpha) 942 | { 943 | g2dSetAlpha(rctx.cur_obj.alpha + alpha); 944 | } 945 | 946 | /* Rotation functions */ 947 | 948 | void g2dResetRotation() 949 | { 950 | rctx.cur_obj.rot = 0.f; 951 | rctx.cur_obj.rot_sin = 0.f; 952 | rctx.cur_obj.rot_cos = 1.f; 953 | } 954 | 955 | 956 | void g2dGetRotationRad(float *radians) 957 | { 958 | if (radians != NULL) 959 | *radians = rctx.cur_obj.rot; 960 | } 961 | 962 | 963 | void g2dGetRotation(float *degrees) 964 | { 965 | if (degrees != NULL) 966 | *degrees = rctx.cur_obj.rot * M_180_PI; 967 | } 968 | 969 | 970 | void g2dSetRotationRad(float radians) 971 | { 972 | if (radians == rctx.cur_obj.rot) 973 | return; 974 | 975 | rctx.cur_obj.rot = radians; 976 | 977 | #ifdef USE_VFPU 978 | vfpu_sincosf(radians, &rctx.cur_obj.rot_sin, &rctx.cur_obj.rot_cos); 979 | #else 980 | sincosf(radians, &rctx.cur_obj.rot_sin, &rctx.cur_obj.rot_cos); 981 | #endif 982 | 983 | if (radians != 0.f) 984 | rctx.use_rot = true; 985 | } 986 | 987 | 988 | void g2dSetRotation(float degrees) 989 | { 990 | g2dSetRotationRad(degrees * M_PI_180); 991 | } 992 | 993 | 994 | void g2dSetRotationRadRelative(float radians) 995 | { 996 | g2dSetRotationRad(rctx.cur_obj.rot + radians); 997 | } 998 | 999 | 1000 | void g2dSetRotationRelative(float degrees) 1001 | { 1002 | g2dSetRotationRadRelative(degrees * M_PI_180); 1003 | } 1004 | 1005 | /* Crop functions */ 1006 | 1007 | void g2dResetCrop() 1008 | { 1009 | if (rctx.tex == NULL) 1010 | return; 1011 | 1012 | rctx.cur_obj.crop_x = 0; 1013 | rctx.cur_obj.crop_y = 0; 1014 | rctx.cur_obj.crop_w = rctx.tex->w; 1015 | rctx.cur_obj.crop_h = rctx.tex->h; 1016 | } 1017 | 1018 | 1019 | void g2dGetCropXY(int *x, int *y) 1020 | { 1021 | if (rctx.tex == NULL) 1022 | return; 1023 | 1024 | if (x != NULL) *x = rctx.cur_obj.crop_x; 1025 | if (y != NULL) *y = rctx.cur_obj.crop_y; 1026 | } 1027 | 1028 | 1029 | void g2dGetCropWH(int *w, int *h) 1030 | { 1031 | if (rctx.tex == NULL) 1032 | return; 1033 | 1034 | if (w != NULL) *w = rctx.cur_obj.crop_w; 1035 | if (h != NULL) *h = rctx.cur_obj.crop_h; 1036 | } 1037 | 1038 | 1039 | void g2dSetCropXY(int x, int y) 1040 | { 1041 | if (rctx.tex == NULL) 1042 | return; 1043 | 1044 | rctx.cur_obj.crop_x = x; 1045 | rctx.cur_obj.crop_y = y; 1046 | } 1047 | 1048 | 1049 | void g2dSetCropWH(int w, int h) 1050 | { 1051 | if (rctx.tex == NULL) 1052 | return; 1053 | 1054 | rctx.cur_obj.crop_w = w; 1055 | rctx.cur_obj.crop_h = h; 1056 | } 1057 | 1058 | 1059 | void g2dSetCropXYRelative(int x, int y) 1060 | { 1061 | if (rctx.tex == NULL) 1062 | return; 1063 | 1064 | g2dSetCropXY(rctx.cur_obj.crop_x + x, rctx.cur_obj.crop_y + y); 1065 | } 1066 | 1067 | 1068 | void g2dSetCropWHRelative(int w, int h) 1069 | { 1070 | if (rctx.tex == NULL) 1071 | return; 1072 | 1073 | g2dSetCropWH(rctx.cur_obj.crop_w + w, rctx.cur_obj.crop_h + h); 1074 | } 1075 | 1076 | /* Texture functions */ 1077 | 1078 | void g2dResetTex() 1079 | { 1080 | if (rctx.tex == NULL) 1081 | return; 1082 | 1083 | rctx.use_tex_repeat = false; 1084 | rctx.use_tex_linear = true; 1085 | } 1086 | 1087 | 1088 | void g2dSetTexRepeat(bool use) 1089 | { 1090 | if (rctx.tex == NULL) 1091 | return; 1092 | 1093 | rctx.use_tex_repeat = use; 1094 | } 1095 | 1096 | 1097 | void g2dSetTexLinear(bool use) 1098 | { 1099 | if (rctx.tex == NULL) 1100 | return; 1101 | 1102 | rctx.use_tex_linear = use; 1103 | } 1104 | 1105 | /* Texture management */ 1106 | 1107 | unsigned int _getNextPower2(unsigned int n) 1108 | { 1109 | n--; 1110 | n |= n >> 1; 1111 | n |= n >> 2; 1112 | n |= n >> 4; 1113 | n |= n >> 8; 1114 | n |= n >> 16; 1115 | 1116 | return n+1; 1117 | } 1118 | 1119 | 1120 | void _swizzle(unsigned char *dest, unsigned char *source, int width, int height) 1121 | { 1122 | int i, j; 1123 | int rowblocks = (width / 16); 1124 | int rowblocks_add = (rowblocks-1) * 128; 1125 | unsigned int block_address = 0; 1126 | unsigned int *img = (unsigned int*)source; 1127 | 1128 | for (j=0; jtw = _getNextPower2(w); 1157 | tex->th = _getNextPower2(h); 1158 | tex->w = w; 1159 | tex->h = h; 1160 | tex->ratio = (float)w / h; 1161 | tex->swizzled = false; 1162 | 1163 | tex->data = malloc(tex->tw * tex->th * sizeof(g2dColor)); 1164 | if (tex->data == NULL) 1165 | { 1166 | free(tex); 1167 | return NULL; 1168 | } 1169 | 1170 | memset(tex->data, 0, tex->tw * tex->th * sizeof(g2dColor)); 1171 | 1172 | return tex; 1173 | } 1174 | 1175 | 1176 | void g2dTexFree(g2dTexture **tex) 1177 | { 1178 | if (tex == NULL) 1179 | return; 1180 | if (*tex == NULL) 1181 | return; 1182 | 1183 | free((*tex)->data); 1184 | free((*tex)); 1185 | 1186 | *tex = NULL; 1187 | } 1188 | 1189 | 1190 | #ifdef USE_PNG 1191 | g2dTexture* _g2dTexLoadPNG(FILE *fp) 1192 | { 1193 | png_structp png_ptr; 1194 | png_infop info_ptr; 1195 | unsigned int sig_read = 0; 1196 | png_uint_32 width, height; 1197 | int bit_depth, color_type, interlace_type; 1198 | u32 x, y; 1199 | g2dColor *line; 1200 | g2dTexture *tex; 1201 | 1202 | png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); 1203 | png_set_error_fn(png_ptr, NULL, NULL, NULL); 1204 | info_ptr = png_create_info_struct(png_ptr); 1205 | png_init_io(png_ptr, fp); 1206 | png_set_sig_bytes(png_ptr, sig_read); 1207 | png_read_info(png_ptr, info_ptr); 1208 | png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, 1209 | &interlace_type, NULL, NULL); 1210 | png_set_strip_16(png_ptr); 1211 | png_set_packing(png_ptr); 1212 | 1213 | if (color_type == PNG_COLOR_TYPE_PALETTE) 1214 | png_set_palette_to_rgb(png_ptr); 1215 | if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) 1216 | png_set_tRNS_to_alpha(png_ptr); 1217 | 1218 | png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER); 1219 | 1220 | tex = g2dTexCreate(width, height); 1221 | line = malloc(width * 4); 1222 | 1223 | for (y = 0; y < height; y++) 1224 | { 1225 | png_read_row(png_ptr, (u8*) line, NULL); 1226 | 1227 | for (x = 0; x < width; x++) 1228 | tex->data[x + y*tex->tw] = line[x]; 1229 | } 1230 | 1231 | free(line); 1232 | png_read_end(png_ptr, info_ptr); 1233 | png_destroy_read_struct(&png_ptr, &info_ptr, NULL); 1234 | 1235 | return tex; 1236 | } 1237 | #endif 1238 | 1239 | 1240 | #ifdef USE_JPEG 1241 | g2dTexture* _g2dTexLoadJPEG(FILE *fp) 1242 | { 1243 | struct jpeg_decompress_struct dinfo; 1244 | struct jpeg_error_mgr jerr; 1245 | int width, height; 1246 | g2dTexture *tex; 1247 | u8 *line; 1248 | 1249 | dinfo.err = jpeg_std_error(&jerr); 1250 | jpeg_create_decompress(&dinfo); 1251 | jpeg_stdio_src(&dinfo, fp); 1252 | jpeg_read_header(&dinfo, TRUE); 1253 | 1254 | width = dinfo.image_width; 1255 | height = dinfo.image_height; 1256 | tex = g2dTexCreate(width, height); 1257 | line = malloc(width * 3); 1258 | 1259 | jpeg_start_decompress(&dinfo); 1260 | 1261 | if (dinfo.jpeg_color_space == JCS_GRAYSCALE) 1262 | { 1263 | while (dinfo.output_scanline < dinfo.output_height) 1264 | { 1265 | int y = dinfo.output_scanline; 1266 | int x; 1267 | 1268 | jpeg_read_scanlines(&dinfo, &line, 1); 1269 | 1270 | for (x=0; xdata[x + tex->tw * y] = c; 1276 | } 1277 | } 1278 | } 1279 | else 1280 | { 1281 | while (dinfo.output_scanline < dinfo.output_height) 1282 | { 1283 | int y = dinfo.output_scanline; 1284 | int x; 1285 | u8 *pline; 1286 | 1287 | jpeg_read_scanlines(&dinfo, &line, 1); 1288 | pline = line; 1289 | 1290 | for (x=0; xdata[x + tex->tw * y] = c | 0xff000000; 1299 | } 1300 | } 1301 | } 1302 | 1303 | jpeg_finish_decompress(&dinfo); 1304 | jpeg_destroy_decompress(&dinfo); 1305 | free(line); 1306 | 1307 | return tex; 1308 | } 1309 | #endif 1310 | 1311 | 1312 | g2dTexture* g2dTexLoad(char path[], g2dTex_Mode mode) 1313 | { 1314 | g2dTexture *tex = NULL; 1315 | FILE *fp = NULL; 1316 | 1317 | if (path == NULL) 1318 | return NULL; 1319 | if ((fp = fopen(path, "rb")) == NULL) 1320 | return NULL; 1321 | 1322 | #ifdef USE_PNG 1323 | if (strstr(path, ".png")) 1324 | { 1325 | tex = _g2dTexLoadPNG(fp); 1326 | } 1327 | #endif 1328 | 1329 | #ifdef USE_JPEG 1330 | if (strstr(path, ".jpg") || strstr(path, ".jpeg")) 1331 | { 1332 | tex = _g2dTexLoadJPEG(fp); 1333 | } 1334 | #endif 1335 | 1336 | if (tex == NULL) 1337 | goto error; 1338 | 1339 | fclose(fp); 1340 | fp = NULL; 1341 | 1342 | // The PSP can't draw 512*512+ textures. 1343 | if (tex->w > 512 || tex->h > 512) 1344 | goto error; 1345 | 1346 | // Swizzling is useless with small textures. 1347 | if ((mode & G2D_SWIZZLE) && (tex->w >= 16 || tex->h >= 16)) 1348 | { 1349 | u8 *tmp = malloc(tex->tw*tex->th*PIXEL_SIZE); 1350 | _swizzle(tmp, (u8*)tex->data, tex->tw*PIXEL_SIZE, tex->th); 1351 | free(tex->data); 1352 | tex->data = (g2dColor*)tmp; 1353 | tex->swizzled = true; 1354 | } 1355 | else 1356 | tex->swizzled = false; 1357 | 1358 | sceKernelDcacheWritebackRange(tex->data, tex->tw*tex->th*PIXEL_SIZE); 1359 | 1360 | return tex; 1361 | 1362 | // Load failure... abort 1363 | error: 1364 | if (fp != NULL) 1365 | fclose(fp); 1366 | 1367 | g2dTexFree(&tex); 1368 | 1369 | return NULL; 1370 | } 1371 | 1372 | /* Scissor functions */ 1373 | 1374 | void g2dResetScissor() 1375 | { 1376 | g2dSetScissor(0, 0, G2D_SCR_W, G2D_SCR_H); 1377 | 1378 | scissor = false; 1379 | } 1380 | 1381 | 1382 | void g2dSetScissor(int x, int y, int w, int h) 1383 | { 1384 | sceGuScissor(x, y, x+w, y+h); 1385 | 1386 | scissor = true; 1387 | } 1388 | 1389 | // EOF 1390 | -------------------------------------------------------------------------------- /glib2d.h: -------------------------------------------------------------------------------- 1 | /** \mainpage gLib2D Documentation 2 | * 3 | * \section intro Introduction 4 | * 5 | * gLib2D by Geecko - A simple, fast, light-weight 2D graphics library. \n\n 6 | * This library has been designed to replace the old graphics.c library 7 | * and to simplify the use of pspgu.\n 8 | * The goals : keep it simple, keep it small, keep it fast. 9 | * 10 | * \section limits Known limitations 11 | * 12 | * - Draw & display buffers can't actually be used as real textures. Just a way 13 | * to get the vram pointer. 14 | * - No support for multiples contexts (e.g. sharing coordinates beetween 15 | * textures using some gBegin calls at a time). 16 | * - Manipulating textures (clear, get pixel info...) is not possible. 17 | * - When some 512*512 rotated, colorized and scaled textures are rendered 18 | * at a time, the framerate *could* go under 60 fps. 19 | * 20 | * \section install Installation 21 | * 22 | * - Simply put glib2d.c and glib2d.h in your source directory. \n 23 | * - Then add glib2d.o and link "-lpng -ljpeg -lz -lpspgu -lm -lpspvram" 24 | * in your Makefile. 25 | * - You're done ! 26 | * 27 | * \section copyright License 28 | * 29 | * This work is licensed under the LGPLv3 License. \n 30 | * See the LICENSE file for more details. \n 31 | * You can support the library by marking your homebrew with 32 | * "Using gLib2D by Geecko". 33 | * 34 | * \section contact Contact 35 | * 36 | * Please report bugs or submit ideas at : \n geecko.dev@free.fr \n\n 37 | * Get the full documentation on : \n http://geecko.dev.free.fr \n\n 38 | * Also stay tuned on... \n 39 | * https://github.com/GeeckoDev (contributors would be a plus!) \n 40 | * http://twitter.com/GeeckoDev 41 | */ 42 | 43 | /** 44 | * \file glib2d.h 45 | * \brief gLib2D Header 46 | * \version Beta 5 47 | */ 48 | 49 | #ifndef GLIB2D_H 50 | #define GLIB2D_H 51 | 52 | #ifdef __cplusplus 53 | extern "C" { 54 | #endif 55 | 56 | #include 57 | 58 | /** 59 | * \def USE_PNG 60 | * \brief Choose if the PNG support is enabled. 61 | * 62 | * Otherwise, this part will be not compiled to gain some space. 63 | * Enable this to get PNG support, disable to avoid compilation errors 64 | * when libpng is not linked in the Makefile. 65 | */ 66 | /** 67 | * \def USE_JPEG 68 | * \brief Choose if the JPEG support is enabled. 69 | * 70 | * Otherwise, this part will be not compiled to gain some space. 71 | * Enable this to get JPEG support, disable to avoid compilation errors 72 | * when libjpeg is not linked in the Makefile. 73 | */ 74 | /** 75 | * \def USE_VFPU 76 | * \brief Choose if the VFPU support is enabled. 77 | * 78 | * Otherwise, this part will be not compiled to use the standard math library. 79 | * Enable this to greatly improve performance with 2d rotations. You SHOULD use 80 | * PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU) to avoid crashes. 81 | */ 82 | #define USE_PNG 83 | #define USE_JPEG 84 | //#define USE_VFPU 85 | 86 | /** 87 | * \def G2D_SCR_W 88 | * \brief Screen width constant, in pixels. 89 | */ 90 | /** 91 | * \def G2D_SCR_H 92 | * \brief Screen height constant, in pixels. 93 | */ 94 | /** 95 | * \def G2D_VOID 96 | * \brief Generic constant, equals to 0 (do nothing). 97 | */ 98 | #define G2D_SCR_W (480) 99 | #define G2D_SCR_H (272) 100 | #define G2D_VOID (0) 101 | 102 | /** 103 | * \def G2D_RGBA(r,g,b,a) 104 | * \brief Create a g2dColor. 105 | * 106 | * This macro creates a g2dColor from 4 values, red, green, blue and alpha. 107 | * Input range is from 0 to 255. 108 | */ 109 | #define G2D_RGBA(r, g, b, a) ((r)|((g)<<8)|((b)<<16)|((a)<<24)) 110 | 111 | /** 112 | * \def G2D_GET_R(color) 113 | * \brief Get red channel value from a g2dColor. 114 | */ 115 | /** 116 | * \def G2D_GET_G(color) 117 | * \brief Get green channel value from a g2dColor. 118 | */ 119 | /** 120 | * \def G2D_GET_B(color) 121 | * \brief Get blue channel value from a g2dColor. 122 | */ 123 | /** 124 | * \def G2D_GET_A(color) 125 | * \brief Get alpha channel value from a g2dColor. 126 | */ 127 | #define G2D_GET_R(color) (((color) ) & 0xFF) 128 | #define G2D_GET_G(color) (((color) >> 8) & 0xFF) 129 | #define G2D_GET_B(color) (((color) >> 16) & 0xFF) 130 | #define G2D_GET_A(color) (((color) >> 24) & 0xFF) 131 | 132 | /** 133 | * \def G2D_MODULATE(color,luminance,alpha) 134 | * \brief g2dColor modulation. 135 | * 136 | * This macro modulates the luminance & alpha of a g2dColor. 137 | * Input range is from 0 to 255. 138 | */ 139 | #define G2D_MODULATE(color,luminance,alpha) \ 140 | G2D_RGBA((int)(luminance) * G2D_GET_R(color) / 255, \ 141 | (int)(luminance) * G2D_GET_G(color) / 255, \ 142 | (int)(luminance) * G2D_GET_B(color) / 255, \ 143 | (int)(alpha ) * G2D_GET_A(color) / 255) 144 | 145 | /** 146 | * \enum g2dColors 147 | * \brief Colors enumeration. 148 | * 149 | * Primary, secondary, tertiary and grayscale colors are defined. 150 | */ 151 | enum g2dColors 152 | { 153 | // Primary colors 154 | RED = 0xFF0000FF, 155 | GREEN = 0xFF00FF00, 156 | BLUE = 0xFFFF0000, 157 | // Secondary colors 158 | CYAN = 0xFFFFFF00, 159 | MAGENTA = 0xFFFF00FF, 160 | YELLOW = 0xFF00FFFF, 161 | // Tertiary colors 162 | AZURE = 0xFFFF7F00, 163 | VIOLET = 0xFFFF007F, 164 | ROSE = 0xFF7F00FF, 165 | ORANGE = 0xFF007FFF, 166 | CHARTREUSE = 0xFF00FF7F, 167 | SPRING_GREEN = 0xFF7FFF00, 168 | // Grayscale 169 | WHITE = 0xFFFFFFFF, 170 | LITEGRAY = 0xFFBFBFBF, 171 | GRAY = 0xFF7F7F7F, 172 | DARKGRAY = 0xFF3F3F3F, 173 | BLACK = 0xFF000000 174 | }; 175 | 176 | /** 177 | * \enum g2dCoord_Mode 178 | * \brief Coordinates modes enumeration. 179 | * 180 | * Choose where the coordinates correspond in the object. 181 | * Can only be used with g2dSetCoordMode. 182 | */ 183 | /** 184 | * \enum g2dLine_Mode 185 | * \brief Line modes enumeration. 186 | * 187 | * Change line draw properties. 188 | * Can only be used with g2dBeginLines. 189 | */ 190 | /** 191 | * \enum g2dFlip_Mode 192 | * \brief Flip modes enumeration. 193 | * 194 | * Change flip properties. 195 | * Can only be used with g2dFlip. 196 | */ 197 | /** 198 | * \enum g2dTex_Mode 199 | * \brief Texture modes enumeration. 200 | * 201 | * Change texture properties. 202 | * Can only be used with g2dTexLoad. 203 | */ 204 | typedef enum 205 | { 206 | G2D_UP_LEFT, 207 | G2D_UP_RIGHT, 208 | G2D_DOWN_RIGHT, 209 | G2D_DOWN_LEFT, 210 | G2D_CENTER 211 | } g2dCoord_Mode; 212 | typedef enum 213 | { 214 | G2D_STRIP = 1 /**< Make a line strip. */ 215 | } g2dLine_Mode; 216 | typedef enum 217 | { 218 | G2D_VSYNC = 1 /**< Limit the FPS to 60 (synchronized with the screen). 219 | Better quality and less power consumption. */ 220 | } g2dFlip_Mode; 221 | typedef enum 222 | { 223 | G2D_SWIZZLE = 1 /**< Recommended. Use it to speedup rendering. */ 224 | } g2dTex_Mode; 225 | 226 | /** 227 | * \var g2dAlpha 228 | * \brief Alpha type. 229 | */ 230 | /** 231 | * \var g2dColor 232 | * \brief Color type. 233 | */ 234 | typedef int g2dAlpha; 235 | typedef unsigned int g2dColor; 236 | 237 | /** 238 | * \struct g2dTexture 239 | * \brief Texture structure. 240 | */ 241 | typedef struct 242 | { 243 | int tw; /**< Real texture width. A power of two. */ 244 | int th; /**< Real texture height. A power of two. */ 245 | int w; /**< Texture width, as seen when drawing. */ 246 | int h; /**< Texture height, as seen when drawing. */ 247 | float ratio; /**< Width/height ratio. */ 248 | bool swizzled; /**< Is the texture swizzled ? */ 249 | g2dColor *data; /**< Pointer to raw data. */ 250 | } g2dTexture; 251 | 252 | /** 253 | * \var g2d_draw_buffer 254 | * \brief The current draw buffer as a texture. 255 | */ 256 | /** 257 | * \var g2d_disp_buffer 258 | * \brief The current display buffer as a texture. 259 | */ 260 | extern g2dTexture g2d_draw_buffer; 261 | extern g2dTexture g2d_disp_buffer; 262 | 263 | /** 264 | * \brief Initializes the library. 265 | * 266 | * This function will create a GU context and setup the display buffers. 267 | * Automatically called by the other functions. 268 | */ 269 | void g2dInit(); 270 | 271 | /** 272 | * \brief Shutdowns the library. 273 | * 274 | * This function will destroy the GU context. 275 | */ 276 | void g2dTerm(); 277 | 278 | /** 279 | * \brief Clears screen & depth buffer. 280 | * @param color Screen clear color 281 | * 282 | * This function clears the screen, and clears the zbuffer if depth coordinate 283 | * is used in the loop. Will automatically init the GU if needed. 284 | */ 285 | void g2dClear(g2dColor color); 286 | 287 | /** 288 | * \brief Clears depth buffer. 289 | * 290 | * This function clears the zbuffer to zero (z range 0-65535). 291 | * Will automatically init the GU if needed. 292 | */ 293 | void g2dClearZ(); 294 | 295 | /** 296 | * \brief Begins rectangles rendering. 297 | * @param tex Pointer to a texture, pass NULL to get a colored rectangle. 298 | * 299 | * This function begins object rendering. Resets all properties. 300 | * One g2dAdd() call per object. 301 | * Only one texture can be used, but multiple objects can be rendered at a time. 302 | * g2dBegin*() / g2dEnd() couple can be called multiple times in the loop, 303 | * to render multiple textures. 304 | */ 305 | void g2dBeginRects(g2dTexture *tex); 306 | 307 | /** 308 | * \brief Begins lines rendering. 309 | * @param line_mode A g2dLine_Mode constant. 310 | * 311 | * This function begins object rendering. Calls g2dReset(). 312 | * Two g2dAdd() calls per object. 313 | * Pass G2D_LINE_STRIP to make a line strip (two calls, then one per object). 314 | */ 315 | void g2dBeginLines(g2dLine_Mode mode); 316 | 317 | /** 318 | * \brief Begins quads rendering. 319 | * @param tex Pointer to a texture, pass NULL to get a colored quad. 320 | * 321 | * This function begins object rendering. Resets all properties. 322 | * Four g2dAdd() calls per object, first for the up left corner, then clockwise. 323 | * Only one texture can be used, but multiple objects can be rendered at a time. 324 | * g2dBegin*() / g2dEnd() couple can be called multiple times in the loop, 325 | * to render multiple textures. 326 | */ 327 | void g2dBeginQuads(g2dTexture *tex); 328 | 329 | /** 330 | * \brief Begins points rendering. 331 | * 332 | * This function begins object rendering. Resets all properties. 333 | * One g2dAdd() call per object. 334 | */ 335 | void g2dBeginPoints(); 336 | 337 | /** 338 | * \brief Ends object rendering. 339 | * 340 | * This function ends object rendering. Must be called after g2dBegin*() to add 341 | * objects to the display list. Automatically adapts pspgu functionnalities 342 | * to get the best performance possible. 343 | */ 344 | void g2dEnd(); 345 | 346 | /** 347 | * \brief Resets current transformation and attribution. 348 | * 349 | * This function must be called during object rendering. 350 | * Calls g2dResetCoord(), g2dResetRotation(), g2dResetScale(), 351 | * g2dResetColor(), g2dResetAlpha(), g2dResetCrop() and g2dResetTex(). 352 | */ 353 | void g2dReset(); 354 | 355 | /** 356 | * \brief Flips the screen. 357 | * @param flip_mode A g2dFlip_Mode constant. 358 | * 359 | * This function must be called at the end of the loop. 360 | * Renders the whole display list to the draw buffer. 361 | * Inverts framebuffers to display the whole thing. 362 | */ 363 | void g2dFlip(g2dFlip_Mode mode); 364 | 365 | /** 366 | * \brief Pushes the current transformation & attribution to a new object. 367 | * 368 | * This function must be called during object rendering. 369 | */ 370 | void g2dAdd(); 371 | 372 | /** 373 | * \brief Saves the current transformation to stack. 374 | * 375 | * This function must be called during object rendering. 376 | * The stack is 64 saves high. 377 | * Use it like the OpenGL one. 378 | */ 379 | void g2dPush(); 380 | 381 | /** 382 | * \brief Restore the current transformation from stack. 383 | * 384 | * This function must be called during object rendering. 385 | * The stack is 64 saves high. 386 | * Use it like the OpenGL one. 387 | */ 388 | void g2dPop(); 389 | 390 | /** 391 | * \brief Creates a new blank texture. 392 | * @param w Width of the texture. 393 | * @param h Height of the texture. 394 | * 395 | * This function returns NULL on allocation fail. 396 | */ 397 | g2dTexture* g2dTexCreate(int w, int h); 398 | 399 | /** 400 | * \brief Frees a texture & set its pointer to NULL. 401 | * @param tex Pointer to the variable which contains the texture pointer. 402 | * 403 | * This function is used to gain memory when a texture is useless. 404 | * Must pass the pointer to the variable which contains the pointer, 405 | * to set it to NULL (passing NULL to a g2dBegin* function is safe). 406 | */ 407 | void g2dTexFree(g2dTexture **tex); 408 | 409 | /** 410 | * \brief Loads an image. 411 | * @param path Path to the file. 412 | * @param tex_mode A g2dTex_Mode constant. 413 | * @returns Pointer to the generated texture. 414 | * 415 | * This function loads an image file. There is support for PNG & JPEG files 416 | * (if USE_PNG and USE_JPEG are defined). Swizzling is enabled only for 16*16+ 417 | * textures (useless on small textures), pass G2D_SWIZZLE to enable it. 418 | * Texture supported up to 512*512 in size only (hardware limitation). 419 | */ 420 | g2dTexture* g2dTexLoad(char path[], g2dTex_Mode mode); 421 | 422 | /** 423 | * \brief Resets the current coordinates. 424 | * 425 | * This function must be called during object rendering. 426 | * Sets g2dSetCoordMode() to G2D_UP_LEFT and g2dSetCoordXYZ() to (0,0,0). 427 | */ 428 | void g2dResetCoord(); 429 | 430 | /** 431 | * \brief Set coordinate mode. 432 | * @param coord_mode A gCoord_Mode. 433 | * 434 | * This function must be called during object rendering. 435 | * Defines where the coordinates correspond in the object. 436 | */ 437 | void g2dSetCoordMode(g2dCoord_Mode mode); 438 | 439 | /** 440 | * \brief Gets the current position. 441 | * @param x Pointer to save the current x (in pixels). 442 | * @param y Pointer to save the current y (in pixels). 443 | * @param z Pointer to save the current z (in pixels). 444 | * 445 | * This function must be called during object rendering. 446 | * Parameters are pointers to float, not int ! 447 | * Pass NULL if not needed. 448 | */ 449 | void g2dGetCoordXYZ(float *x, float *y, float *z); 450 | 451 | /** 452 | * \brief Sets the new position. 453 | * @param x New x, in pixels. 454 | * @param y New y, in pixels. 455 | * 456 | * This function must be called during object rendering. 457 | */ 458 | void g2dSetCoordXY(float x, float y); 459 | 460 | /** 461 | * \brief Sets the new position, with depth support. 462 | * @param x New x, in pixels. 463 | * @param y New y, in pixels. 464 | * @param z New z, in pixels. (front 0-65535 back) 465 | * 466 | * This function must be called during object rendering. 467 | */ 468 | void g2dSetCoordXYZ(float x, float y, float z); 469 | 470 | /** 471 | * \brief Sets the new position, relative to the current. 472 | * @param x New x increment, in pixels. 473 | * @param y New y increment, in pixels. 474 | * 475 | * This function must be called during object rendering. 476 | */ 477 | void g2dSetCoordXYRelative(float x, float y); 478 | 479 | /** 480 | * \brief Sets the new position, with depth support, relative to the current. 481 | * @param x New x increment, in pixels. 482 | * @param y New y increment, in pixels. 483 | * @param z New z increment, in pixels. 484 | * 485 | * This function must be called during object rendering. 486 | */ 487 | void g2dSetCoordXYZRelative(float x, float y, float z); 488 | 489 | /** 490 | * \brief Use integer coordinates. 491 | * @param use false to desactivate (better look, by default), 492 | true to activate (can be useful when you have glitches). 493 | * 494 | * This function must be called during object rendering. 495 | */ 496 | void g2dSetCoordInteger(bool use); 497 | 498 | /** 499 | * \brief Resets the global scale. 500 | * 501 | * This function resets the global scale to 1.f. 502 | * Translations and scales are multiplied by this factor. 503 | */ 504 | void g2dResetGlobalScale(); 505 | 506 | /** 507 | * \brief Resets the current scale. 508 | * 509 | * This function must be called during object rendering. 510 | * Sets the scale to the current texture size or (10,10). 511 | */ 512 | void g2dResetScale(); 513 | 514 | /** 515 | * \brief Gets the global scale. 516 | * @param scale Pointer to save the global scale (factor). 517 | * 518 | * Pass NULL if not needed. 519 | */ 520 | void g2dGetGlobalScale(float *scale); 521 | 522 | /** 523 | * \brief Gets the current scale. 524 | * @param w Pointer to save the current width (in pixels). 525 | * @param h Pointer to save the current height (in pixels). 526 | * 527 | * This function must be called during object rendering. 528 | * Parameters are pointers to float, not int ! 529 | * Pass NULL if not needed. 530 | */ 531 | void g2dGetScaleWH(float *w, float *h); 532 | 533 | /** 534 | * \brief Sets the global scale. 535 | * 536 | * Translations and scales are multiplied by this factor. 537 | */ 538 | void g2dSetGlobalScale(float scale); 539 | 540 | /** 541 | * \brief Sets the new scale. 542 | * @param w Width scale factor. 543 | * @param h Height scale factor. 544 | * 545 | * This function must be called during object rendering. 546 | * g2dResetScale() is called, then width & height scale are 547 | * multiplied by these values. 548 | * Negative values can be passed to invert the texture. 549 | */ 550 | void g2dSetScale(float w, float h); 551 | 552 | /** 553 | * \brief Sets the new scale, in pixels. 554 | * @param w New width, in pixels. 555 | * @param h New height, in pixels. 556 | * 557 | * This function must be called during object rendering. 558 | * Negative values can be passed to invert the texture. 559 | */ 560 | void g2dSetScaleWH(float w, float h); 561 | 562 | /** 563 | * \brief Sets the new scale, relative to the current. 564 | * @param w Width scale factor. 565 | * @param h Height scale factor. 566 | * 567 | * This function must be called during object rendering. 568 | * Current width & height scale are multiplied by these values. 569 | * Negative values can be passed to invert the texture. 570 | */ 571 | void g2dSetScaleRelative(float w, float h); 572 | 573 | /** 574 | * \brief Sets the new scale, in pixels, relative to the current. 575 | * @param w New width to increment, in pixels. 576 | * @param h New height to increment, in pixels. 577 | * 578 | * This function must be called during object rendering. 579 | * Negative values can be passed to invert the texture. 580 | */ 581 | void g2dSetScaleWHRelative(float w, float h); 582 | 583 | /** 584 | * \brief Resets the current color. 585 | * 586 | * This function must be called during object rendering. 587 | * Sets g2dSetColor() to WHITE. 588 | */ 589 | void g2dResetColor(); 590 | 591 | /** 592 | * \brief Resets the current alpha. 593 | * 594 | * This function must be called during object rendering. 595 | * Sets g2dSetAlpha() to 255. 596 | */ 597 | void g2dResetAlpha(); 598 | 599 | /** 600 | * \brief Gets the current alpha. 601 | * @param alpha Pointer to save the current alpha (0-255). 602 | * 603 | * This function must be called during object rendering. 604 | * Pass NULL if not needed. 605 | */ 606 | void g2dGetAlpha(g2dAlpha *alpha); 607 | 608 | /** 609 | * \brief Sets the new color. 610 | * @param color The new color. 611 | * 612 | * This function must be called during object rendering. 613 | * Can be used to colorize any object. 614 | */ 615 | void g2dSetColor(g2dColor color); 616 | 617 | /** 618 | * \brief Sets the new alpha. 619 | * @param alpha The new alpha (0-255). 620 | * 621 | * This function must be called during object rendering. 622 | * Can be used to make any object transparent. 623 | */ 624 | void g2dSetAlpha(g2dAlpha alpha); 625 | 626 | /** 627 | * \brief Sets the new alpha, relative to the current alpha. 628 | * @param alpha The new alpha increment. 629 | * 630 | * This function must be called during object rendering. 631 | * Can be used to make any object transparent. 632 | */ 633 | void g2dSetAlphaRelative(int alpha); 634 | 635 | /** 636 | * \brief Resets the current rotation. 637 | * 638 | * This function must be called during object rendering. 639 | * Sets g2dSetRotation() to 0°. 640 | */ 641 | void g2dResetRotation(); 642 | 643 | /** 644 | * \brief Gets the current rotation, in radians. 645 | * @param radians Pointer to save the current rotation. 646 | * 647 | * This function must be called during object rendering. 648 | * Pass NULL if not needed. 649 | */ 650 | void g2dGetRotationRad(float *radians); 651 | 652 | /** 653 | * \brief Gets the current rotation, in degrees. 654 | * @param degrees Pointer to save the current rotation. 655 | * 656 | * This function must be called during object rendering. 657 | * Pass NULL if not needed. 658 | */ 659 | void g2dGetRotation(float *degrees); 660 | 661 | /** 662 | * \brief Sets the new rotation, in radians. 663 | * @param radians The new angle. 664 | * 665 | * This function must be called during object rendering. 666 | * The rotation center is the actual coordinates. 667 | */ 668 | void g2dSetRotationRad(float radians); 669 | 670 | /** 671 | * \brief Sets the new rotation, in degrees. 672 | * @param degrees The new angle. 673 | * 674 | * This function must be called during object rendering. 675 | * The rotation center is the actual coordinates. 676 | */ 677 | void g2dSetRotation(float degrees); 678 | 679 | /** 680 | * \brief Sets the new rotation, relative to the current, in radians. 681 | * @param radians The new angle increment. 682 | * 683 | * This function must be called during object rendering. 684 | * The rotation center is the actual coordinates. 685 | */ 686 | void g2dSetRotationRadRelative(float radians); 687 | 688 | /** 689 | * \brief Sets the new rotation, relative to the current, in degrees. 690 | * @param degrees The new angle increment. 691 | * 692 | * This function must be called during object rendering. 693 | * The rotation center is the actual coordinates. 694 | */ 695 | void g2dSetRotationRelative(float degrees); 696 | 697 | /** 698 | * \brief Resets the current crop. 699 | * 700 | * This function must be called during object rendering. 701 | * Sets g2dSetCropXY() to (0;0) and g2dSetCropWH() to (tex->w,tex->h). 702 | */ 703 | void g2dResetCrop(); 704 | 705 | /** 706 | * \brief Gets the current crop position. 707 | * @param x Pointer to save the current crop x. 708 | * @param y Pointer to save the current crop y. 709 | * 710 | * This function must be called during object rendering. 711 | * Pass NULL if not needed. 712 | */ 713 | void g2dGetCropXY(int *x, int *y); 714 | 715 | /** 716 | * \brief Gets the current crop scale. 717 | * @param w Pointer to save the current crop width. 718 | * @param h Pointer to save the current crop height. 719 | * 720 | * This function must be called during object rendering. 721 | * Pass NULL if not needed. 722 | */ 723 | void g2dGetCropWH(int *w, int *h); 724 | 725 | /** 726 | * \brief Sets the new crop position. 727 | * @param x New x, in pixels. 728 | * @param y New y, in pixels. 729 | * 730 | * This function must be called during object rendering. Defines crop position. 731 | * If the rectangle is larger or next to the texture, it will be repeated 732 | * when g2dSetTexRepeat is enabled. Useful for a tileset. 733 | */ 734 | void g2dSetCropXY(int x, int y); 735 | 736 | /** 737 | * \brief Sets the new crop size. 738 | * @param w New width, in pixels. 739 | * @param h New height, in pixels. 740 | * 741 | * This function must be called during object rendering. Defines crop size. 742 | * If the rectangle is larger or next to the texture, it will be repeated 743 | * when g2dSetTexRepeat is enabled. Useful for a tileset. 744 | */ 745 | void g2dSetCropWH(int w, int h); 746 | 747 | /** 748 | * \brief Sets the new crop position, relative to the current. 749 | * @param x New x increment, in pixels. 750 | * @param y New y increment, in pixels. 751 | * 752 | * This function must be called during object rendering. Defines crop position. 753 | * If the rectangle is larger or next to the texture, texture will be repeated 754 | * when g2dSetTexRepeat is enabled. Useful for a tileset. 755 | */ 756 | void g2dSetCropXYRelative(int x, int y); 757 | 758 | /** 759 | * \brief Sets the new crop size, relative to the current. 760 | * @param w New width increment, in pixels. 761 | * @param h New height increment, in pixels. 762 | * 763 | * This function must be called during object rendering. Defines crop size. 764 | * If the rectangle is larger or next to the texture, texture will be repeated 765 | * when g2dSetTexRepeat is enabled. Useful for a tileset. 766 | */ 767 | void g2dSetCropWHRelative(int w, int h); 768 | 769 | /** 770 | * \brief Resets texture properties. 771 | * 772 | * This function must be called during object rendering. 773 | */ 774 | void g2dResetTex(); 775 | 776 | /** 777 | * \brief Set texture wrap. 778 | * @param use true to repeat, false to clamp (by default). 779 | * 780 | * This function must be called during object rendering. 781 | */ 782 | void g2dSetTexRepeat(bool use); 783 | 784 | /** 785 | * \brief Use the bilinear filter with the texture. 786 | * @param use true to activate (better look, by default). 787 | false to desactivate (better performance). 788 | * 789 | * This function must be called during object rendering. 790 | * Only useful when scaling. 791 | */ 792 | void g2dSetTexLinear(bool use); 793 | 794 | /** 795 | * \brief Resets the draw zone to the entire screen. 796 | * 797 | * This function can be called everywhere in the loop. 798 | */ 799 | void g2dResetScissor(); 800 | 801 | /** 802 | * \brief Sets the draw zone. 803 | * @param x New x position. 804 | * @param y New y position. 805 | * @param w New width. 806 | * @param h New height. 807 | * 808 | * This function can be called everywhere in the loop. 809 | * Pixel draw will be skipped outside this rectangle. 810 | */ 811 | void g2dSetScissor(int x, int y, int w, int h); 812 | 813 | #ifdef __cplusplus 814 | } 815 | #endif 816 | 817 | #endif 818 | -------------------------------------------------------------------------------- /sample/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | make -C clock 3 | make -C coordinates 4 | make -C deform 5 | make -C depth 6 | make -C objcontrol 7 | make -C screensaver 8 | make -C transform 9 | 10 | clean: 11 | make -C clock clean 12 | make -C coordinates clean 13 | make -C deform clean 14 | make -C depth clean 15 | make -C objcontrol clean 16 | make -C screensaver clean 17 | make -C transform clean 18 | 19 | install: 20 | make -C clock install 21 | make -C coordinates install 22 | make -C deform install 23 | make -C depth install 24 | make -C objcontrol install 25 | make -C screensaver install 26 | make -C transform install 27 | -------------------------------------------------------------------------------- /sample/callbacks.h: -------------------------------------------------------------------------------- 1 | #ifndef __CALLBACKS_H__ 2 | #define __CALLBACKS_H__ 3 | 4 | #include 5 | 6 | int callbacks_exit() 7 | { 8 | sceKernelExitGame(); 9 | 10 | return 0; 11 | } 12 | 13 | int callbacks_thread() 14 | { 15 | int id; 16 | 17 | id = sceKernelCreateCallback("exit_cb", callbacks_exit, NULL); 18 | sceKernelRegisterExitCallback(id); 19 | sceKernelSleepThreadCB(); 20 | 21 | return 0; 22 | } 23 | 24 | int callbacks_setup() 25 | { 26 | int id; 27 | 28 | id = sceKernelCreateThread("cb", callbacks_thread, 0x11, 0xFA0, 0, NULL); 29 | 30 | if (id >= 0) 31 | { 32 | sceKernelStartThread(id, 0, NULL); 33 | } 34 | 35 | return id; 36 | } 37 | 38 | #endif // __CALLBACKS_H__ 39 | -------------------------------------------------------------------------------- /sample/clock/Makefile: -------------------------------------------------------------------------------- 1 | MEDIA = /media/PANDORA/psp/game/CAT_Homebrews\ perso/ 2 | TARGET = gLib2D-clock 3 | 4 | OBJS = main.o ../../glib2d.o 5 | LIBS = -ljpeg -lpng -lz -lpspgum -lpspgu -lpsprtc -lm -lpspvram 6 | 7 | CFLAGS = -O2 -G0 -Wall 8 | CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti 9 | ASFLAGS = $(CFLAGS) 10 | 11 | EXTRA_TARGETS = EBOOT.PBP 12 | PSP_EBOOT_TITLE = gLib2D sample - clock 13 | 14 | PSPSDK=$(shell psp-config --pspsdk-path) 15 | include $(PSPSDK)/lib/build.mak 16 | install: 17 | cp ./EBOOT.PBP $(MEDIA)$(TARGET) 18 | dir: 19 | mkdir $(MEDIA)$(TARGET) 20 | lclean: 21 | rm *.o 22 | -------------------------------------------------------------------------------- /sample/clock/main.c: -------------------------------------------------------------------------------- 1 | // A simple clock (using lines). 2 | 3 | #include 4 | #include 5 | #include "../../glib2d.h" 6 | #include "../callbacks.h" 7 | 8 | PSP_MODULE_INFO("App",0,1,1); 9 | PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU); 10 | 11 | pspTime time; 12 | 13 | void drawBorder() // A circle. 14 | { 15 | int i, n = 42; 16 | float size = 80.f; 17 | 18 | g2dBeginLines(G2D_STRIP); 19 | 20 | g2dSetCoordXY(G2D_SCR_W/2,G2D_SCR_H/2); 21 | g2dSetColor(LITEGRAY); 22 | 23 | for (i=0; i!=n+1; i++) 24 | { 25 | g2dPush(); 26 | g2dSetCoordXYRelative(0.f,-size); 27 | g2dAdd(); 28 | g2dPop(); 29 | 30 | g2dSetRotationRelative(360.f/n); 31 | } 32 | 33 | g2dEnd(); 34 | } 35 | 36 | 37 | void drawClockHands() 38 | { 39 | g2dBeginLines(G2D_VOID); 40 | 41 | g2dSetCoordXY(G2D_SCR_W/2,G2D_SCR_H/2); 42 | 43 | // Hours 44 | g2dPush(); 45 | g2dSetColor(BLACK); 46 | g2dSetRotation((time.hour%12+ 47 | time.minutes/60.f+ 48 | time.seconds/3600.f)*360.f/12.f); 49 | g2dAdd(); 50 | g2dSetCoordXYRelative(0.f,-30.f); 51 | g2dAdd(); 52 | g2dPop(); 53 | 54 | // Minutes 55 | g2dPush(); 56 | g2dSetColor(BLACK); 57 | g2dSetRotation((time.minutes+ 58 | time.seconds/60.f)*360.f/60.f); 59 | g2dAdd(); 60 | g2dSetCoordXYRelative(0.f,-70.f); 61 | g2dAdd(); 62 | g2dPop(); 63 | 64 | // Seconds 65 | g2dPush(); 66 | g2dSetColor(RED); 67 | g2dSetAlpha(255); 68 | g2dSetRotation(time.seconds*360.f/60.f); 69 | g2dAdd(); 70 | g2dSetCoordXYRelative(0.f,-70.f); 71 | g2dSetAlpha(100); 72 | g2dAdd(); 73 | g2dPop(); 74 | 75 | g2dEnd(); 76 | } 77 | 78 | 79 | int main() 80 | { 81 | callbacks_setup(); 82 | 83 | while (1) 84 | { 85 | sceRtcGetCurrentClockLocalTime(&time); 86 | 87 | g2dClear(WHITE); 88 | 89 | drawBorder(); 90 | drawClockHands(); 91 | 92 | g2dFlip(G2D_VSYNC); 93 | } 94 | 95 | sceKernelExitGame(); 96 | return 0; 97 | } 98 | -------------------------------------------------------------------------------- /sample/coordinates/Makefile: -------------------------------------------------------------------------------- 1 | MEDIA = /media/PANDORA/psp/game/CAT_Homebrews\ perso/ 2 | TARGET = gLib2D-coordinates 3 | 4 | OBJS = main.o ../../glib2d.o 5 | LIBS = -ljpeg -lpng -lz -lpspgum -lpspgu -lpsprtc -lm -lpspvram 6 | 7 | CFLAGS = -O2 -G0 -Wall 8 | CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti 9 | ASFLAGS = $(CFLAGS) 10 | 11 | EXTRA_TARGETS = EBOOT.PBP 12 | PSP_EBOOT_TITLE = gLib2D sample - coordinates 13 | 14 | PSPSDK=$(shell psp-config --pspsdk-path) 15 | include $(PSPSDK)/lib/build.mak 16 | install: 17 | cp ./EBOOT.PBP $(MEDIA)$(TARGET) 18 | dir: 19 | mkdir $(MEDIA)$(TARGET) 20 | lclean: 21 | rm *.o 22 | -------------------------------------------------------------------------------- /sample/coordinates/main.c: -------------------------------------------------------------------------------- 1 | // gSetCoordMode use. 2 | // The rotation center is coordinates passed to gSetCoord*. 3 | 4 | #include 5 | #include "../../glib2d.h" 6 | #include "../callbacks.h" 7 | 8 | PSP_MODULE_INFO("App",0,1,1); 9 | PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU); 10 | 11 | int main() 12 | { 13 | callbacks_setup(); 14 | int rot = 0; 15 | 16 | while (1) 17 | { 18 | if ((rot++) > 360) rot -= 360; 19 | 20 | g2dClear(WHITE); 21 | 22 | g2dBeginRects(NULL); 23 | g2dSetScaleWH(42,42); 24 | g2dSetColor(RED); 25 | 26 | g2dSetCoordMode(G2D_UP_LEFT); 27 | g2dSetCoordXY(0,0); 28 | g2dSetRotation(rot); 29 | g2dAdd(); 30 | 31 | g2dSetCoordMode(G2D_UP_RIGHT); 32 | g2dSetCoordXY(G2D_SCR_W,0); 33 | g2dSetRotation(-rot); 34 | g2dAdd(); 35 | 36 | g2dSetCoordMode(G2D_DOWN_RIGHT); 37 | g2dSetCoordXY(G2D_SCR_W,G2D_SCR_H); 38 | g2dSetRotation(rot); 39 | g2dAdd(); 40 | 41 | g2dSetCoordMode(G2D_DOWN_LEFT); 42 | g2dSetCoordXY(0,G2D_SCR_H); 43 | g2dSetRotation(-rot); 44 | g2dAdd(); 45 | 46 | g2dSetCoordMode(G2D_CENTER); 47 | g2dSetCoordXY(G2D_SCR_W/2,G2D_SCR_H/2); 48 | g2dSetRotation(rot); 49 | g2dAdd(); 50 | 51 | g2dEnd(); 52 | 53 | g2dFlip(G2D_VSYNC); 54 | } 55 | 56 | sceKernelExitGame(); 57 | return 0; 58 | } 59 | -------------------------------------------------------------------------------- /sample/deform/Makefile: -------------------------------------------------------------------------------- 1 | MEDIA = /media/PANDORA/psp/game/CAT_Homebrews\ perso/ 2 | TARGET = gLib2D-deform 3 | 4 | OBJS = main.o ../../glib2d.o 5 | LIBS = -ljpeg -lpng -lz -lpspgum -lpspgu -lpsprtc -lm -lpspvram 6 | 7 | CFLAGS = -O2 -G0 -Wall 8 | CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti 9 | ASFLAGS = $(CFLAGS) 10 | 11 | EXTRA_TARGETS = EBOOT.PBP 12 | PSP_EBOOT_TITLE = gLib2D sample - deform 13 | 14 | PSPSDK=$(shell psp-config --pspsdk-path) 15 | include $(PSPSDK)/lib/build.mak 16 | install: 17 | cp ./EBOOT.PBP $(MEDIA)$(TARGET) 18 | dir: 19 | mkdir $(MEDIA)$(TARGET) 20 | lclean: 21 | rm *.o 22 | -------------------------------------------------------------------------------- /sample/deform/main.c: -------------------------------------------------------------------------------- 1 | // Quads and lines use. 2 | 3 | #include 4 | #include "../../glib2d.h" 5 | #include "../callbacks.h" 6 | 7 | PSP_MODULE_INFO("App",0,1,1); 8 | PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU); 9 | 10 | int main() 11 | { 12 | callbacks_setup(); 13 | int rot = 0; 14 | 15 | while (1) 16 | { 17 | if ((rot++) > 360) rot -= 360; 18 | 19 | g2dClear(WHITE); 20 | 21 | // Draw the quad 22 | 23 | g2dBeginQuads(NULL); // Can be also textured 24 | 25 | g2dSetColor(RED); 26 | g2dSetCoordXY(1*G2D_SCR_W/4,1*G2D_SCR_H/4); 27 | g2dPush(); 28 | g2dSetRotation(rot); 29 | g2dSetCoordXYRelative(45,0); 30 | g2dAdd(); 31 | g2dPop(); 32 | 33 | g2dSetColor(GREEN); 34 | g2dSetCoordXY(3*G2D_SCR_W/4,1*G2D_SCR_H/4); 35 | g2dPush(); 36 | g2dSetRotation(2.f*rot); 37 | g2dSetCoordXYRelative(55,0); 38 | g2dAdd(); 39 | g2dPop(); 40 | 41 | g2dSetColor(BLUE); 42 | g2dSetCoordXY(3*G2D_SCR_W/4,3*G2D_SCR_H/4); 43 | g2dPush(); 44 | g2dSetRotation(-rot); 45 | g2dSetCoordXYRelative(23,0); 46 | g2dAdd(); 47 | g2dPop(); 48 | 49 | g2dSetColor(BLACK); 50 | g2dSetCoordXY(1*G2D_SCR_W/4,3*G2D_SCR_H/4); 51 | g2dPush(); 52 | g2dSetRotation(-3.f*rot); 53 | g2dSetCoordXYRelative(30,0); 54 | g2dAdd(); 55 | g2dPop(); 56 | 57 | g2dEnd(); 58 | 59 | // Then the rotating lines. 60 | 61 | g2dBeginLines(G2D_VOID); 62 | g2dSetColor(GRAY); 63 | 64 | g2dSetCoordXY(1*G2D_SCR_W/4,1*G2D_SCR_H/4); 65 | g2dAdd(); 66 | g2dPush(); 67 | g2dSetRotation(rot); 68 | g2dSetCoordXYRelative(45,0); 69 | g2dAdd(); 70 | g2dPop(); 71 | 72 | g2dSetCoordXY(3*G2D_SCR_W/4,1*G2D_SCR_H/4); 73 | g2dAdd(); 74 | g2dPush(); 75 | g2dSetRotation(2.f*rot); 76 | g2dSetCoordXYRelative(55,0); 77 | g2dAdd(); 78 | g2dPop(); 79 | 80 | g2dSetCoordXY(3*G2D_SCR_W/4,3*G2D_SCR_H/4); 81 | g2dAdd(); 82 | g2dPush(); 83 | g2dSetRotation(-rot); 84 | g2dSetCoordXYRelative(23,0); 85 | g2dAdd(); 86 | g2dPop(); 87 | 88 | g2dSetCoordXY(1*G2D_SCR_W/4,3*G2D_SCR_H/4); 89 | g2dAdd(); 90 | g2dPush(); 91 | g2dSetRotation(-3.f*rot); 92 | g2dSetCoordXYRelative(30,0); 93 | g2dAdd(); 94 | g2dPop(); 95 | 96 | g2dEnd(); 97 | 98 | g2dFlip(G2D_VSYNC); 99 | } 100 | 101 | sceKernelExitGame(); 102 | return 0; 103 | } 104 | -------------------------------------------------------------------------------- /sample/depth/Makefile: -------------------------------------------------------------------------------- 1 | MEDIA = /media/PANDORA/psp/game/CAT_Homebrews\ perso/ 2 | TARGET = gLib2D-depth 3 | 4 | OBJS = main.o ../../glib2d.o 5 | LIBS = -ljpeg -lpng -lz -lpspgum -lpspgu -lpsprtc -lm -lpspvram 6 | 7 | CFLAGS = -O2 -G0 -Wall 8 | CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti 9 | ASFLAGS = $(CFLAGS) 10 | 11 | EXTRA_TARGETS = EBOOT.PBP 12 | PSP_EBOOT_TITLE = gLib2D sample - depth 13 | 14 | PSPSDK=$(shell psp-config --pspsdk-path) 15 | include $(PSPSDK)/lib/build.mak 16 | install: 17 | cp ./EBOOT.PBP $(MEDIA)$(TARGET) 18 | dir: 19 | mkdir $(MEDIA)$(TARGET) 20 | lclean: 21 | rm *.o 22 | -------------------------------------------------------------------------------- /sample/depth/main.c: -------------------------------------------------------------------------------- 1 | // Zbuffer use. 2 | // Z range : nearest 0 - 65535 farest 3 | // Objects are automatically sorted to have a proper rendering with blending. 4 | 5 | #include 6 | #include "../../glib2d.h" 7 | #include "../callbacks.h" 8 | 9 | PSP_MODULE_INFO("App",0,1,1); 10 | PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU); 11 | 12 | int main() 13 | { 14 | callbacks_setup(); 15 | 16 | while (1) 17 | { 18 | g2dClear(BLACK); // Clears zbuffer since Z coordinate is used in the loop 19 | 20 | g2dBeginRects(NULL); 21 | 22 | g2dSetColor(AZURE); 23 | g2dSetAlpha(255); 24 | g2dSetScaleWH(50,50); 25 | g2dSetCoordXYZ(195,50,0); 26 | g2dAdd(); 27 | 28 | g2dSetColor(CHARTREUSE); 29 | g2dSetAlpha(200); 30 | g2dSetScaleWH(200,100); 31 | g2dSetCoordXYZ(20,20,0); 32 | g2dAdd(); 33 | 34 | g2dSetColor(0xFFDDEEFF); 35 | g2dSetAlpha(127); 36 | g2dSetScaleWH(100,67); 37 | g2dSetCoordXYZ(170,60,1); 38 | g2dAdd(); 39 | 40 | g2dEnd(); 41 | 42 | g2dFlip(G2D_VSYNC); 43 | } 44 | 45 | sceKernelExitGame(); 46 | return 0; 47 | } 48 | -------------------------------------------------------------------------------- /sample/objcontrol/Makefile: -------------------------------------------------------------------------------- 1 | MEDIA = /media/PANDORA/psp/game/CAT_Homebrews\ perso/ 2 | TARGET = gLib2D-objcontrol 3 | 4 | OBJS = main.o ../../glib2d.o 5 | LIBS = -ljpeg -lpng -lz -lpspgum -lpspgu -lpsprtc -lm -lpspvram 6 | 7 | CFLAGS = -O2 -G0 -Wall -g 8 | CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti 9 | ASFLAGS = $(CFLAGS) 10 | 11 | EXTRA_TARGETS = EBOOT.PBP 12 | PSP_EBOOT_TITLE = gLib2D sample - objcontrol 13 | 14 | PSPSDK=$(shell psp-config --pspsdk-path) 15 | include $(PSPSDK)/lib/build.mak 16 | install: 17 | cp ./EBOOT.PBP $(MEDIA)$(TARGET) 18 | dir: 19 | mkdir $(MEDIA)$(TARGET) 20 | lclean: 21 | rm *.o 22 | -------------------------------------------------------------------------------- /sample/objcontrol/main.c: -------------------------------------------------------------------------------- 1 | // Control object properties. 2 | 3 | #include 4 | #include 5 | #include "../../glib2d.h" 6 | #include "../callbacks.h" 7 | 8 | PSP_MODULE_INFO("App",0,1,1); 9 | PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU); 10 | 11 | int main() 12 | { 13 | callbacks_setup(); 14 | 15 | SceCtrlData pad; 16 | g2dTexture* tex = g2dTexLoad("tex.png",G2D_SWIZZLE); 17 | int alpha = 255, 18 | x = G2D_SCR_W/2, 19 | y = G2D_SCR_H/2, 20 | w = (tex == NULL ? 10 : tex->w), 21 | h = (tex == NULL ? 10 : tex->h), 22 | rot = 0; 23 | 24 | while (1) 25 | { 26 | // Controls 27 | sceCtrlPeekBufferPositive(&pad,1); 28 | if (pad.Buttons & PSP_CTRL_SELECT) alpha-=2; 29 | if (pad.Buttons & PSP_CTRL_START) alpha+=2; 30 | if (pad.Buttons & PSP_CTRL_LEFT) x-=2; 31 | if (pad.Buttons & PSP_CTRL_RIGHT) x+=2; 32 | if (pad.Buttons & PSP_CTRL_UP) y-=2; 33 | if (pad.Buttons & PSP_CTRL_DOWN) y+=2; 34 | if (pad.Buttons & PSP_CTRL_SQUARE) w--; 35 | if (pad.Buttons & PSP_CTRL_CIRCLE) w++; 36 | if (pad.Buttons & PSP_CTRL_TRIANGLE) h--; 37 | if (pad.Buttons & PSP_CTRL_CROSS) h++; 38 | if (pad.Buttons & PSP_CTRL_LTRIGGER) rot-=2; 39 | if (pad.Buttons & PSP_CTRL_RTRIGGER) rot+=2; 40 | 41 | // Display 42 | g2dClear(WHITE); 43 | 44 | g2dBeginRects(tex); 45 | if (tex == NULL) g2dSetColor(RED); 46 | g2dSetCoordMode(G2D_CENTER); 47 | g2dSetAlpha(alpha); 48 | g2dSetScaleWH(w,h); 49 | g2dSetCoordXY(x,y); 50 | g2dSetRotation(rot); 51 | g2dAdd(); 52 | g2dEnd(); 53 | 54 | g2dFlip(G2D_VSYNC); 55 | } 56 | 57 | sceKernelExitGame(); 58 | return 0; 59 | } 60 | -------------------------------------------------------------------------------- /sample/objcontrol/tex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libcg/gLib2D/c347d4d227ca7f4d120643c63ed9b04a4afdd01e/sample/objcontrol/tex.png -------------------------------------------------------------------------------- /sample/screensaver/Makefile: -------------------------------------------------------------------------------- 1 | MEDIA = /media/PANDORA/psp/game/CAT_Homebrews\ perso/ 2 | TARGET = gLib2D-screensaver 3 | 4 | OBJS = main.o ../../glib2d.o 5 | LIBS = -ljpeg -lpng -lz -lpspgum -lpspgu -lpsprtc -lm -lpspvram 6 | 7 | CFLAGS = -O2 -G0 -Wall 8 | CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti 9 | ASFLAGS = $(CFLAGS) 10 | 11 | EXTRA_TARGETS = EBOOT.PBP 12 | PSP_EBOOT_TITLE = gLib2D sample - screensaver 13 | 14 | PSPSDK=$(shell psp-config --pspsdk-path) 15 | include $(PSPSDK)/lib/build.mak 16 | install: 17 | cp ./EBOOT.PBP $(MEDIA)$(TARGET) 18 | dir: 19 | mkdir $(MEDIA)$(TARGET) 20 | lclean: 21 | rm *.o 22 | -------------------------------------------------------------------------------- /sample/screensaver/main.c: -------------------------------------------------------------------------------- 1 | // The famous DVD screensaver. 2 | 3 | #include 4 | #include "../../glib2d.h" 5 | #include "../callbacks.h" 6 | 7 | PSP_MODULE_INFO("App",0,1,1); 8 | PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU); 9 | 10 | int main() 11 | { 12 | callbacks_setup(); 13 | 14 | int size = 42, x=0, y=0, dx=2, dy=2; 15 | 16 | while (1) 17 | { 18 | x += dx; 19 | y += dy; 20 | if (x < 0 || x+size > G2D_SCR_W) dx = -dx; 21 | if (y < 0 || y+size > G2D_SCR_H) dy = -dy; 22 | 23 | g2dClear(WHITE); 24 | 25 | g2dBeginRects(NULL); // No texture 26 | g2dSetColor(AZURE); 27 | g2dSetScaleWH(size,size); 28 | g2dSetCoordXY(x,y); 29 | g2dSetAlpha(x*255/G2D_SCR_W); // Useless alpha effect ;) 30 | g2dAdd(); 31 | g2dEnd(); 32 | 33 | g2dFlip(G2D_VSYNC); 34 | } 35 | 36 | sceKernelExitGame(); 37 | return 0; 38 | } 39 | -------------------------------------------------------------------------------- /sample/transform/Makefile: -------------------------------------------------------------------------------- 1 | MEDIA = /media/PANDORA/psp/game/CAT_Homebrews\ perso/ 2 | TARGET = gLib2D-transform 3 | 4 | OBJS = main.o ../../glib2d.o 5 | LIBS = -ljpeg -lpng -lz -lpspgum -lpspgu -lpsprtc -lm -lpspvram 6 | 7 | CFLAGS = -O2 -G0 -Wall 8 | CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti 9 | ASFLAGS = $(CFLAGS) 10 | 11 | EXTRA_TARGETS = EBOOT.PBP 12 | PSP_EBOOT_TITLE = gLib2D sample - transform 13 | 14 | PSPSDK=$(shell psp-config --pspsdk-path) 15 | include $(PSPSDK)/lib/build.mak 16 | install: 17 | cp ./EBOOT.PBP $(MEDIA)$(TARGET) 18 | dir: 19 | mkdir $(MEDIA)$(TARGET) 20 | lclean: 21 | rm *.o 22 | -------------------------------------------------------------------------------- /sample/transform/main.c: -------------------------------------------------------------------------------- 1 | // OpenGL-like transformations. 2 | // gPush saves the current transformation (position/rotation/scale) to the stack 3 | // gPop reads the current transformation from the stack 4 | 5 | #include 6 | #include "../../glib2d.h" 7 | #include "../callbacks.h" 8 | 9 | PSP_MODULE_INFO("App",0,1,1); 10 | PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU); 11 | 12 | int main() 13 | { 14 | callbacks_setup(); 15 | int rot = 0, i, branches = 4; 16 | 17 | while (1) 18 | { 19 | if ((rot++) > 360) rot -= 360; 20 | 21 | g2dClear(WHITE); 22 | 23 | g2dBeginRects(NULL); 24 | 25 | g2dSetScaleWH(15,15); 26 | g2dSetCoordMode(G2D_CENTER); 27 | g2dSetCoordXY(G2D_SCR_W/2,G2D_SCR_H/2); 28 | g2dSetRotation(rot); 29 | g2dSetColor(AZURE); 30 | g2dAdd(); 31 | g2dSetRotation(-rot); 32 | 33 | for (i=0; i!=branches; i++) 34 | { 35 | g2dPush(); 36 | g2dSetAlpha(200); 37 | g2dSetCoordXYRelative(30,0); 38 | g2dAdd(); 39 | 40 | g2dPush(); 41 | g2dSetAlpha(127); 42 | g2dSetCoordXYRelative(30,-10); 43 | g2dAdd(); 44 | 45 | g2dPop(); 46 | g2dSetScaleWH(5,5); 47 | g2dSetCoordXYRelative(30,10); 48 | g2dAdd(); 49 | 50 | g2dPop(); 51 | g2dSetRotationRelative(360/branches); 52 | } 53 | 54 | g2dEnd(); 55 | 56 | g2dFlip(G2D_VSYNC); 57 | } 58 | 59 | sceKernelExitGame(); 60 | return 0; 61 | } 62 | --------------------------------------------------------------------------------