Skip to content
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

setting text color? #4

Open
PhilMo6 opened this issue Nov 3, 2020 · 6 comments
Open

setting text color? #4

PhilMo6 opened this issue Nov 3, 2020 · 6 comments

Comments

@PhilMo6
Copy link

PhilMo6 commented Nov 3, 2020

Im working on making a twitch chat overlay with luapower and so far its been easy going but I cannot seem to figure out how to set color of text at all. Background color of the main window is fairly easy but otherwise iv had no luck...

@capr
Copy link
Member

capr commented Nov 3, 2020

Hi,

What library are you using for rendering text?

@PhilMo6
Copy link
Author

PhilMo6 commented Nov 3, 2020

Honestly I was just using winapi.Label, might not be possable to change text color using this from what I can see. The tr0 library might be better for my needs. I should probably sleep more, it helps when trying to figure stuff out!

@capr
Copy link
Member

capr commented Nov 3, 2020

Make sure to check on the lib's status before using it. Many libs in here are quite low level and some are not even finished. Generally speaking, you need to know what you're doing and understand the trade-offs of different approaches (eg. doing your own text rendering vs using WinAPI, etc).

@PhilMo6
Copy link
Author

PhilMo6 commented Nov 3, 2020 via email

@PhilMo6
Copy link
Author

PhilMo6 commented Nov 10, 2020

So using ui0 iv gotten things working but now I am trying to use a text tree to have better control over text coloration. I'm having an issue when I update the content of the scrollbox that's my main chat layer. I'm trying to just set the contents text with the updated text tree to cause it to rebuild the text the segments its actually drawing. If I replace it with a string it works fine but if I replace the contents text with the updated text tree it throws an Assertion failed! message and crashes.
I'm hoping that I am just failing figure out how I am actually supposed to update the text tree of the scrollbox contents.

The important part of the error is

D:\gcc-lua\luapower\bin\mingw64....\utf8.lua:44: attempt to compare number with nil
stack traceback:
D:\gcc-lua\luapower\bin\mingw64....\utf8.lua:44: in function 'next'
D:\gcc-lua\luapower\bin\mingw64....\utf8.lua:139: in function 'decode'
D:\gcc-lua\luapower\bin\mingw64....\tr0.lua:1948: in function 'insert'
D:\gcc-lua\luapower\bin\mingw64....\tr0.lua:2015: in function 'replace'
.\ui0.lua:4214: in function 'set'
D:\gcc-lua\luapower\bin\mingw64....\oo.lua:113: in function '__newindex'
main.lua:194: in function 'updateChatbox'
main.lua:430: in function main.lua:419

My code is here if you want to check it out. The error happens when I update the chat window so you just enter some text into the edit box.
https://github.com/PhilMo6/TwitchChatOverlay

@PhilMo6
Copy link
Author

PhilMo6 commented Nov 11, 2020

Ah figured it out!
Had to do
chatBoxContent._text = false
chatBoxContent._text_tree = false
chatBoxContent.text_segments = false
first. Now it works perfect!
Gotta say its been rather easy to work with for the most part so thanks for all the effort you have put into this project!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants