languages

A collection of programs made with different programming languages.
git clone git://evanalba.com/languages
Log | Files | Refs

main.cpp (1258B)


      1 #include <flutter/dart_project.h>
      2 #include <flutter/flutter_view_controller.h>
      3 #include <windows.h>
      4 
      5 #include "flutter_window.h"
      6 #include "utils.h"
      7 
      8 int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
      9                       _In_ wchar_t *command_line, _In_ int show_command) {
     10   // Attach to console when present (e.g., 'flutter run') or create a
     11   // new console when running with a debugger.
     12   if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
     13     CreateAndAttachConsole();
     14   }
     15 
     16   // Initialize COM, so that it is available for use in the library and/or
     17   // plugins.
     18   ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
     19 
     20   flutter::DartProject project(L"data");
     21 
     22   std::vector<std::string> command_line_arguments =
     23       GetCommandLineArguments();
     24 
     25   project.set_dart_entrypoint_arguments(std::move(command_line_arguments));
     26 
     27   FlutterWindow window(project);
     28   Win32Window::Point origin(10, 10);
     29   Win32Window::Size size(1280, 720);
     30   if (!window.Create(L"penny", origin, size)) {
     31     return EXIT_FAILURE;
     32   }
     33   window.SetQuitOnClose(true);
     34 
     35   ::MSG msg;
     36   while (::GetMessage(&msg, nullptr, 0, 0)) {
     37     ::TranslateMessage(&msg);
     38     ::DispatchMessage(&msg);
     39   }
     40 
     41   ::CoUninitialize();
     42   return EXIT_SUCCESS;
     43 }