Comments (2)
In the LightingArea class, the reason is to make the texture optional by allowing the pointer to be null.
When the texture is null, the area uses a plain color, as you can see here:
https://github.com/MiguelMJ/Candle/blob/master/src/LightingArea.cpp#L73
with some examples here
https://www.miguelmj.dev/Candle/md_doc_md_fog_ambiental.html
Today I'm not so sure whether I would write this again the same way, but if you ask me the reason for a pointer, there's why. Feel free to tell me here what alternative you would suggest.
Is there any other place where you feel the use of pointers is not justified?
from candle.
Yeah, there is no problem in having a pointer to a texture as a private member of a class, it's the only option here.
But I was talking only about the interface of the classes.
I mean, look at the implementation of sf::Sprite, for example: sf::Sprite::m_texture
Under the hood it uses pointers, but the interface always takes references. Just because it looks more modern-c++-like and not c-like. There is nothing bad in writing in c-like style, but here we're talking about sfml-like style.
So, my issue was opened just because of that line: candle::LightingArea::LightingArea because I didn't see any point in sending a pointer here. If you don't have a texture --> use another constructor and that's all.
If you become interested in doing this, I can offer my help.
P.S. I saw in other issues you are really interested in keeping backward-compatibility, and I cannot agree more, it's really important. But sometimes, interface changes are not that bad, they can mean growth of the project and its maintainers in the way of programming.
These changes are not critical, but I'm sure will make the project more appealing. This does not mean, that we should forget about the backward-compatibility at all, there should be a note about breaking changes, and a version change (from 1.0.2 to 2.0.0). (check out the NOTE at the top of the readme and the number of stars of the repo ;) )
from candle.
Related Issues (19)
- Mutex Lock crash when initialising RadialLight when linking static library. HOT 5
- Can`t compile on Linux HOT 1
- Make include headers - PUBLIC HOT 2
- Add all .hpp files in CMakeLists.txt HOT 2
- Build when SFML as subdirectory
- Weird snap shadow glitch HOT 24
- Error building with `make` HOT 3
- Directed light not casting shadow at 90ΒΊ HOT 9
- M_PI is non-standard HOT 3
- Use of shaders
- setColor on RadialLight doesn't change color HOT 5
- #RadialLightFix deconstructor problem along with Access Violations HOT 1
- Are there ports to other langues? HOT 1
- Shadow display error HOT 1
- candle::RadialLight has an offset origin point HOT 4
- Version 2.0 HOT 1
- Add Diego Arroyo as contributor HOT 2
- how can i run this on osx and ios HOT 2
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 candle.