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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - xumepoc

Pages: 1 2 [3] 4
31
Window / Re: MFC and SFML Window problem
« on: March 27, 2014, 09:32:57 am »
Because it is a CDialog project. Than means that in order to have just a simple Window, you need:

Resource.h
SFML_TEST.h
SFML_TESTDlg.h
stdafx.h
targetver.h

SFML_TEST.rc
SFML_TEST.rc2

SFML_TEST.cpp
SFML_TESTDlg.cpp
stdafx.cpp

All these files are generated by VS when you open a new, clean CDilaog project. On top of that is my simple SFML_CL class.

I can't simply convert that in a few lines of code or in a simple main(), simply because it will not work. And you will not see the problem as it is now.

The explanations states
It is important that:
the code is complete, so people can test it
the code is as simple as possible, the best is one main() with all the code inside -- people don't want to setup a complex project just to test your code
the code reproduces the initial problem
the application doesn'
t depend on external resource files (unless it's related to the problem)

Well if some can explain how to convert a MFC CDialog project in a single simple file I would more then happy to do it. Again the problem is in the interconnection of MFC and SFML, so without the minimal CDilaog project files I can't show you anything useful that will help my problem.

I am really not making an argument here, just want to explain that I can't do what you what from me via a simple 20 lines program.
 

32
Window / Re: MFC and SFML Window problem
« on: March 27, 2014, 09:10:35 am »
I did, but should I also post all 13 files, plus the .sln file? Because in order to have a working complete and minimal code you would need all of these files  ??? ;D

I can't modify the code to be in main(), because that will remove the problem part of the project, which is the MFC CDialog with SFML.

I can post all of the files, but I though it would be easy to understand to simply upload the demo project.

33
Window / Re: MFC and SFML Window problem
« on: March 27, 2014, 08:53:39 am »
Here is the code sample, I am not including the CDialog in its full minimal form because it will take too much space, but I can create a minimalistic project and uploaded for anyone who wants to test it.
CDialog:

This is the defined _SFML variable
SFML_CL _SFML

This is the pseudo code of the main CDialog class
BOOL CClassTestsDlg::OnInitDialog()
{
 CDialog::OnInitDialog();

 FIRSTRESIZE = true;
 HWND hWND = GetSafeHwnd();

 _SFML.Initialize(hWND);

return TRUE;
}
void CClassTestsDlg::OnSize(UINT nType, int cx, int cy){
 if(FIRSTRESIZE){
      SetWindowPos(&CWnd::wndTopMost , 0, 0, 500, 500 ,SWP_SHOWWINDOW|SWP_NOZORDER );
      FIRSTRESIZE = false;
   }
 CDialog::OnSize(nType, cx, cy);
}
void CClassTestDlg::ChangeSize()
{
 SetWindowPos(&CWnd::wndTopMost ,0,0,700,700,SWP_SHOWWINDOW|SWP_NOZORDER);
}
 

SFML_CL:

#pragma once
#include <SFML/Graphics.hpp>


class SFML_CL
{
public:
        SFML_CL(void);
        virtual ~SFML_CL(void);
        void Initialize(HWND hWnd);
        void Render();

protected:
        HWND hWND;
        sf::RenderWindow *ttl2D;
     sf::Font font;
     COLORREF ColorBG;
};

SFML_CL::SFML_CL(void)
{
        ttl2D = NULL;
    ColorBG = RGB(90,90,90);
}

SFML_CL::~SFML_CL(void)
{
        delete ttl2D;
}
void SFML_CL::Initialize(HWND hWnd)
{
        hWND = hWnd;
        sf::ContextSettings ws;
        ws.antialiasingLevel = 8;

        ttl2D = new sf::RenderWindow( hWND,ws );
        ttl2D->setVerticalSyncEnabled(true);

        font.loadFromFile("res/Arial.otf");
}
void SFML_CL::Render()
{
        sf::Color color(GetRValue(ColorBG ),GetGValue(ColorBG ),GetBValue(ColorBG ),255);
        ttl2D->clear(color);

    sf::Text text;
        text.setCharacterSize(13);
        text.setColor(sf::Color::White);
        text.setPosition(20,80);

    CRect rect;
        GetClientRect(hWND,rect);
        CString fp;
        fp.Format("%d (%d : %d %d %d %d)",ttl2D->getSize().x,ttl2D->getSize().y,rect.left,rect.top,rect.Width(),rect.Height());
        text.setString(fp.GetBuffer());
        fp.ReleaseBuffer();
        text.setPosition(20,150);
        ttl2D->draw(text);

        ttl2D->display();
}

This will result in a constant values for ttl2D->getSize().x and ttl2D->getSize().y, but the rect coordinates will be updated accordingly

34
Window / Re: MFC and SFML Window problem
« on: March 27, 2014, 08:22:24 am »
Of course not, that is why I said I will post a pseudo code that will include only the relative parts of the program that are in connection to the problem.  ;)

35
Window / Re: MFC and SFML Window problem
« on: March 27, 2014, 06:08:28 am »
Wouldn't that will be a bit hard, because the problem is exactly in the use of CDialog and SFML, so it can't be as minimal as described in the links.

36
Window / Re: MFC and SFML Window problem
« on: March 26, 2014, 09:46:59 pm »
Well its either not working correctly or I am not doing it correctly. I will post a pseudo code tomorrow to show you what I am doing.

37
Window / Re: MFC and SFML Window problem
« on: March 26, 2014, 06:29:13 pm »
I am doing that, but it has no effect. I am passing a HWND from the CDialog in order to create the RenderWindow. I then resize the CDialog window and pass the size to the RenderWindow's setSize() too. The result it that the CDialog is resized, but the drawing "stops" in the old size of the RenderWindow.

38
Window / Re: MFC and SFML Window problem
« on: March 26, 2014, 05:12:36 pm »
So there is no way to resize the RenderWindow?

39
Window / Re: MFC and SFML Window problem
« on: March 26, 2014, 03:42:14 pm »
Using MFC is not the problem here.

setSize() is not doing anything on the RenderWindow when set. I can't make it change.

The focus is also strange, because I can use all othe mouse functions, except the mouse wheel.

40
Window / Re: MFC and SFML Window problem
« on: March 26, 2014, 12:30:04 pm »
Any one? ;D ;D ;D

41
Window / MFC and SFML Window problem
« on: March 25, 2014, 06:08:00 am »
Hi everyone.
I have a CDialog with SFML RenderWindow created in a separated class. Everything is working OK, with the exception of two things.

1. Because I want to keep the CDialog events instead of the SFML I have problem that I loose the focus for mouse wheel event. I can use the mouse and the buttons, but the mouse wheel event is not triggered until I use the right button and click on the menu on the Windows bar where the programs icon is. And after I click outside of the  program I loose the focus again. Is there a workaround this?

2. How can I resize SFML window. I use custom events to resize the CDialog window using SetWindowPos().

42
Graphics / Re: Help with mono spaced font
« on: March 24, 2014, 08:28:08 pm »
The font issue is fixed. It turns out that if I use .oft variant of the font, everything is OK, with .ttf I get the result in the first post.

Now I have small problem with resizing, but will post in the corresponding section ;D ;D

43
Graphics / Re: Help with mono spaced font
« on: March 23, 2014, 03:17:37 pm »
Yes, and with the old original 2.1 build everything was OK.
I guess I just can't build it right. I guess will wait for the official next release.

44
Graphics / Re: Help with mono spaced font
« on: March 22, 2014, 07:05:32 pm »
Sorry
Error   1       error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::setSize(class sf::Vector2<unsigned int>)" (__imp_?setSize@Window@sf@@QAEXV?$Vector2@I@2@@Z) referenced in function "public: void __thiscall HMI_SFML::Resize(float,float)" (?Resize@HMI_SFML@@QAEXMM@Z)    HMI_SFML.obj
 

45
Graphics / Re: Help with mono spaced font
« on: March 22, 2014, 03:45:01 pm »
Guys I have a little problem, when I compile the source I get a linker error for sf::Window::setSize()

Pages: 1 2 [3] 4
anything