Comments (13)
I'll write up a tutorial in the next few hours that everyone can use for future reference.
-Stephen Hall
On Dec 23, 2013, at 10:25 PM, "Jared Ready" [email protected] wrote:
So, I'm not sure how best to add resources into the grapics.json file. And then once they're there, what's the best to load said resources? I see there's TextureManager and ResourceManager classes, are we supposed to use those? Is using direct SFML to load resources not the right way?
—
Reply to this email directly or view it on GitHub.
from chessplusplus.
See this:
https://gist.github.com/Thumperrr/bd3b872038e2eb05796d#file-chesspp_graphics-md
It might be worth putting that into the repo somewhere. I'm out of time for now, though.
from chessplusplus.
We have a wiki for a reason:
https://github.com/cpluspluscom/ChessPlusPlus/wiki/Graphics-and-You
Also, you put cpp
and not C++
after the triple ticks for C++ syntax highlighting ;)
EDIT: Oh, and JSON supports spaces! Away with your ugly underscores :)
from chessplusplus.
Ah, thanks LB.
And yeah, my GitHub flavored markdown is rusty.
I'll leave this issue open for ResidentBiscuit to close, in the event that questions are still unanswered.
from chessplusplus.
Alright so here's what I have, it's not working though. Images are not getting loaded, Just getting the 'missing' image instead.
graphics.json
{
"chesspp":
{
"logo": "res/img/logo.png",
"menu":
{
"background": "res/img/main_menu_background.png"
},
...
StartMenuState
StartMenuState::StartMenuState(Application &app, sf::RenderWindow &display) : AppState(display), app(app)
{
// Load and initialize resources
menuBackgroundTexture = TextureManager::instance().load(gfx_config.spritePath("chesspp", "menu", "background"));
menuBackground.setTexture(menuBackgroundTexture);
logoTexture = TextureManager::instance().load(gfx_config.spritePath("chesspp", "logo"));
logo.setTexture(logoTexture, true);
...
Any idea what I'm doing wrong here?
from chessplusplus.
- Are the images in the location you say they are?
- Is the program running at all? I.e., are you seeing white blocks instead of the images?
- Are your textures references to an sf::Texture?
- Check the log, in it contains information about what textures are loaded successfully and what ones aren't. Might shed light on why.
you can also check src/gfx/graphics.cpp to see how that deals with images.
from chessplusplus.
It's just displaying the 'missing' X instead of my images.
My sf::Textures are not references. Didn't see they were supposed to.
On Tue, Dec 24, 2013 at 9:58 AM, Thumperrr [email protected] wrote:
- Are the images in the location you say they are?
- Is the program running at all? I.e., are you seeing white blocks
instead of the images?- Are your textures references to an sf::Texture?
- Check the log, in it contains information about what textures are
loaded successfully and what ones aren't. Might shed light on why.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/66#issuecomment-31176132
.
from chessplusplus.
You can't copy textures, you need to take the return of .load()
by reference.
from chessplusplus.
Got this working. Made a note on the wiki. The spritePath() method already
appends a "chesspp" to the beginning of the path, so if you pass that in
also you get an invalid path.
On Tue, Dec 24, 2013 at 10:27 AM, LB-- [email protected] wrote:
You can't copy textures, you need to take the return of .load() by
reference.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/66#issuecomment-31177096
.
from chessplusplus.
I think having spritePath() append "chesspp" to the beginning is counterintuitive and introduces hidden behavior that can be confusing. I'll open an issue for this.
from chessplusplus.
@Thumperrr it's in the chesspp
namespace, if it were in the global namespace it would be counter-intuitive. But we can discuss in the issue.
from chessplusplus.
Even so we should specify it in a call to spritePath. see #67
from chessplusplus.
As far as I'm aware, this issue has been resolved, so i'll go ahead and close it.
from chessplusplus.
Related Issues (20)
- Redundant `to` parameter in Piece::moveUpdate()
- No end state HOT 3
- Move piece class registration from board to piece
- Iterator hell w/ piece movements
- Need a list of general tasks that need done HOT 5
- Custom exception class is overused - is it even necessary?
- License HOT 16
- cmake HOT 1
- LB's Refactor HOT 2
- Changing AppStates HOT 4
- How to revert commit
- Documentation HOT 3
- Too much code in headers HOT 3
- GraphicsConfig spritePath() hidden behavior HOT 7
- Resource Management Refactoring HOT 4
- Just an FYI: What "cpluspluscom" is short for HOT 1
- Can we clean up travis.yml? HOT 2
- Unable to access newly constructed AppStates
- AppStates are bound to a window at construction
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 chessplusplus.