Пример #1
0
int APIENTRY _tWinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPTSTR    lpCmdLine,
                     int       nCmdShow)
{
   UNREFERENCED_PARAMETER(hPrevInstance);
   UNREFERENCED_PARAMETER(lpCmdLine);
   logger.Open("output.log");
   renderer.SetLogger(&logger);
   game.logger = &logger;//.SetLogger(&logger);
   game.SetRenderer( &renderer );

   MSG msg = {0};
   HACCEL hAccelTable;

   // Initialize global strings
  // LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
   LoadString(hInstance, IDS_STRING101, szWindowClass, MAX_LOADSTRING);
   if (!MyRegisterClass(hInstance)) {
      return FALSE;
   }

   // Perform application initialization:
   if (!InitInstance (hInstance, nCmdShow))
   {
      DWORD x = GetLastError();
      return FALSE;
   }

  // hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_D3DGAME));
   
  // game.Init(hWnd, screenWidth, screenHeight);

   // Main message loop:   
   while (msg.message != WM_QUIT)
   {
      //if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
      if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
      {
         TranslateMessage(&msg);
         DispatchMessage(&msg);
      } else {		
         game.Update();
      }
   }

   return (int) msg.wParam;
}
Пример #2
0
int main() {
    Logger l;
    auto r = l.Open("stdout", Logger::kLevelDebug, 1);
    assert(r== true && "open failed");

    l.SetThreadName("main");


    l.Logv(Logger::kLevelTrace, "hello %s", "world");
    l.Logv(Logger::kLevelDebug, "hello %s", "world");

    std::thread t([&](){
            l.Logv(Logger::kLevelWarn, "hello %s", "world");
            l.SetThreadName("thread-1");
            l.Logv(Logger::kLevelWarn, "hello with name: %s", "world");
        });

    t.join();

    log_open("stdout", Logger::kLevelDebug, 1);
    log_info("hello %s", "world");
}
Пример #3
0
 bool log_open(const std::string &filename, int level, int rotateHour) {
     return g_logger.Open(filename, level, rotateHour);
 }