Skip to content

Improve text class - #18

Merged
dogo merged 1 commit into
masterfrom
refactor/text-class
Jul 23, 2024
Merged

Improve text class#18
dogo merged 1 commit into
masterfrom
refactor/text-class

Conversation

@dogo

@dogo dogo commented Jul 23, 2024

Copy link
Copy Markdown
Owner

Summary of Changes

  1. Function Enhancements:

    • oslLoadAltIntraFontFile:

      • Added checks to ensure the font is of type OSL_FONT_INTRA before proceeding.
      • Updated intraFontSetStyle and intraFontSetAltFont to handle alternative fonts properly.
    • oslDeleteFont:

      • Added null checks and improved resource cleanup by ensuring all dynamically allocated resources are freed properly.
    • oslDrawTextTileBack:

      • Updated to use sceGuDrawArray for rendering text background tiles with improved handling for texturing states.
    • oslSetTextColor and oslSetBkColor:

      • Simplified functions to set text and background colors.
    • oslGetStringWidth:

      • Added type checks to handle different font types (OSL_FONT_OFT and OSL_FONT_INTRA).
      • Calculated string width based on font type, utilizing either charWidths or intraFontMeasureText.
    • oslGetTextBoxHeight:

      • Added checks for font type and adjusted logic to handle text wrapping and height calculation based on font metrics.
    • oslIntraFontSetStyle:

      • Updated to handle alternative fonts and apply styles correctly.
    • oslIntraFontPrintColumn:

      • Adjusted y-coordinate to center text properly and used intraFontPrintColumn for rendering.
    • oslIntraFontInit and oslIntraFontShutdown:

      • Added functions to initialize and shut down IntraFont with appropriate options.
    • oslConsolePrint:

      • Improved handling of console text drawing, including scrolling and memory management.
    • oslInitConsole:

      • Added initialization for the console font and cleared the console.
    • oslMoveMem:

      • Implemented a memory-moving function for efficient buffer handling.
    • oslDrawTextBoxByWords:

      • Renamed contaCaratteri to charCount for clarity.
      • Improved word wrapping and line-breaking logic.
    • oslDrawTextBox:

      • Added checks for font type and improved text wrapping and line-breaking.
    • oslDrawStringLimited and oslDrawString:

      • Added checks for font type and adjusted drawing logic for both limited and unrestricted text rendering.
    • oslDrawChar:

      • Added handling for different font types and updated text rendering logic.
    • oslDrawTextTile:

      • Enhanced the tile drawing function to handle texturing and color blending.
    • oslLoadFont:

      • Added initialization of the OSL_FONT structure.
      • Improved resource management with proper cleanup of dynamically allocated memory.
      • Updated character positioning and palette handling.
      • Included comments for better code understanding and maintenance.
  2. Code Quality Improvements:

    • Added detailed comments and improved code readability.
    • Enhanced error checking and resource management.
    • Improved handling of different font types and formats.
    • Ensured consistency in variable naming and function formatting.

Add vscode properties
@dogo
dogo merged commit 4cd1bb5 into master Jul 23, 2024
@dogo
dogo deleted the refactor/text-class branch July 23, 2024 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant