Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How access to resource from DLL or resource package from SFML  (Read 9898 times)

0 Members and 1 Guest are viewing this topic.

Redee

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
How access to resource from DLL or resource package from SFML
« on: November 04, 2014, 04:29:38 pm »
I have resource DLL with one PNG file with ID = 101
And we have 3 functions at SFML Image class to load image

Quote
       loadFromFile (const std::string &filename)

    loadFromMemory (const void *data, std::size_t size)

    loadFromStream (InputStream &stream)
http://sfml-dev.org/documentation/2.1/classsf_1_1Image.php

Me need to load my Png from DLL but I no see functions to do this.
And no ideas how use loadFromMemory / loadFromStream

Pls, help, a lot of time spent to search solution.
« Last Edit: November 21, 2014, 01:11:28 pm by Redee »

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: How access to resource in DLL from SFML
« Reply #1 on: November 04, 2014, 04:32:56 pm »
As far as I can tell, resource DLLs are unique to Windows.  Since SFML is a cross-platform library, it doesn't provide any direct support for Windows-only features.

You'll have to look up how to work with resource DLLs on your own.  But once you have the png data loaded into memory using (presumably) the right Windows systems calls, using loadFromMemory on that data should be trivial.

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: How access to resource in DLL from SFML
« Reply #2 on: November 04, 2014, 04:50:55 pm »
If you want a simple to use and cross-platform way to manage and load resources, take a look at PhysFs or maybe the Thor Resources module.

Redee

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
Re: How access to resource in DLL from SFML
« Reply #3 on: November 04, 2014, 05:03:53 pm »
Thx for fast replies!
U can create project at Visual Studio with simple example and share it 2 me ?

Ok I go read abourt cross-platform resource managers.
Its I think be helpful.

Me simply need 2 read data from DLL(or some unique package) and pass 2 loadFromMemory

Redee

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
Re: How access to resource in DLL from SFML
« Reply #4 on: November 17, 2014, 02:06:49 pm »
Hi, Its I again.
Some problem with Thor and SFML 2.1

Give me links to version of Thor which compatible with SFML 2.1

I no understand at
http://www.bromeon.ch/libraries/thor/download.html
what version is correct to SFML 2.1

Thanks in advance.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: How access to resource in DLL from SFML
« Reply #5 on: November 17, 2014, 02:10:23 pm »
This has nothing to do with the original thread.

You better build SFML and Thor from source instead. If you want a SFML 2.1 compatible version, you need to checkout this commit and build Thor yourself.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Redee

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
Re: How access to resource in DLL from SFML
« Reply #6 on: November 17, 2014, 02:24:47 pm »
Ok I will simply do it from Thor source uses CMake.
And All will be ok?
How 2 test Thor dev version with SFML 2.1 release version? (http://sfml-dev.org/download/sfml/2.1)

But at Thor site at download page says >>
Quote
Important: The Thor development version is not compatible with SFML 2.0 or SFML 2.1. It always matches the master branch of the SFML Git version.

Its means need dev master version of SFML?
But me need 2 use with release version of SFML 2.1

Me need 2 read Images / Sounds from Thor resource.

U can write simple example 2 me ?
« Last Edit: November 17, 2014, 02:33:27 pm by Redee »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
AW: How access to resource in DLL from SFML
« Reply #7 on: November 17, 2014, 02:35:01 pm »
If Thor and its shipped examples build and run, you should be fine.

Why should I write examples for you? You want to program, so you write your own examples.

Also I'm typing on a phone and yet I can still write "you" instead of "u", please do the same.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Redee

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
Re: How access to resource in DLL from SFML
« Reply #8 on: November 17, 2014, 02:47:09 pm »
Okey, thank You.
I а little bit understand and try build >
Thor dev ver + SFML 2.1 rel ver + this example from Thor git repository.

I disappointed with no release version of Thor to SFML 2.1 release.

Maybe in latter versions of SFML will be integrate own resource manager?

Redee

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
Re: How access to resource in DLL from SFML
« Reply #9 on: November 17, 2014, 03:25:23 pm »
Errors appeared.
Will try with SFML2 dev ver.



I found extlibs and linked them.
Then need link DOXYGEN_EXECUTABLE.
« Last Edit: November 17, 2014, 04:06:17 pm by Redee »

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: How access to resource in DLL from SFML
« Reply #10 on: November 17, 2014, 05:44:38 pm »
Yes, you need the latest GitHub revisions for both SFML and Thor.

Please read the installation tutorial, I've written it for a reason. And I've also tried to make the error message as expressive as possible. Regarding Doxygen, you must install it if you want to generate the documentation. Otherwise, just remove the corresponding tick.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Redee

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
Re: How access to resource in DLL from SFML
« Reply #11 on: November 18, 2014, 04:34:35 pm »
Ok I read all in depth a few times.
Cloned repository https://github.com/Bromeon/Thor
And Export version f57666db6f187eb57bbc0947456cce2159a9b617 using TortoiseGit GUI.


If I all understand it fully support with SFML2.1 release version.
Then I try test with included examples at Thor directory.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: How access to resource in DLL from SFML
« Reply #12 on: November 18, 2014, 04:55:07 pm »
Why "export this version"? "Reset 'master' to this" (with "hard" flag) should be the correct one.

But don't you want to use the latest versions? And by the way, eXpl0it3r provides nightly builds for Thor, if you don't want to compile on your own.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Redee

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
Re: How access to resource in DLL from SFML
« Reply #13 on: November 18, 2014, 09:23:32 pm »
Thanks for this great Library.
Me need test both versions for SFML2.1 and SFML dev master ver.
And need compile at this comp.

Now test for SFML2.1.

Everything successfully compiled >>



But when run I get exactly error at all examples >>



Sorry, one of examples normal run >>
It means no correct with SFML2.1 (yes like this because no use sfml dlls ::))



Then try with both latest dev versions of Thor and SFML.
And then another earlier versions of Thor with Sfml2.1.

A lot of time else need but its many reasons to do this.
Compile at MSVC++10 Express on WinXP SP3.
« Last Edit: November 18, 2014, 09:37:55 pm by Redee »

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: How access to resource in DLL from SFML
« Reply #14 on: November 18, 2014, 09:36:42 pm »
There might still be a misconfiguration (make sure you read both SFML and Thor tutorials carefully). But in the e-mail, you mentioned Windows XP? I'm not sure whether SFML is still compatible with XP; as far as I remember there have been some issues, but other people probably know better. Do you have the possibility to use a more modern Windows operating system (or maybe Linux)? Keep also in mind that Windows XP is not supported anymore by Microsoft, so security problems won't be fixed.

When you try the SFML examples (not Thor), do they run correctly?
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

 

anything