loading/saving image texture, CreateTexFromFile(...), etc

Forum for plugin, effect and behavior programmers. Please use the Help & Support forum for help using Construct.

Post » Thu Sep 30, 2010 3:33 am

trying to find the definition for :
virtual TextureHandle CreateTextureFromFile(PCTSTR filename, texture_format format = cr::texture_format_a8r8g8b8)

basically I'm trying to figure out how to load/save texture from/to a file containing the img data along with other info, if necessary using binary fstream functions. the files will always be in png format before being combined with the other info.

I'd appreciate any help on this front
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Fri Oct 01, 2010 11:33 am

[quote:1xw7p0k5]trying to find the definition for :
virtual TextureHandle CreateTextureFromFile(PCTSTR filename, texture_format format = cr::texture_format_a8r8g8b8)[/quote:1xw7p0k5]
The function is defined on line 1304 of this file:
Common/Renderers/CDX9Renderer.cpp

Hope that helps.
B
79
S
24
G
52
Posts: 4,724
Reputation: 39,711

Post » Fri Oct 01, 2010 3:54 pm

Thanks rojo, though I had already found it. Wasn't quite what I needed. I was actually hoping you would respond to this thread, since you had created the resource plugin I thought maybe you'd have some insight into the problem. Basically I want to be able to create custom resource files, I was hoping for a simple solution. Sort of like fstream, but where I could include pngs and maybe sounds along with it. I did find one solution on a gamedev site I'll use if there's nothing elsewhere in the sdk that can help...anything you've stumbled upon that might help?
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Fri Oct 01, 2010 7:37 pm

Construct's functions probably won't help with this - why not get libpng or something like that and do it yourself?
Scirra Founder
B
358
S
214
G
72
Posts: 22,946
Reputation: 178,333

Post » Tue Mar 15, 2011 9:26 am

I'll trying to make reload sprite image at edit time, but can't get it to work :oops:
(it's modified sprite plugin)
I've made CString variable to save path to image and button which reloads sprite image from disk.
Function looks like this
int tex = pEditTime->AddTextureFromFile(spritePath)
iTexture = pEditTime->AddImageAsTexture(image)
pEditTime->SetTexture(iTexture)
but does nothing help please))
B
1
G
1
Posts: 8
Reputation: 441

Post » Wed Mar 16, 2011 10:25 am

One more feature I'm dreaming about is loading sprites at realtime and edittime.
Says you just need to specify folder where from to load sequences and prefix for frame count and file extension. Action look for subfolders and creates new animations for each one with name of subfolder. Then for every subfolder it loads amount of frames equal to amount of files. If there is no subfolders then it just loads image into sprite.

I think it will be very usable for everybody if someone make this. For me it's very needed feature because artists always improves animations and sprites and for now you need to reload it manually every time using image editor.
B
1
G
1
Posts: 8
Reputation: 441


Return to Construct engineering

Who is online

Users browsing this forum: No registered users and 0 guests