-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add text rendering functionality with custom font support #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
ae2de0b
feat: add text rendering functionality with custom font support
burdockcascade b0a3971
add QuickJS header inclusion for enhanced scripting support
burdockcascade 2bdf864
feat: improve font loading error handling with detailed messages
burdockcascade 1d06a58
feat: enhance text rendering by improving string conversion and memor…
burdockcascade 7bd56be
fix: correct application initialization parameters for proper window …
burdockcascade 8834b9a
fix: adjust screen dimensions and update font path for improved asset…
burdockcascade 3c22f83
feat: add Font class and TextOptions interface for enhanced text rend…
burdockcascade 6287dcd
fix: remove unused Rectangle import from text.js
burdockcascade 16e67f9
fix: update fps position and origin values for better alignment and r…
burdockcascade ed41346
fix: update property retrieval methods for improved type handling in …
burdockcascade 4e7662a
fix: remove unused vector import from js_types.hpp
burdockcascade 6f0588e
fix: optimize text rendering by reusing CString for DrawTextPro
burdockcascade File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import {Application, Vector2, Palette, Font} from "vectorjs"; | ||
|
|
||
| const screenWidth = 800; | ||
| const screenHeight = 600; | ||
| const fpsPos = new Vector2(screenWidth/2, screenHeight/2); | ||
| const origin = new Vector2(1, 1) | ||
|
|
||
| const app = new Application(screenWidth, screenHeight,"Window"); | ||
| app.run({ | ||
|
|
||
| onInit() { | ||
| this.customFont = new Font("examples/assets/AnonymousPro-Regular.ttf"); | ||
| }, | ||
|
|
||
| onDraw(render) { | ||
| render.withLayer2D((ctx) => { | ||
| ctx.text.drawText(fpsPos, "this is a sample text", { | ||
| font: this.customFont, | ||
| color: Palette.RED, | ||
| fontSize: 24.0, | ||
| spacing: 2.0, | ||
| rotation: 25.0, | ||
| origin: origin | ||
| }) | ||
| }); | ||
| } | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.