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

Author Topic: MFC and SFML Window problem  (Read 16769 times)

0 Members and 1 Guest are viewing this topic.

xumepoc

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Re: MFC and SFML Window problem
« Reply #30 on: March 29, 2014, 05:30:57 pm »
Thanks, I am aware of the problem, but I can simply manually resend toSFML, don't I?

xumepoc

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Re: MFC and SFML Window problem
« Reply #31 on: March 31, 2014, 09:33:02 am »
Well I have a small problem with Qt and SFML. The loadFromFile() for a font is always false and when I use that font, it of course crashed the program.

Any tips? The path to the font is correct. I get the same result even when I type in the full path.

I have included the .dll files in the root folder of the project. Is this correct or they have to be somewhere else too.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: MFC and SFML Window problem
« Reply #32 on: March 31, 2014, 10:17:26 am »
The standard output should give more details about the failure.
Laurent Gomila - SFML developer

xumepoc

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Re: MFC and SFML Window problem
« Reply #33 on: March 31, 2014, 11:07:01 am »
Well I am having a nightmare with linking problems for SFML. I simply can't figure this out.

This is the .pro file

#-------------------------------------------------
#
# Project created by QtCreator 2014-03-31T11:57:25
#
#-------------------------------------------------

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = Test2
TEMPLATE = app


SOURCES += main.cpp\
        mainwindow.cpp \
    global_objects.cpp \
    MyCanvas.cpp \
    QSFMLCanvas.cpp

HEADERS  += mainwindow.h \
    global_objects.h \
    MyCanvas.h \
    QSFMLCanvas.h

FORMS    += mainwindow.ui

LIBS += -LC:/SFML64/lib

CONFIG(release, debug|release): LIBS += -lsfml-audio -lsfml-graphics -lsfml-main -lsfml-network -lsfml-window -lsfml-system
CONFIG(debug, debug|release): LIBS += -lsfml-audio-d -lsfml-graphics-d -lsfml-main-d -lsfml-network-d -lsfml-window-d -lsfml-system-d

INCLUDEPATH += C:/SFML64/include

I have a linker error for everything connected with SFML (
MyCanvas.obj:-1: error: LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl sf::Clock::Clock(void)" (__imp_??0Clock@sf@@QEAA@XZ) referenced in function "public: __cdecl MyCanvas::MyCanvas(class QWidget *,class QPoint const &,class QSize const &)" (??0MyCanvas@@QEAA@PEAVQWidget@@AEBVQPoint@@AEBVQSize@@@Z)
like that)
I was working OK for a while, then I replaced the SFML files again and now I have that.
« Last Edit: March 31, 2014, 11:08:56 am by xumepoc »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: MFC and SFML Window problem
« Reply #34 on: March 31, 2014, 11:48:13 am »
Quote
then I replaced the SFML files again
Replaced with what?
Laurent Gomila - SFML developer

xumepoc

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Re: MFC and SFML Window problem
« Reply #35 on: March 31, 2014, 11:54:35 am »
With the Visual C++ 11 (2012) - 64 bits files. They were the same before, but because I wasn't sure I overwrite them just to be safe.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: MFC and SFML Window problem
« Reply #36 on: March 31, 2014, 12:20:18 pm »
And are you sure that you're using a Visual C++ build of Qt? The default is MinGW.
Laurent Gomila - SFML developer

xumepoc

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Re: MFC and SFML Window problem
« Reply #37 on: March 31, 2014, 12:27:34 pm »
Yes.
I use Qt 5.2.1 for Windows 64-bit (VS 2012, OpenGL, 553 MB) .
« Last Edit: March 31, 2014, 12:29:05 pm by xumepoc »

xumepoc

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Re: MFC and SFML Window problem
« Reply #38 on: March 31, 2014, 02:12:58 pm »
Well after full reinstall of Qt and SFML, everything is no OK, the font is loaded correctly  8) ;D ;D ;D

xumepoc

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Re: MFC and SFML Window problem
« Reply #39 on: April 13, 2014, 06:09:31 pm »
OK guys,
After some days of work I have move the test project from MFC to Qt. But I still have the same problem when I re-size the window. The problem is that the SFML window itself (which is embedded in the QWidget) is re-sizing with it, but the content gets cut as thou the view port is still with the original size of the window when it was created. Here is a picture, the rect should be enlarged, but should be square. You can see that the left part (red ) is cut and is not seen.

https://drive.google.com/file/d/0BwLPPjKzXAi1SVRoTmFVZmdORjA/edit?usp=sharing
Any ideas?

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: MFC and SFML Window problem
« Reply #40 on: April 13, 2014, 06:17:45 pm »
I have to reset the view every time I recreate a window in my SFML program, which has no MFC or Qt or anything attached to it.  Are you resetting yours?

xumepoc

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Re: MFC and SFML Window problem
« Reply #41 on: April 13, 2014, 06:29:40 pm »
 ;D Nope, how to do that?

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: MFC and SFML Window problem
« Reply #42 on: April 13, 2014, 06:52:31 pm »
http://www.sfml-dev.org/tutorials/2.1/graphics-view.php

Though I only had to do that because I was using non-default views, so maybe you're having a different issue.  Still, setting an explicit view after resizing can't hurt.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: MFC and SFML Window problem
« Reply #43 on: April 13, 2014, 07:00:20 pm »
Is it a sf::Window or a sf::RenderWindow?
Laurent Gomila - SFML developer

xumepoc

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Re: MFC and SFML Window problem
« Reply #44 on: April 13, 2014, 07:09:15 pm »
It is a sf:RenderWindow

 

anything