Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate nana with Directx #672

Open
edgarbernal5 opened this issue Mar 14, 2023 · 1 comment
Open

Integrate nana with Directx #672

edgarbernal5 opened this issue Mar 14, 2023 · 1 comment

Comments

@edgarbernal5
Copy link

edgarbernal5 commented Mar 14, 2023

Hi! I want to know if nana supports DirectX graphics api, so far I've seen examples of using with OpenGL, not sure if will work.

I have a ScenePanel that has a widget where at the end will be used as a surface. I must have the size of the widget in order to create a swap chain, I cannot be able to! Every time I get the size returns x=0, y=0. Here is the code:

ScenePanel::ScenePanel(nana::window window, bool visible) :
nana::panel(window, nana::rectangle(), visible)
{
m_place.bind(*this);
m_renderWidget.create(m_place.window_handle());

m_renderWidget.show();
auto wh = reinterpret_cast<HWND>(m_renderWidget.handle());
m_place.div("margin=20 <view>");
m_place["view"] << m_renderWidget;
m_place.collocate();

auto renderSize = m_renderWidget.size();

SurfaceWindowParameters parameters;
parameters.Width = renderSize.width;
parameters.Height = renderSize.height;
parameters.WindowHandle = wh;

Surface surface(GetDevice(), parameters);
surface.Initialize();

}

Somewhere in the main window I have this:
m_place->dock("pane1", "f1");

Anyone has struggled with that situation?
Thanks for you time!! I'd really appreciate this!

@edgarbernal5
Copy link
Author

Finally I managed to get it run! Later I'll post a tutorial with github demo project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant