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

Archived

This topic is now archived and is closed to further replies.

  • 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.

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

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.

Share this post


Link to post
Share on other sites

I think Piorjade makes a good point about double buffering, the only things I would add are to abuse GPU.copy, and to batch color setting calls as much as possible.

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

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