HomeHome  CalendarCalendar  FAQFAQ  SearchSearch  MemberlistMemberlist  UsergroupsUsergroups  RegisterRegister  Log inLog in  

Share | 
 

 setting the image of SFML quadrenderer

View previous topic View next topic Go down 
AuthorMessage
EralpB



Messages : 7
Date d'inscription : 2010-12-13

PostSubject: setting the image of SFML quadrenderer   Sun Jan 16, 2011 12:14 pm

Hello, I've been trying to create a blood splash when monsters get hit. But the only thing I get is this



I thought I could be doing something wrong and changed my code nearly to the same as the tutorial's smoke. Here is my code, what could I be doing wrong?

Code:

SPK::SPK_ID particleManager::createBloodSystemBase(sf::Image* bloodSplash)
{
   
   // Creates the model

      Model* splashModel = Model::create(
FLAG_SIZE | FLAG_ALPHA | FLAG_TEXTURE_INDEX | FLAG_ANGLE,
FLAG_SIZE | FLAG_ALPHA,
FLAG_SIZE | FLAG_TEXTURE_INDEX | FLAG_ANGLE);
splashModel->setParam(PARAM_SIZE,5.0f,10.0f,100.0f,200.0f);
splashModel->setParam(PARAM_ALPHA,1.0f,0.0f);
splashModel->setParam(PARAM_TEXTURE_INDEX,0.0f,4.0f);
splashModel->setParam(PARAM_ANGLE,0.0f,PI * 2.0f);
splashModel->setLifeTime(2.0f,5.0f);



   SPK::SFML::SFMLQuadRenderer* bloodRenderer = SPK::SFML::SFMLQuadRenderer::create();
   bloodRenderer->setBlendMode(sf::Blend::Alpha);
bloodRenderer->setImage(bloodSplash);
bloodRenderer->setAtlasDimensions(2,2);
bloodRenderer->setGroundCulling(true);



   // Creates the zone
   SPK::Sphere* bloodSource = SPK::Sphere::create(SPK::Vector3D(0.0f,0.0f,10.0f),5.0f);

   // Creates the emitter
   SPK::SphericEmitter* bloodEmitter = SPK::SphericEmitter::create(SPK::Vector3D(0.0f,0.0f,1.0f),3.14159f / 4.0f,3.0f * 3.14159f / 4.0f);
   bloodEmitter->setForce(50.0f,150.0f);
   bloodEmitter->setZone(bloodSource);
   bloodEmitter->setTank(200);
   bloodEmitter->setFlow(-1);

   // Creates the Group
   SPK::Group* splashGroup = SPK::Group::create(splashModel,100);
   splashGroup->setGravity(SPK::Vector3D(0.0f,0.0f,0.0f));
   splashGroup->setRenderer(bloodRenderer);
   splashGroup->addEmitter(bloodEmitter);
   splashGroup->enableSorting(true);
   
   splashGroup->setFriction(2.0f);

   // Creates the System
   SPK::SFML::SFMLSystem* bloodSystem = SPK::SFML::SFMLSystem::create();
   bloodSystem->addGroup(splashGroup);


   splashModel->setShared(true);
   bloodRenderer->setShared(true);

   // Creates the base and gets the ID
   return bloodSystem->getSPKID();

}

I am using SFML 1.6
Back to top Go down
View user profile
Juff
Developer


Messages : 539
Date d'inscription : 2009-07-14
Age : 34

PostSubject: Re: setting the image of SFML quadrenderer   Mon Jan 17, 2011 5:09 am

Hi,

Is your sf::Image well loaded ?
Does the sf::Image::loadFromFile returns true ? Can you display it using a standard sf::Sprite ?
Back to top Go down
View user profile http://spark.developpez.com
EralpB



Messages : 7
Date d'inscription : 2010-12-13

PostSubject: Re: setting the image of SFML quadrenderer   Tue Jan 18, 2011 1:28 pm

Sorry for the delay, I was adding something else to my game and I couldn't test it Smile

Today I tested it and I get the same result even If I put my characters sprite there, I am pretty sure it is loaded properly, I must be doing some other thing wrong -.-

Thanks

additional info: I am linking SFML and SPARK dynamically, for example sparks work which uses linerenderer's I guess.

I didn't compile SPARK I just downloaded the newest version and linked.(I am compiling my project in debug mode but I couldn't find the debug libraries of SPARK, I think the built ones are RELEASE mode? Maybe that's the problem?)

I think I may be passing some little line of code, do you see any mistakes with that source code I provided?
Back to top Go down
View user profile
EralpB



Messages : 7
Date d'inscription : 2010-12-13

PostSubject: Re: setting the image of SFML quadrenderer   Tue Jan 18, 2011 5:17 pm

Heyy! I got it working, as I was expecting its because the built-in libraries are compiled in RELEASE mode wheras I was testing my game in debug mode, now it's working like a charm Smile

Can I advise you to put DEBUG libraries too? for "newbies" like me? I don't think they will add much overhead to filesize.
Back to top Go down
View user profile
Juff
Developer


Messages : 539
Date d'inscription : 2009-07-14
Age : 34

PostSubject: Re: setting the image of SFML quadrenderer   Tue Jan 18, 2011 5:36 pm

That's good to hear.

If you need libraries in debug mode, there is a debug target in the project. You only have to build the solution with the debug target (if you re using either visual 2005, 2008 or code block). Debug libraries will be generated in the lib directory with a -d suffix.
Back to top Go down
View user profile http://spark.developpez.com
Sponsored content




PostSubject: Re: setting the image of SFML quadrenderer   Today at 9:25 am

Back to top Go down
 
setting the image of SFML quadrenderer
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» How do I make the login popup show an Image, instead of it's bland colors
» Roster image
» The header image keeps going invisible.
» Setting & getting variable values
» Tiling image behind banner on PhpBB?

Permissions in this forum:You cannot reply to topics in this forum
 :: English Forum :: Questions (en)-
Jump to: