/* acc_open() * ===================================================================== * Accessory Open Messages * * IN: int *msg: message buffer; * OUT: void * * GLOBAL: WINFO w: window structure * int ctrl_id: application id */ void acc_open( const int *msg ) { if( msg[4] == ctrl_id ) { if( w.id == NO_WINDOW ) { if( xres >= MIN_RESOLUTION ) { if( Create_Window() ) { ActiveTree( ad_front ); initialize(); open_window(); Activity(); } else form_alert( 1, alert13 ); } else form_alert( 1, wider ); } else wind_set( w.id, WF_TOP ); } }
/* wind_init() * ===================================================================== * Initialize window structure. */ void wind_init( void ) { if(( AES_Version >= 0x0330 ) && ( gl_ncolors > LWHITE ) ) { Do3D(); } init_window(); if( _app ) { if( xres >= MIN_RESOLUTION ) { if( Create_Window() ) { ActiveTree( ad_front ); initialize(); open_window(); graf_mouse( ARROW, 0L ); Activity(); } else form_alert( 1, alert13 ); } else { form_alert( 1, wider ); gem_exit( 0 ); } } }
int main(int argc, char* argv[]) { Window win,child; win = Create_Window(10,10,300,300); SetWindowTitle(win,"Fereastra"); WindowBorder(win,false); ShowWindow(win); CloseWindow(); return 0; }
LRESULT CALLBACK WndProc( HWND hWnd, UINT nMessage, WPARAM wParam, LPARAM lParam ) { RECT ClientRect; switch (nMessage) { case WM_CREATE_IRC_WINDOW: if (Hash_Get(pHash, (char*)wParam)) { ContextIRC.hCurrentWindow = Hash_Get(pHash, (char*)wParam); } else { static HWND __hWnd__; __hWnd__ = Create_Window(__hWnd__, hWnd); if (((char*)wParam)[0] == '#') { ShowWindow(ContextIRC.hCurrentWindow, SW_HIDE); ContextIRC.hCurrentWindow = __hWnd__; strArray_Add(ChannelNames, szChannel); Hash_Insert(pHash, ContextIRC.hCurrentWindow, (char*)wParam); ShowWindow(Hash_Get(pHash, (char*)wParam), SW_SHOW); ResizeWindows(ContextIRC.dwOldWidth, ContextIRC.dwOldHeight); SendMessage(ContextIRC.hCurrentWindow, WM_SETFONT, (WPARAM)ContextIRC.hFont, (LPARAM)TRUE); } else { ContextIRC.hCurrentWindow = Array_Index(pArray, Array_Num(pArray)); ContextIRC.hCurrentWindow = __hWnd__; Hash_Insert(pHash, ContextIRC.hCurrentWindow, (char*)wParam); ResizeWindows(ContextIRC.dwOldWidth, ContextIRC.dwOldHeight); SendMessage(ContextIRC.hCurrentWindow, WM_SETFONT, (WPARAM)ContextIRC.hFont, (LPARAM)TRUE); } ContextIRC.hCurrentWindow = Array_Index(pArray, Array_Num(pArray)); Hash_Insert(pHash, ContextIRC.hCurrentWindow, (char*)wParam); SendMessage(ContextIRC.hCurrentWindow, WM_SETFONT, (WPARAM)ContextIRC.hFont, (LPARAM)TRUE); break; } case WM_CREATE: pArray = Array_Init(pArray); ContextIRC.hCurrentWindow = Create_Window(ContextIRC.hCurrentWindow, hWnd); ContextIRC.hFont = InitFont(ContextIRC.hCurrentWindow); ContextIRC.hTypeBuffer = InitTypeBuffer(ContextIRC.hFont, hWnd); ContextIRC.hParentProc = SetWindowLongPtr(ContextIRC.hTypeBuffer, GWL_WNDPROC, (LONG_PTR)TypeBufferProc); ContextIRC.hNetworkThread = CreateThread(NULL, 0, Connect, NULL, 0, &ContextIRC.hNetworkThreadID); break; case WM_DESTROY: DestroyContext(); PostQuitMessage(0); break; case WM_HOTKEY: { register uint32_t nIndex = 0; if (wParam == IRCContext->LeftKey) { if (Array_Num(pArray) <= 0) break; for (nIndex = Array_Num(pArray); nIndex > 0; nIndex--) { if (ContextIRC.hCurrentWindow == Array_Index(pArray, 0)) { ShowWindow(ContextIRC.hCurrentWindow, SW_HIDE); ContextIRC.hCurrentWindow = Array_Index(pArray, Array_Num(pArray)); strcpy_s(szChannel, 96, strArray_Index(ChannelNames, strArray_Num(ChannelNames))); ShowWindow(ContextIRC.hCurrentWindow, SW_SHOW); MoveWindow(ContextIRC.hCurrentWindow, 0, 0, ContextIRC.dwOldWidth, ContextIRC.dwOldHeight, TRUE); break; } nIndex--; ShowWindow(ContextIRC.hCurrentWindow, SW_HIDE); ContextIRC.hCurrentWindow = Array_Index(pArray, nIndex); strcpy_s(szChannel, 96, strArray_Index(ChannelNames, nIndex - 1)); ShowWindow(ContextIRC.hCurrentWindow, SW_SHOW); MoveWindow(ContextIRC.hCurrentWindow, 0, 0, ContextIRC.dwOldWidth, ContextIRC.dwOldHeight, TRUE); break; } } if (wParam == IRCContext->RightKey) { for (nIndex = 0; nIndex <= Array_Num(pArray); nIndex++) { if (Array_Num(pArray) <= 0) break; if (ContextIRC.hCurrentWindow == Array_Index(pArray, nIndex)) { if (ContextIRC.hCurrentWindow == Array_Index(pArray, Array_Num(pArray))) { ShowWindow(ContextIRC.hCurrentWindow, SW_HIDE); ContextIRC.hCurrentWindow = Array_Index(pArray, 0); strcpy_s(szChannel, 96, strArray_Index(ChannelNames, 0)); ShowWindow(ContextIRC.hCurrentWindow, SW_SHOW); MoveWindow(ContextIRC.hCurrentWindow, 0, 0, ContextIRC.dwOldWidth, ContextIRC.dwOldHeight, TRUE); break; } nIndex++; ShowWindow(ContextIRC.hCurrentWindow, SW_HIDE); ContextIRC.hCurrentWindow = Array_Index(pArray, nIndex); strcpy_s(szChannel, 96, strArray_Index(ChannelNames, nIndex - 1)); ShowWindow(ContextIRC.hCurrentWindow, SW_SHOW); MoveWindow(ContextIRC.hCurrentWindow, 0, 0, ContextIRC.dwOldWidth, ContextIRC.dwOldHeight, TRUE); break; } } } break; } case WM_SIZE: ResizeWindows(LOWORD(lParam), HIWORD(lParam) - IRCContext->nTypeHeight); GetClientRect(hWnd, &ClientRect); ContextIRC.dwOldWidth = LOWORD(lParam); ContextIRC.dwOldHeight = HIWORD(lParam); MoveWindow(ContextIRC.hTypeBuffer, 0, ClientRect.bottom - IRCContext->nTypeHeight, LOWORD(lParam), IRCContext->nTypeHeight, TRUE); break; default: return DefWindowProc(hWnd, nMessage, wParam, lParam); } return 0; }
int lincity_main (int argc, char *argv[]) { #if defined (LC_X11) char *geometry = NULL; #endif #if defined (SVGALIB) int q; vga_init (); #endif #if !defined (WIN32) signal (SIGPIPE, SIG_IGN); /* broken pipes are ignored. */ #endif /* Initialize some global variables */ make_dir_ok_flag = 1; main_screen_originx = 1; main_screen_originy = 1; given_scene[0] = 0; quit_flag = network_flag = load_flag = save_flag = prefs_flag = cheat_flag = monument_bul_flag = river_bul_flag = shanty_bul_flag; prefs_drawn_flag = 0; kmouse_val = 8; #ifdef LC_X11 borderx = 0; bordery = 0; parse_xargs (argc, argv, &geometry); #endif /* I18n */ lincity_set_locale (); /* Set up the paths to certain files and directories */ init_path_strings (); /* Make sure that things are installed where they should be */ verify_package (); /* Make sure the save directory exists */ check_savedir (); /* Load preferences */ load_lincityrc (); #ifndef CS_PROFILE #ifdef SEED_RAND srand (time (0)); #endif #endif #ifdef LC_X11 #if defined (commentout) borderx = 0; bordery = 0; parse_xargs (argc, argv, &geometry); #endif Create_Window (geometry); pirate_cursor = XCreateFontCursor (display.dpy, XC_pirate); #elif defined (WIN32) /* Deal with all outstanding messages */ ProcessPendingEvents (); #else parse_args (argc, argv); q = vga_setmode (G640x480x256); gl_setcontextvga (G640x480x256); #endif #if defined (WIN32) || defined (LC_X11) initialize_pixmap (); #endif init_fonts (); #if defined (SKIP_OPENING_SCENE) skip_splash_screen = 1; #endif if (!skip_splash_screen) { load_start_image (); } #ifdef LC_X11 unlock_window_size (); #endif Fgl_setfont (8, 8, main_font); Fgl_setfontcolors (TEXT_BG_COLOUR, TEXT_FG_COLOUR); initialize_geometry (&scr); #if defined (SVGALIB) set_vga_mode (); #endif initialize_monthgraph (); init_mouse_registry (); init_mini_map_mouse (); #ifdef LC_X11 x_key_value = 0; #elif defined (WIN32) RefreshScreen (); #endif setcustompalette (); draw_background (); prog_box (_("Loading the game"), 1); init_types (); init_modules(); init_mappoint_array (); initialize_tax_rates (); prog_box ("", 95); mouse_hide_count = 0; suppress_ok_buttons = 0; prog_box ("", 100); #ifdef USE_PIXMAPS prog_box (_("Creating pixmaps"), 1); init_pixmaps (); prog_box ("", 100); #endif //draw_normal_mouse (1, 1); #if defined (LC_X11) init_x_mouse (); #endif init_timer_buttons(); mouse_initialized = 1; //set_selected_module (CST_TRACK_LR); screen_setup (); /* Main loop! */ client_main_loop (); #if defined (SVGALIB) mouse_close (); vga_setmode (TEXT); #endif print_results (); #if defined (WIN32) || defined (LC_X11) free_pixmap (); #endif #if defined (WIN32) return 0; #else exit (0); #endif }