I had hope that was fundamental problem. Well... Here is code:
B.h
#pragma once
#include <SFML/Graphics.hpp>
#include <Windows.h>
class B {
sf::RenderWindow app;
public:
B( HWND windowHandle ) : app(windowHandle) { }
void draw() {
app.clear( sf::Color::White );
app.display();
}
};
mainApp.h
#pragma once
#include "B.h"
namespace Project {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Summary for mainApp
/// </summary>
public ref class mainApp : public System::Windows::Forms::Form
{
B * b;
public:
mainApp(void)
{
InitializeComponent();
b = new B( static_cast<HWND>(panel3->Handle.ToPointer()) );
}
void draw() {
b->draw();
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~mainApp()
{
delete b;
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Panel^ panel3;
private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(mainApp::typeid));
this->panel3 = (gcnew System::Windows::Forms::Panel());
this->SuspendLayout();
//
// panel3
//
this->panel3->Dock = System::Windows::Forms::DockStyle::Fill;
this->panel3->Location = System::Drawing::Point(3, 16);
this->panel3->Name = L"panel3";
this->panel3->Size = System::Drawing::Size(160, 256);
this->panel3->TabIndex = 1;
//
// mainApp
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(948, 566);
this->Name = L"mainApp";
this->Text = L"mainApp";
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
};
}
main.cpp
#include "mainApp.h"
using namespace System;
[STAThreadAttribute]
int main()
{
Project::mainApp mainApp;
mainApp.Show();
while (true) {
System::Windows::Forms::Application::DoEvents();
mainApp.draw();
}
return 0;
}
mainApp.h have some code, but most of it is auto generated.