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

Author Topic: Move, stretch, and draw sprites without modifying its pos?  (Read 7730 times)

0 Members and 1 Guest are viewing this topic.

djzmo

  • Newbie
  • *
  • Posts: 8
    • View Profile
Move, stretch, and draw sprites without modifying its pos?
« on: April 08, 2010, 12:36:41 pm »
Hello there,

I am currently converting my game which is previously created with Haaf's Game Engine (http://hge.relishgames.com) to SFML for portability (HGE relies on DirectX), but I'm having problem with SFML's RenderWindow::Draw() function.

It is written in C++.

Here is my original code with HGE:
Code: [Select]
// Inside the drawing function (HGE separates the rendering task in a function)
for(int i = 0; i < numObjects; i++)
{
  // nPosY1/nPosY2 is always changing
  float objPosY1 = 200.0f - nPosY1[i];
  float objPosY2 = 200.0f - nPosY2[i];
  // s_Note is a sprite
  // RenderStretch(float x1, float y1, float x2, float y2);
  s_Note->RenderStretch(33.0f, objPosY1, 33.0f + 28.0f, objPosY2); // x1, y1, x2, y2
}


As you can see above, I used the same sprite (s_Note) to draw a same image on various positions on the screen without modifying the sprite position.

Also it can stretch and draw the stretched sprite.

How can I achieve the same goal in SFML?
Since each sprite has its own position, it means I have to create many sprites to draw the same image in a different position. (and I don't want to do that)

And I can't see a similar "RenderStretch" function in SFML.

Code: [Select]
for(int i = 0; i < numObjects; i++)
{
  float objPosY1 = 200.0f - nPosY1[i];
  float objPosY2 = 200.0f - nPosY2[i];
  // ???????????????????????
}


Any kind of help would be appreciated.  :D

Mindiell

  • Hero Member
  • *****
  • Posts: 1261
    • ICQ Messenger - 41484135
    • View Profile
Move, stretch, and draw sprites without modifying its pos?
« Reply #1 on: April 08, 2010, 03:52:11 pm »
You have to do that or you have to draw the first sprite, then move it and draw it again, etc...

A sprite has no pcture in it, since this is the image that contains the picture, so your sprite is a light object, you can have a lot ;)
Mindiell
----

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Move, stretch, and draw sprites without modifying its pos?
« Reply #2 on: April 08, 2010, 03:55:57 pm »
You can use a single sprite to render all your images. But having one sprite per visual entity is generally a better option.
Laurent Gomila - SFML developer

djzmo

  • Newbie
  • *
  • Posts: 8
    • View Profile
Move, stretch, and draw sprites without modifying its pos?
« Reply #3 on: April 08, 2010, 06:41:52 pm »
Okay maybe I will try to make a lot of sprites. (varying from 1000 to 3000 sprites to draw. Will it be OK?)

And what about "RenderStretch" function equivalent in SFML?

Spodi

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • http://www.netgore.com/
Move, stretch, and draw sprites without modifying its pos?
« Reply #4 on: April 08, 2010, 06:49:06 pm »
Quote from: "djzmo"

And what about "RenderStretch" function equivalent in SFML?


Looks like it'd be the same as setting Sprite.Position, Sprite.Width, and Sprite.Height.

djzmo

  • Newbie
  • *
  • Posts: 8
    • View Profile
Move, stretch, and draw sprites without modifying its pos?
« Reply #5 on: April 09, 2010, 03:42:43 pm »
Sorry but I couldn't see something like "Sprite::SetWidth()" or "Sprite::SetHeight()".

Only Sprite::SetScale which takes factor to resize the object.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Move, stretch, and draw sprites without modifying its pos?
« Reply #6 on: April 09, 2010, 03:46:07 pm »
Sprite::Resize ;)
Laurent Gomila - SFML developer

djzmo

  • Newbie
  • *
  • Posts: 8
    • View Profile
Move, stretch, and draw sprites without modifying its pos?
« Reply #7 on: April 09, 2010, 04:35:32 pm »
Hello.

Sorry for asking different question in the same thread.
But this still have something related to the conversion, so...


When I tried to build my game, the linker gave me TONS of linker errors:

Code: [Select]
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) already defined in libcpmtd.lib(xlock.obj)
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: __thiscall std::_Lockit::_Lockit(int)" (??0_Lockit@std@@QAE@H@Z) already defined in libcpmtd.lib(xlock.obj)
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "void __cdecl std::_Debug_message(wchar_t const *,wchar_t const *,unsigned int)" (?_Debug_message@std@@YAXPB_W0I@Z) already defined in libcpmtd.lib(stdthrow.obj)
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)" (??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in Main.obj
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) already defined in Main.obj
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::substr(unsigned int,unsigned int)const " (?substr@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV12@II@Z) already defined in Main.obj
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::operator=(char const *)" (??4?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@PBD@Z) already defined in Main.obj
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: void __thiscall std::_Container_base_secure::_Swap_all(class std::_Container_base_secure &)const " (?_Swap_all@_Container_base_secure@std@@QBEXAAV12@@Z) already defined in Main.obj
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: void __thiscall std::_Container_base_secure::_Orphan_all(void)const " (?_Orphan_all@_Container_base_secure@std@@QBEXXZ) already defined in Main.obj
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: __thiscall std::_Container_base_secure::~_Container_base_secure(void)" (??1_Container_base_secure@std@@QAE@XZ) already defined in Main.obj
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z) already defined in Main.obj
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: char const * __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::c_str(void)const " (?c_str@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPBDXZ) already defined in Main.obj
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: __thiscall std::_Container_base_secure::_Container_base_secure(void)" (??0_Container_base_secure@std@@QAE@XZ) already defined in Main.obj
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: void __thiscall std::basic_ios<char,struct std::char_traits<char> >::setstate(int,bool)" (?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXH_N@Z) already defined in Main.obj
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: int __thiscall std::ios_base::width(int)" (?width@ios_base@std@@QAEHH@Z) already defined in Main.obj
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: int __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::sputn(char const *,int)" (?sputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHPBDH@Z) already defined in Main.obj
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: static bool __cdecl std::char_traits<char>::eq_int_type(int const &,int const &)" (?eq_int_type@?$char_traits@D@std@@SA_NABH0@Z) already defined in Main.obj
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: static int __cdecl std::char_traits<char>::eof(void)" (?eof@?$char_traits@D@std@@SAHXZ) already defined in Main.obj
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: int __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::sputc(char)" (?sputc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHD@Z) already defined in Main.obj
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: class std::basic_streambuf<char,struct std::char_traits<char> > * __thiscall std::basic_ios<char,struct std::char_traits<char> >::rdbuf(void)const " (?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@XZ) already defined in Main.obj
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: char __thiscall std::basic_ios<char,struct std::char_traits<char> >::fill(void)const " (?fill@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEDXZ) already defined in Main.obj
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: int __thiscall std::ios_base::flags(void)const " (?flags@ios_base@std@@QBEHXZ) already defined in Main.obj
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: int __thiscall std::ios_base::width(void)const " (?width@ios_base@std@@QBEHXZ) already defined in Main.obj
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: static unsigned int __cdecl std::char_traits<char>::length(char const *)" (?length@?$char_traits@D@std@@SAIPBD@Z) already defined in Main.obj
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char> > & __thiscall std::basic_ostream<char,struct std::char_traits<char> >::flush(void)" (?flush@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@XZ) already defined in Main.obj
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char> > * __thiscall std::basic_ios<char,struct std::char_traits<char> >::tie(void)const " (?tie@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_ostream@DU?$char_traits@D@std@@@2@XZ) already defined in Main.obj
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: bool __thiscall std::ios_base::good(void)const " (?good@ios_base@std@@QBE_NXZ) already defined in Main.obj
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: void __thiscall std::basic_ostream<char,struct std::char_traits<char> >::_Osfx(void)" (?_Osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEXXZ) already defined in Main.obj
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "bool __cdecl std::uncaught_exception(void)" (?uncaught_exception@std@@YA_NXZ) already defined in libcpmtd.lib(uncaught.obj)
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::_Lock(void)" (?_Lock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEXXZ) already defined in Main.obj
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::_Unlock(void)" (?_Unlock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEXXZ) already defined in Main.obj
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "bool __cdecl std::operator==<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,char const *)" (??$?8DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PBD@Z) already defined in Main.obj
msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: unsigned int __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::size(void)const " (?size@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ) already defined in Main.obj
MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: __invalid_parameter already defined in LIBCMTD.lib(invarg.obj)
MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: __CrtDbgReportW already defined in LIBCMTD.lib(dbgrptw.obj)
MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: "public: virtual __thiscall std::exception::~exception(void)" (??1exception@std@@UAE@XZ) already defined in LIBCMTD.lib(stdexcpt.obj)
MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: "public: __thiscall std::exception::exception(void)" (??0exception@std@@QAE@XZ) already defined in LIBCMTD.lib(stdexcpt.obj)
MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: "public: __thiscall std::exception::exception(class std::exception const &)" (??0exception@std@@QAE@ABV01@@Z) already defined in LIBCMTD.lib(stdexcpt.obj)
MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: "public: __thiscall std::exception::exception(char const * const &)" (??0exception@std@@QAE@ABQBD@Z) already defined in LIBCMTD.lib(stdexcpt.obj)
MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _fclose already defined in LIBCMTD.lib(fclose.obj)
MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _free already defined in LIBCMTD.lib(dbgfree.obj)
MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _fwrite already defined in LIBCMTD.lib(fwrite.obj)
MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _fflush already defined in LIBCMTD.lib(fflush.obj)
MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _exit already defined in LIBCMTD.lib(crt0dat.obj)
MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: ___iob_func already defined in LIBCMTD.lib(_file.obj)
MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _sprintf already defined in LIBCMTD.lib(sprintf.obj)
MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: __gmtime64 already defined in LIBCMTD.lib(gmtime64.obj)
MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _abort already defined in LIBCMTD.lib(abort.obj)
MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _strncpy already defined in LIBCMTD.lib(strncpy.obj)
MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _malloc already defined in LIBCMTD.lib(dbgmalloc.obj)
MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _fgetc already defined in LIBCMTD.lib(fgetc.obj)
MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: __wassert already defined in LIBCMTD.lib(wassert.obj)
MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _fseek already defined in LIBCMTD.lib(fseek.obj)
MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _ftell already defined in LIBCMTD.lib(ftell.obj)
MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _strtol already defined in LIBCMTD.lib(strtol.obj)
MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _strncmp already defined in LIBCMTD.lib(strncmp.obj)
MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _ldexp already defined in LIBCMTD.lib(_ldexp_.obj)
MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _getenv already defined in LIBCMTD.lib(getenv.obj)
MSVCRTD.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMTD.lib(typinfo.obj)
MSVCRTD.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMTD.lib(typinfo.obj)
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
Main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall sf::Window::GetEvent(class sf::Event &)" (?GetEvent@Window@sf@@QAE_NAAVEvent@2@@Z) referenced in function "bool __cdecl FrameFunc(void)" (?FrameFunc@@YA_NXZ)
Main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall sf::Input::IsKeyDown(enum sf::Key::Code)const " (?IsKeyDown@Input@sf@@QBE_NW4Code@Key@2@@Z) referenced in function "bool __cdecl FrameFunc(void)" (?FrameFunc@@YA_NXZ)
Main.obj : error LNK2019: unresolved external symbol "public: void __thiscall sf::Window::Display(void)" (?Display@Window@sf@@QAEXXZ) referenced in function _main
Main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall sf::Window::IsOpened(void)const " (?IsOpened@Window@sf@@QBE_NXZ) referenced in function _main
Main.obj : error LNK2019: unresolved external symbol "public: void __thiscall sf::Window::Create(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned long,struct sf::WindowSettings const &)" (?Create@Window@sf@@QAEXVVideoMode@2@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@KABUWindowSettings@2@@Z) referenced in function _main
sfml-graphics-s-d.lib(RenderWindow.obj) : error LNK2001: unresolved external symbol "public: void __thiscall sf::Window::Create(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned long,struct sf::WindowSettings const &)" (?Create@Window@sf@@QAEXVVideoMode@2@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@KABUWindowSettings@2@@Z)
Main.obj : error LNK2019: unresolved external symbol "public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (??0VideoMode@sf@@QAE@III@Z) referenced in function _main
Main.obj : error LNK2019: unresolved external symbol "public: class sf::Input const & __thiscall sf::Window::GetInput(void)const " (?GetInput@Window@sf@@QBEABVInput@2@XZ) referenced in function "void __cdecl `dynamic initializer for 'Input''(void)" (??__EInput@@YAXXZ)
sfml-graphics-s-d.lib(Image.obj) : error LNK2019: unresolved external symbol "public: bool __thiscall sf::Window::SetActive(bool)const " (?SetActive@Window@sf@@QBE_N_N@Z) referenced in function "public: bool __thiscall sf::Image::CopyScreen(class sf::RenderWindow &,class sf::Rect<int> const &)" (?CopyScreen@Image@sf@@QAE_NAAVRenderWindow@2@ABV?$Rect@H@2@@Z)
sfml-graphics-s-d.lib(RenderWindow.obj) : error LNK2001: unresolved external symbol "public: bool __thiscall sf::Window::SetActive(bool)const " (?SetActive@Window@sf@@QBE_N_N@Z)
sfml-graphics-s-d.lib(RenderWindow.obj) : error LNK2019: unresolved external symbol "public: virtual __thiscall sf::Window::~Window(void)" (??1Window@sf@@UAE@XZ) referenced in function __unwindfunclet$??0RenderWindow@sf@@QAE@XZ$0
sfml-graphics-s-d.lib(RenderWindow.obj) : error LNK2019: unresolved external symbol "public: __thiscall sf::Window::Window(void)" (??0Window@sf@@QAE@XZ) referenced in function "public: __thiscall sf::RenderWindow::RenderWindow(void)" (??0RenderWindow@sf@@QAE@XZ)
sfml-graphics-s-d.lib(RenderWindow.obj) : error LNK2001: unresolved external symbol "private: virtual void __thiscall sf::Window::OnEvent(class sf::Event const &)" (?OnEvent@Window@sf@@EAEXABVEvent@2@@Z)
sfml-graphics-s-d.lib(RenderWindow.obj) : error LNK2019: unresolved external symbol "public: void __thiscall sf::Window::Create(void *,struct sf::WindowSettings const &)" (?Create@Window@sf@@QAEXPAXABUWindowSettings@2@@Z) referenced in function "public: __thiscall sf::RenderWindow::RenderWindow(void *,struct sf::WindowSettings const &)" (??0RenderWindow@sf@@QAE@PAXABUWindowSettings@1@@Z)
sfml-graphics-s-d.lib(RenderWindow.obj) : error LNK2019: unresolved external symbol "public: unsigned int __thiscall sf::Window::GetWidth(void)const " (?GetWidth@Window@sf@@QBEIXZ) referenced in function "public: virtual unsigned int __thiscall sf::RenderWindow::GetWidth(void)const " (?GetWidth@RenderWindow@sf@@UBEIXZ)
sfml-graphics-s-d.lib(RenderWindow.obj) : error LNK2019: unresolved external symbol "public: unsigned int __thiscall sf::Window::GetHeight(void)const " (?GetHeight@Window@sf@@QBEIXZ) referenced in function "public: virtual unsigned int __thiscall sf::RenderWindow::GetHeight(void)const " (?GetHeight@RenderWindow@sf@@UBEIXZ)
sfml-graphics-s-d.lib(GraphicsContext.obj) : error LNK2019: unresolved external symbol "public: void __thiscall sf::Context::SetActive(bool)" (?SetActive@Context@sf@@QAEX_N@Z) referenced in function "public: __thiscall sf::priv::GraphicsContext::GraphicsContext(void)" (??0GraphicsContext@priv@sf@@QAE@XZ)
sfml-graphics-s-d.lib(GraphicsContext.obj) : error LNK2019: unresolved external symbol "public: static class sf::Context & __cdecl sf::Context::GetGlobal(void)" (?GetGlobal@Context@sf@@SAAAV12@XZ) referenced in function "public: __thiscall sf::priv::GraphicsContext::GraphicsContext(void)" (??0GraphicsContext@priv@sf@@QAE@XZ)
sfml-graphics-s-d.lib(GraphicsContext.obj) : error LNK2019: unresolved external symbol "public: static bool __cdecl sf::Context::IsContextActive(void)" (?IsContextActive@Context@sf@@SA_NXZ) referenced in function "public: __thiscall sf::priv::GraphicsContext::GraphicsContext(void)" (??0GraphicsContext@priv@sf@@QAE@XZ)


Any idea?  :?

I'm trying to compile it with the static build of sfml-graphics and sfml-system in Microsoft Visual C++ 2008.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Move, stretch, and draw sprites without modifying its pos?
« Reply #8 on: April 09, 2010, 06:06:10 pm »
Are you sure that you don't use the Visual C++ 2005 libraries?
Laurent Gomila - SFML developer

djzmo

  • Newbie
  • *
  • Posts: 8
    • View Profile
Move, stretch, and draw sprites without modifying its pos?
« Reply #9 on: April 09, 2010, 07:46:02 pm »
I am sure that I'm using the VC 2008 build of SFML 1.6.

I couldn't even build this simple program with the static build:

Code: [Select]
#include <SFML/Graphics.hpp>

int main()
{
sf::RenderWindow App;
App.Create(sf::VideoMode(800, 600, 32), "SFML Graphics");

    while (App.IsOpened())
    {
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            if (Event.Type == sf::Event::Closed)
                App.Close();
        }
        App.Clear();
        App.Display();
    }

    return 0;
}


Code: [Select]
msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z) already defined in libcpmt.lib(string.obj)
msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)" (??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in Main.obj
msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) already defined in Main.obj


Here is the setting I applied:
Code: [Select]
Release:
Linker > Input > Ignore Specific Library: libcmt
Linker > Input > Additional Dependencies: sfml-system-s.lib sfml-window-s.lib sfml-graphics-s.lib
C/C++ > Code Generation > Runtime Library: Multi-threaded (/MT)
C/C++ > Preprocessor > Preprocessor Definitions: - (none)


It compiles just fine if I use the DLL version.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Move, stretch, and draw sprites without modifying its pos?
« Reply #10 on: April 10, 2010, 10:32:29 am »
What if you open the SFML.sln solution from the SDK, and compile the samples?
Laurent Gomila - SFML developer

 

anything