|
Native message boxes error |
Tenderenden
Member #16,160
January 2016
|
Hi EDIT: I forgot to mention that I'm using Visual Studio 15 and Allegro 5.2.2 installed via NuGet. My code: 1#include <stdio.h>
2#include <allegro5/allegro.h>
3#include <allegro5/allegro_native_dialog.h>
4#include <iostream>
5using namespace std;
6int main() {
7
8 ALLEGRO_DISPLAY *display = NULL;
9
10 if (!al_init()) {
11 cout<<"failed to initialize allegro!\n";
12 return -1;
13 }
14
15 display = al_create_display(1280, 720);
16 if (!display) {
17 cout<<"failed to create display!\n";
18 return -1;
19 }
20 al_clear_to_color(al_map_rgb(100, 15, 0));
21 al_flip_display();
22 al_rest(5.0);
23 al_show_native_message_box(display, "Dialog", "Epic Win!", "Nice one you got there!\nAllegro sucesfully created pop-up window", NULL, NULL);
24 al_destroy_display(display);
25 return 0;
26}
|
Eric Johnson
Member #14,841
January 2013
|
I think you have to initialize the native dialog addon before using it. Something like this: if (!al_init_native_dialog_addon()) { cout << "Failed to initialize native dialog addon!\n"; return -1; }
|
Tenderenden
Member #16,160
January 2016
|
@Eric Johnson What is more, in Allegro5 manual I found this: So I guess if you don't have to initialise main allegro library, you don't have to initialise that as well. BTW Thanks for quick response |
Eric Johnson
Member #14,841
January 2013
|
Huh, I could have sworn it was required. My mistake. Are you linking with allegro_dialog-5? I compiled on Linux like this and your code worked: g++ -Wall -o dialog dialog.c $(pkg-config --libs allegro-5 allegro_dialog-5)
|
Tenderenden
Member #16,160
January 2016
|
Oh my God!
Thank you so much! For anyone having same issue: |
Eric Johnson
Member #14,841
January 2013
|
Glad it's working for you now.
|
|