Comments (10)
It's working when I load exactly the same texture (with relative path) inside the LoadResources of an object. I'm think it's related to the working directory...
from gdevelop.
Yes, it is related to the working directory: any time a resource (=file) used by a game is loaded, the working directory must be set to the game directory, then set back to the original working directory (=IDE directory). But normally, you shouldn't have to change the working dir.
You should be using gd::Resource and gd::ResourceManager. In an editor, you can do:
project.GetResourcesManager().GetResource(imageName)
to get a resource then use GetAbsoluteFile on the resource (make sure it is an image before). See a full example in SpriteObjectEditor.cpp
(method GetwxBitmapFromImageResource
)
When displaying an object, you should use in LoadResources
a line like this:
project.GetImageManager()->GetSFMLTexture(imageName)
from gdevelop.
You're trying to factor the drawing code I guess, I didn't take a look at it for now but maybe this drawing code should not rely on the image manager but on a SFML sprite (or whatever it needs) passed as a parameter?
from gdevelop.
Yes, the TileSet class contains a wxBitmap and a SFMLTextureWrapper. The wxBitmap is only used in the editor but all the calculations are made on the SFML texture. So, even in the editor I need to load the texture.
from gdevelop.
@victorlevasseur Did you manage to find a solution? Maybe you have a suggestion about something that should be updated/refactored?
from gdevelop.
I've found a workaround : I get the current working dir, then I put the
game working dir, the image is loaded, then I put the old working dir.
from gdevelop.
Ok, we should think a bit about if there is a way to refactor something (either in the extension or in GD) because I'm not totally satisfied with this workaround (because it is a workaround as you said ^^)
from gdevelop.
@victorlevasseur any news about it? 😄 Did you think about a better solution or do you think the current solution is good enough?
from gdevelop.
I didn't find another solution and the workaround works fine. So, we can close that issue.
from gdevelop.
Ok, sounds fine. :)
from gdevelop.
Related Issues (20)
- New Hero In Town Music Asset Pack
- Upgrade to the newest bondagejs HOT 4
- Upgrading yarn editor to the newest version HOT 1
- feature: extending dialogtools to (optionaly) recognise the concept of an actor and apply some styling to things via the event sheet HOT 2
- [bug] - In Scene Editor - Buttons, Sliders and other Custom Objects always stay on top of other objects (Text, Sprites...) - never considering Z Order
- Tiled Sprite Randomization Feature (Randomized Rotation and Offset combined with blending) a la Construct 3's r321 update. HOT 2
- Limitation in Physics Engine Speed HOT 1
- Simpler way to center origin sprite point HOT 3
- Add sorting for assets bin HOT 1
- Snapping objects in editor
- Corrupted value in Scene editor's tooltip right after instance deletion HOT 1
- Fullscreen Detection broken HOT 4
- Adding the ability to specify Cordova and NPM plugin parameters in extension dependencies HOT 1
- Platformer Deacceleration shows the wrong tooltip HOT 1
- High-Speed Collision Detection Limitation HOT 3
- Crash while using an editor
- Toggle switches don't work in 5.3.196 HOT 2
- User Interface Sound Effects
- "Preload as" toggles for audio files in the Resources Panel do not behave the same as the "Preload as" event actions. HOT 1
- Crash while using an editor
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 gdevelop.