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

embed qt and allegro in d3d #661

Closed
wants to merge 17 commits into from
Closed

Conversation

vkensou
Copy link

@vkensou vkensou commented Aug 6, 2016

I post a topic on allegro forum https://www.allegro.cc/forums/thread/616419.

It only work in d3d. I don't know how to resize the display in opengl.

It works like this:
p

@@ -92,6 +92,9 @@ struct ALLEGRO_DISPLAY_WIN
int toggle_w;
int toggle_h;

//allegro don't manager the display
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"manage"

@SiegeLord
Copy link
Member

This is interesting, have you tested how this handles display resets? E.g. start your program, press ctrl-alt-delete, cancel out of that and then see if your program still works?

@vkensou
Copy link
Author

vkensou commented Aug 7, 2016

Oh... I didn't handle this. let me fix it.

@vkensou
Copy link
Author

vkensou commented Aug 7, 2016

I made a new commit. Now it could handle device lost. But there are some limits. If let allegro use existing window, you must handle device lost and resize window by yourself. So people must create their own qt or mfc widget. I made a qt widget to help others, so where can i upload it?

@SiegeLord
Copy link
Member

How big is this widget? If it's small enough, we could make a ex_qt example that uses this.

@vkensou
Copy link
Author

vkensou commented Aug 9, 2016

The widget is not big. Just 2 files and less than 200 lines. But it dependence qt.

@SiegeLord
Copy link
Member

That's fine, we have an ex_ogre that depends on Ogre3D. It'll be an optional dependency.

@vkensou
Copy link
Author

vkensou commented Aug 9, 2016

So, should I upload a ex_qt.cpp? But I don't know how to use cmake.

@vkensou
Copy link
Author

vkensou commented Aug 10, 2016

I upload 3 new files. Compile and run succeed in qt 5.5.

@vkensou
Copy link
Author

vkensou commented Aug 13, 2016

There is another problem. My widget can't render bitmap unless use ALLEGRO_MEMORY_BITMAP. I am fixing it....

@vkensou
Copy link
Author

vkensou commented Aug 14, 2016

lol
I have fixed that problem. Now my widget could render bitmap normally.
I added a init() method in QAllegroCanvas. So we can load bitmap or something in this method.

Don't load bitmap in QAllegroCanvas' Constructor. I call init() in showEvent(), and it worked.

@ghost
Copy link

ghost commented Aug 25, 2016

This could get the window size from the HWND and use it rather than the values passed to al_create_display. Those would be ignored kind of like they are for FULLSCREEN_WINDOW.

@vkensou
Copy link
Author

vkensou commented Aug 26, 2016

You mean ignore FULLSCREEN_WINDOW when use exist window?

@ghost
Copy link

ghost commented Aug 26, 2016

No I meant do you think it would be better if the patch determined the size of the ALLEGRO_DISPLAY based on the HWND the user uses?

@ghost
Copy link

ghost commented Aug 26, 2016

There are functions like GetWindowRect that can get the size from an HWND.

@vkensou
Copy link
Author

vkensou commented Sep 7, 2016

I have make a new commit. It worked.

m_display = al_create_display(0, 0);
int w = al_get_display_width(m_display);
int h = al_get_display_height(m_display);

The code will get right width and height.

@ghost
Copy link

ghost commented Sep 8, 2016

Thanks for changing that!

@vkensou
Copy link
Author

vkensou commented Sep 10, 2016

A new commit!
Fix QAllegroCanvas can't init al_display's size correctly.

@vkensou vkensou closed this by deleting the head repository Sep 23, 2024
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

Successfully merging this pull request may close these issues.

2 participants