Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
LoganDark

Efficient way of drawing syntax highlighting

Question

I'm working on a new text editor (from scratch) that will do syntax highlighting on Lua code. I have a proper lexer all ready to go and I'm ready to start on the actual application, but I don't want to skimp on one of the best features: syntax highlighting!

I'm looking for a quick and efficient way of drawing syntax highlighting, aka multicolored text. I'm not sure if there's anything more efficient than gpu.setForeground then gpu.set repeatedly, but if there is, I'd like to know! And if there isn't, I'd also like to know.

Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

The most efficient way that I know of would probably be double buffering. (The reason for that being the fact that direct GPU calls like set or setForeground take a certain amount of time depending on the tier and a good double buffering API has an algorithm that minimizes the amount of GPU calls)

On the other hand I don't know if that's actually necessary for a text editor.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.