|
using only one window (not win32) |
IronBob
Member #3,248
February 2003
|
i want to use only one window. when it starts the program it opens a console and then another window. how do i keep it to one window. i looked in docs and it said win_set_window(HWND wnd); ... but im not using win32 in the program and i cant use the HWND. how do i get it to only one window outside of win32. |
23yrold3yrold
Member #1,134
March 2001
|
Compile (or rather, link) with the -mwindows switch. -- |
IronBob
Member #3,248
February 2003
|
ok it works. but ive got one more question. how can i stop it from saying the thing about "closing the program my cause errors" when i click the X. |
DanielH
Member #934
January 2001
|
Check the manual under Using Allegro. int set_close_button_callback(void (*proc)(void)); |
IronBob
Member #3,248
February 2003
|
ok i cant find set_close_button_callback(). all i see is set_window_close_hook() and set_window_close_button(). [edit]i figured out that its set_window_close_hook() that im looking for but i dont know what i need to enter as an argument for it to close without asking for the "loss of data" thing. |
Wetimer
Member #1,622
November 2001
|
void close_my_game() in main: <code>if(Windows.State = Crash) Computer.halt();</code> |
spellcaster
Member #1,493
September 2001
|
Aren't the set_windows_close_XXX functions depricated? -- |
Evert
Member #794
November 2000
|
Quote: Compile (or rather, link) with the -mwindows switch. Better still, link with --Wl,--subsystem,windows instead. -mwindows, while shorter and easier to remember, is depricated. Quote: Aren't the set_windows_close_XXX functions depricated? Yes, but emulated for backward compatibility. |
gnolam
Member #2,030
March 2002
|
How 'bout int set_close_button_callback(void (*proc)(void)); then - that one isn't deprecated, right? -- |
spellcaster
Member #1,493
September 2001
|
But if they are depricated, doesn't this mean that they Just curious... -- |
Evert
Member #794
November 2000
|
Quote: But if they are depricated, doesn't this mean that they
they didn't work as expected. By default, the closebutton handler would close the Allegro window from a callback function, which was something the docs explicidly told you not to do. |
spellcaster
Member #1,493
September 2001
|
Quote: Hence, a better alternative was introduced, Ok, what is the better alternative? -- |
Evert
Member #794
November 2000
|
Quote: Ok, what is the better alternative? Disable the close button unless the user registers a callback function (using set_close_button_callback()), because it doesn't do anything useful if s/he doesn't. Frankly, it looks more like a bugfix to me, since Allegro's original handler was broken... |
IronBob
Member #3,248
February 2003
|
ok well i already tryed using the int set_close_button_callback(void (*proc)(void)); and it says "proc" not found. if i cant get that to work should i just use an empty function? |
Evert
Member #794
November 2000
|
Quote: and it says "proc" not found. if i cant get that to work should i just use an empty function?
Post some code, please. void my_callback(void) { //do some stuff } ... set_close_button_callback(my_callback);
|
IronBob
Member #3,248
February 2003
|
#include <allegro.h> int main() { allegro_init(); install_keyboard(); set_color_depth(16); set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0); set_window_close_hook(void (*proc)(void)); readkey(); return 0; } END_OF_MAIN();
|
MiquelFire
Member #3,110
January 2003
|
It should be: void func_name(void) int main() --- |
spellcaster
Member #1,493
September 2001
|
Oh come on.. Winston posted the solution to your problem already. Please. Pleeeeeeeeeeeeeeeeeeeeeeeeeeeeease. -- |
IronBob
Member #3,248
February 2003
|
ok fine ... i got it. |
|