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

Author Topic: Drawing problem (SFML in wxWidgets)  (Read 1157 times)

0 Members and 1 Guest are viewing this topic.

Anthony11

  • Newbie
  • *
  • Posts: 38
    • View Profile
Drawing problem (SFML in wxWidgets)
« on: July 04, 2015, 08:25:26 pm »
*Image is just 32×32 size PNG black square

HERE ARE 5 TRIES IN (THE ONLY DIFFERENCE OF EACH CODE IS THE POSITION)!:
#1
Sprites:
sf::RenderWindow::create(GetHandle());
m_texture.loadFromFile("Centre.png");
m_sprite.setTexture(m_texture);
m_sprite.setPosition(0, 0);
Update:
clear(sf::Color(255, 255, 255));
draw(m_sprite);
Result:
(removed)

#2
Sprites:
sf::RenderWindow::create(GetHandle());
m_texture.loadFromFile("Centre.png");
m_sprite.setTexture(m_texture);
m_sprite.setPosition(25, 25);
Update:
clear(sf::Color(255, 255, 255));
draw(m_sprite);
Result:
(removed)

#3
Sprites:
sf::RenderWindow::create(GetHandle());
m_texture.loadFromFile("Centre.png");
m_sprite.setTexture(m_texture);
m_sprite.setPosition(-25, -25);
Update:
clear(sf::Color(255, 255, 255));
draw(m_sprite);
Result:
(removed)

#4
position -50, -50
- result: same or similarily positioned square as #1 or #3

#5
position -75, -75 and above
- result: not drawn (same as #2)


Full code:
wxSFML.h => http://pastebin.com/uMnauuZ1
wxSFML.cpp => http://pastebin.com/SKSw6gLk

Creation code:
cstScene = new wxSFMLCanvas(this,ID_CUSTOM1,wxPoint(332,332),wxDefaultSize);
(cstScene is docked as center in AUI (advanced UI) in wxWidgets.


THE PROBLEM (OBVIOUS):
unable to draw sprite/texture on center on proper position
« Last Edit: July 05, 2015, 08:33:13 pm by Anthony11 »

Anthony11

  • Newbie
  • *
  • Posts: 38
    • View Profile
Re: Drawing problem (SFML in wxWidgets)
« Reply #1 on: July 04, 2015, 08:41:29 pm »
I realised that width should be positive, but that led me towards another error.

Link to video (my error encounter):
« Last Edit: July 05, 2015, 08:32:45 pm by Anthony11 »

Anthony11

  • Newbie
  • *
  • Posts: 38
    • View Profile
Re: Drawing problem (SFML in wxWidgets)
« Reply #2 on: July 04, 2015, 09:49:22 pm »
Is it possible that i'm the only one with this issue? Does anyone have a fully functional SFML integration code with wxWidgets?
(removed)
« Last Edit: July 05, 2015, 08:32:55 pm by Anthony11 »

Anthony11

  • Newbie
  • *
  • Posts: 38
    • View Profile
Re: Drawing problem (SFML in wxWidgets)
« Reply #3 on: July 04, 2015, 11:41:33 pm »
Nevenrmind, after hours of pain I've managed to solve it. It appears that I have forgotten to add a resize event which should have been called from the start.

 

anything