Пример #1
0
LRESULT CALLBACK WndProcGL(HWND hwnd, UINT message,
      WPARAM wparam, LPARAM lparam)
{
   LRESULT ret;
   bool quit = false;
   settings_t *settings     = config_get_ptr();

   switch (message)
   {
      case WM_SYSCOMMAND:
      case WM_CHAR:
      case WM_KEYDOWN:
      case WM_KEYUP:
      case WM_SYSKEYUP:
      case WM_SYSKEYDOWN:
      case WM_CLOSE:
      case WM_DESTROY:
      case WM_QUIT:
      case WM_SIZE:
      case WM_COMMAND:
         ret = WndProcCommon(&quit, hwnd, message, wparam, lparam);
         if (quit)
            return ret;
         break;
      case WM_CREATE:
         create_graphics_context(hwnd, &g_quit);
         return 0;
   }

   if (dinput_wgl && dinput_handle_message(dinput_wgl, message, wparam, lparam))
      return 0;
   return DefWindowProc(hwnd, message, wparam, lparam);
}
Пример #2
0
int main(void) {
  xcb_window_t window;
  xcb_gcontext_t graphics_context;
  
  connection = xcb_connect(NULL, NULL); // Callers need to use xcb_connection_has_error() to check for failure.
  screen = xcb_setup_roots_iterator(xcb_get_setup(connection)).data;
  
  window = create_window();
  graphics_context = create_graphics_context(window);
  
  xcb_flush(connection);
  
  event_loop(window, graphics_context);
  puts("bye!");
  
  return EXIT_SUCCESS;
}
Пример #3
0
LRESULT CALLBACK WndProcGL(HWND hwnd, UINT message,
      WPARAM wparam, LPARAM lparam)
{
   LRESULT ret;
   bool quit = false;

   if (message == WM_NCLBUTTONDBLCLK)
      doubleclick_on_titlebar = true;

   switch (message)
   {
      case WM_DROPFILES:
      case WM_SYSCOMMAND:
      case WM_CHAR:
      case WM_KEYDOWN:
      case WM_KEYUP:
      case WM_SYSKEYUP:
      case WM_SYSKEYDOWN:
      case WM_CLOSE:
      case WM_DESTROY:
      case WM_QUIT:
      case WM_SIZE:
      case WM_COMMAND:
         ret = WndProcCommon(&quit, hwnd, message, wparam, lparam);
         if (quit)
            return ret;
         break;
      case WM_CREATE:
         {
            ui_window_win32_t win32_window;
            win32_window.hwnd           = hwnd;

            create_graphics_context(hwnd, &g_quit);

            ui_window_win32_set_droppable(&win32_window, true);
         }
         return 0;
   }

   if (dinput_wgl && dinput_handle_message(dinput_wgl, message, wparam, lparam))
      return 0;
   return DefWindowProc(hwnd, message, wparam, lparam);
}
Пример #4
0
int main(void) {
  xcb_window_t window;
  xcb_gcontext_t graphics_context;
  xcb_pixmap_t pixmap;
  
  connection = xcb_connect(NULL, NULL); // Callers need to use xcb_connection_has_error() to check for failure.
  screen = xcb_setup_roots_iterator(xcb_get_setup(connection)).data;
  
  window = create_window();
  graphics_context = create_graphics_context(window);
  pixmap = xcb_create_pixmap_from_bitmap_data(connection, window,
					      neko_bits, neko_width, neko_height,
					      screen->root_depth, screen->black_pixel, screen->white_pixel,
					      NULL);
  if(!pixmap) puts("NEKO ERROR");
  
  xcb_flush(connection);
  
  event_loop(window, graphics_context, pixmap);
  puts("bye!");
  
  return EXIT_SUCCESS;
}