diff --git a/src/engine.c b/src/engine.c index afb09258..38fee55d 100644 --- a/src/engine.c +++ b/src/engine.c @@ -1599,11 +1599,20 @@ void Main_handler(void) //----------------------- Tracer une fenêtre d'options ----------------------- -void Open_window(word width,word height, const char * title) -// Lors de l'appel à cette procédure, la souris doit être affichée. -// En sortie de cette procedure, la souris est effacée. +/** + * Open a GUI window + * + * @param width window width + * @param height window height + * @param title window title + * + * The mouse must be shown before calling this function. The mouse is hidden + * when the function returns. + * + * The function Close_window() must be called afterward. + */ +void Open_window(word width, word height, const char * title) { - //word i,j; size_t title_length; Hide_cursor(); @@ -1620,6 +1629,12 @@ void Open_window(word width,word height, const char * title) Windows_open++; + // Limit the window size to the screen size + if (width > Screen_width) + width = Screen_width; + if (height > Screen_height) + height = Screen_height; + Window_width=width; Window_height=height; @@ -1627,6 +1642,8 @@ void Open_window(word width,word height, const char * title) Window_pos_X=(Screen_width-(width*Menu_factor_X))>>1; Window_pos_Y=(Screen_height-(height*Menu_factor_Y))>>1; + + GFX2_Log(GFX2_DEBUG, "Open_window(%d, %d, \"%s\") pos (%d,%d)\n", width, height, title, Window_pos_X, Window_pos_Y); Window_draggable=1; @@ -1682,9 +1699,13 @@ void Open_window(word width,word height, const char * title) //----------------------- Fermer une fenêtre d'options ----------------------- +/** + * Close a window previously open with Open_window() + * + * The mouse must be shown when this functions is called. + * It is hidden when the function returns. + */ void Close_window(void) -// Lors de l'appel à cette procedure, la souris doit être affichée. -// En sortie de cette procedure, la souris est effacée. { T_Normal_button * temp1; T_Palette_button * temp2;