Comments (8)
Investigating this weird bug...
from gf.
I cannot reproduce your bug. I created a test case in tests/bugs/bug6.cc
(in the develop
branch) and it displays a gray text as expected. Could you give me a piece of code that does not work?
from gf.
This is my function to store a Color in a gf::Color4u :
m_mainMenuLabel.setColor(gf::Color::Grey(0.5f));
and this is my function to render the final text on screen :
void Label::render(gf::RenderTarget &target) {
gf::Text text(m_text, m_font, m_characterSize);
text.setPosition(m_position);
text.setColor(m_color);
target.draw(text);
}
from gf.
I found that using gf::Color::Grey()
with a gf::Color4u
isn't working.
from gf.
Your bug is here. You should use gf::Color4f
and not gf::Color4u
. When you assign a gray color to a gf::Color4u
, there is an implicit conversion from float
to uint8_t
which results in 0.5f being 1 (or 0). And then, when you use it in setColor
, there is another conversion from uint8_t
to float
so 1.0f (or 0.0f) which results in white or black.
from gf.
So to store a Grey value in a gf::Color4u, values should looks like { 150, 150, 150, 255}
?
from gf.
Use a gf::Color4f
, that's the simplest way to do. Otherwise, you can use gf::Color::rgba()
and gf::Color::convert()
(in the develop
branch, the names are ugly and may change in the future) to convert from one format to another.
from gf.
Okay okay, anyway, i wanted to switch to gf::Color4f, looks like a way more simplier.
from gf.
Related Issues (20)
- Add macos build in Travis-CI HOT 1
- Example 40 arrow not in the right place HOT 1
- example 7 no red square HOT 1
- Rendering Problem with SquareGrid Class HOT 2
- typo in AUTHORS.md
- Custom shader and builtin variables HOT 3
- Add a state machine
- Port Swoosh to gf HOT 1
- Port "Let There Be Light" to gf
- memory leak? HOT 2
- gf_pong game not running
- gf::TextButtonWidget not updating correctly his background rectangle HOT 2
- gf::BasicText not updating correctly his local bounds HOT 3
- Error when trying to build develop branch of GF on windows
- Cmake generating only x64 build for windows on develop branch HOT 1
- Multiple windows HOT 7
- Unable to compile 101 from the wiki HOT 3
- line width of square grid not rendered correctly when greater than 7
- Build is broken. HOT 3
- Workflow questions HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gf.