int start(msgertype * msg) { std::this_thread::sleep_for(std::chrono::seconds(10)); // QDir dir(argv[0]); // e.g. appdir/Contents/MacOS/appname // assert(dir.cdUp()); // assert(dir.cdUp()); // assert(dir.cd("PlugIns")); // e.g. appdir/Contents/PlugIns // QCoreApplication::setLibraryPaths(QStringList(dir.absolutePath())); // printf("after change, libraryPaths=(%s)\n", QCoreApplication::libraryPaths().join(",").toUtf8().data()); // QApplication app(argc, argv); QApplication MainApp(argc, argv); Widget w(0); std::cout << " Hi! I'm inout! \n"; w.show(); MainApp.exec(); /// !!! Временно // sendarman.addconnect(w); // while(true){ // inputoutput->tic(); // }; };
int main(int argc, char** argv) { API_Base* api = new API_MODE; MainApplication MainApp(api); MainApp.Run(); return false; }
int main(int argc, char **argv) { USB.EnumerateHIDs(); USB.HIDOpen(0x3995,0x0001); USB.SetMode(SIMPLE_ASME_DRIVER); USB.HIDDescription(); USB.SendOutputPort((unsigned char) 0xFF); glutInit(&argc, argv); MK_Application MainApp(20,20,1330,900,(char*)"Watchdog Demo v1.1"); Init(); MainApp.DisplayFunc(Display); MainApp.ReshapeFunc(Reshape); MainApp.SpecialFunc(Keyboard); USB.SendOutputPort((unsigned char) 0x00); MainApp.Run(); Textures.DeleteTextures(); sky.DeleteTextures(); return 0; }
BOOL ListDialog::OnInitDialog() { CDialog::OnInitDialog(); // TODO: ここに初期化を追加してください GetWindowRect(m_windowRect); int left = theApp.GetProfileInt(REG_LISTDIALOG, REG_LEFT, m_windowRect.left); int top = theApp.GetProfileInt(REG_LISTDIALOG, REG_TOP, m_windowRect.top); int width = theApp.GetProfileInt(REG_LISTDIALOG, REG_WIDTH, m_windowRect.Width()); int height = theApp.GetProfileInt(REG_LISTDIALOG, REG_HEIGHT, m_windowRect.Height()); m_windowRect = CRect(left, top, left+width, top+height); MoveWindow(m_windowRect, FALSE); update(false); m_initialized = true; MainApp().setListDialog(IListDialog::ptr(new MyListDialog(this))); return TRUE; // return TRUE unless you set the focus to a control // 例外 : OCX プロパティ ページは必ず FALSE を返します。 }
int main(int argc, char** argv) { try { std::cout << "Started \n"; std::thread mcThread(messageClientThread); std::thread maThread(messageAnswerThread); QApplication MainApp(argc, argv); Widget w(0); std::cout << " mcThread Started \n"; mcThread.detach(); std::cout << " maThread Started \n"; maThread.detach(); w.show(); MainApp.exec(); } catch (std::string str) { std::cout << "catched " << str << "\n"; } return 0; }
// Main function int main(int argc, char * argv[]) { /*{ PointerState test; test.UpdateButtonState(0) = true; test.UpdateButtonState(1) = true; test.UpdateButtonState(2) = true; PointerState test2(test); test2.UpdateButtonState(2) = false; std::cout << test.GetButtonState(2) << &std::endl; std::cout << test2.GetButtonState(2) << &std::endl; return 0; }*/ #if 0 { std::function<void()> Test = []() { std::cout << "Hi from anon func.\n"; }; //std::function<ConceptString(const std::vector<ConceptId> &)> Test = [](const std::vector<ConceptId> & Parameters){ return ConceptString({FindConcept("<"), GetParameterIfExists(Parameters, 0), FindConcept(">")}); }; // Call Test() //Test(); printf("size of func %ld\n", sizeof(Test)); return 0; } #endif // Set env vars std::string GoPath; // This has to exist even after putenv() call because putenv simply adds a pointer rather than copying the value std::string Path = "PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/go/bin"; { // Initialize the value of GoPath GoPath = "GOPATH="; // Get current working directory { auto cwd = getcwd(nullptr, 0); if (nullptr == cwd) { printf("Fatal Error: getcwd() failed."); exit(1); } printf("Current-working-dir is '%s' (should be the folder where README.md is).\n", cwd); GoPath = GoPath + cwd + "/GoLand"; GoPath += ":"; GoPath = GoPath + cwd + "/GoLanding"; Path = Path + ":" + cwd + "/GoLand/bin"; free(cwd); } putenv(const_cast<char *>("DYLD_INSERT_LIBRARIES=")); // HACK: Const cast putenv(const_cast<char *>("TERM=xterm")); // HACK: Const cast putenv(const_cast<char *>(GoPath.c_str())); // HACK: Const cast // HACK: Add go/bin to $PATH by hardcoding the whole PATH for OS X putenv(const_cast<char *>(Path.c_str())); // HACK: Const cast } glfwInit(); // Verify the GLFW library and header versions match { int Major, Minor, Revision; glfwGetVersion(&Major, &Minor, &Revision); bool Match = (GLFW_VERSION_MAJOR == Major && GLFW_VERSION_MINOR == Minor && GLFW_VERSION_REVISION == Revision); if (!Match) { std::cerr << "Error: GLFW library and header versions do not match." << std::endl; throw 0; } else { std::cout << "Using GLFW " << Major << "." << Minor << "." << Revision << "." << std::endl; } } // Open main window { GLFWvidmode DesktopMode; glfwGetDesktopMode(&DesktopMode); glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 32); const bool Fullscreen = static_cast<bool>(0); const Vector2n WindowDimensons(1536, 960); if (!Fullscreen) { glfwOpenWindow(WindowDimensons.X(), WindowDimensons.Y(), DesktopMode.RedBits, DesktopMode.GreenBits, DesktopMode.BlueBits, 0, 0, 0, GLFW_WINDOW); glfwSetWindowPos((DesktopMode.Width - WindowDimensons.X()) / 2, (DesktopMode.Height - WindowDimensons.Y()) / 2); // Center the window } else { glfwOpenWindow(DesktopMode.Width, DesktopMode.Height, DesktopMode.RedBits, DesktopMode.GreenBits, DesktopMode.BlueBits, 0, 0, 0, GLFW_FULLSCREEN); glfwEnable(GLFW_MOUSE_CURSOR); } { std::ostringstream x; x << "CPU Count: " << glfwGetNumberOfProcessors() << std::endl << "GL Renderer: " << glGetString(GL_VENDOR) << " " << glGetString(GL_RENDERER) << " " << glGetString(GL_VERSION) << std::endl << "GLFW_ACCELERATED: " << glfwGetWindowParam(GLFW_ACCELERATED) << std::endl << "GLFW_RED_BITS: " << glfwGetWindowParam(GLFW_RED_BITS) << std::endl << "GLFW_GREEN_BITS: " << glfwGetWindowParam(GLFW_GREEN_BITS) << std::endl << "GLFW_BLUE_BITS: " << glfwGetWindowParam(GLFW_BLUE_BITS) << std::endl << "GLFW_ALPHA_BITS: " << glfwGetWindowParam(GLFW_ALPHA_BITS) << std::endl << "GLFW_DEPTH_BITS: " << glfwGetWindowParam(GLFW_DEPTH_BITS) << std::endl << "GLFW_STENCIL_BITS: " << glfwGetWindowParam(GLFW_STENCIL_BITS) << std::endl << "GLFW_REFRESH_RATE: " << glfwGetWindowParam(GLFW_REFRESH_RATE) << std::endl << "GLFW_FSAA_SAMPLES: " << glfwGetWindowParam(GLFW_FSAA_SAMPLES) << std::endl; std::cout << x.str(); } { //glfwSetWindowTitle("Conception"); glfwSwapInterval(1); // Set Vsync glfwDisable(GLFW_AUTO_POLL_EVENTS); glfwEnable(GLFW_KEY_REPEAT); glfwDisable(GLFW_SYSTEM_KEYS); } } { InputManager InputManager; g_InputManager = &InputManager; ConceptionApp MainApp(InputManager); //LiveEditorApp MainApp(InputManager); //ConceptionTestApp MainApp(InputManager); //MultitouchTestApp MainApp(InputManager); //SentienceApp MainApp(InputManager); glfwSetWindowTitle(MainApp.GetTitle().c_str()); // Perform the layout of UI widgets MainApp.Layout(); // OpenGL settings InitializeOpenGL(); std::cout << std::endl; // Done loading // Main loop while (glfwGetWindowParam(GLFW_OPENED)) { auto CurrentTime = glfwGetTime(); static auto LastTime = CurrentTime; auto TimePassed = CurrentTime - LastTime; LastTime = CurrentTime; // DEBUG: Moved to top of loop to enable debug printing from input handling code glClear(GL_COLOR_BUFFER_BIT); // Clear frame // Process input { // Populate InputEventQueue if (MainApp.ShouldRedrawRegardless()) glfwPollEvents(); else { glfwWaitEvents(); //if (glfwGetTime() - LastTime >= 1) printf("Slept for %f secs\n", glfwGetTime() - LastTime); LastTime = glfwGetTime(); } //InputManager.ProcessTimePassed(TimePassed); MainApp.ProcessEventQueue(InputManager.ModifyInputEventQueue()); MainApp.ProcessTimePassed(TimePassed); } // Render { // DEBUG: Moved to top of loop to enable debug printing from input handling code ///glClear(GL_COLOR_BUFFER_BIT); // Clear frame MainApp.Render(); } // Display new frame glfwSwapBuffers(); //glFinish(); ///printf("%f ms frame\n", TimePassed * 1000); // Use less CPU in background if (!glfwGetWindowParam(GLFW_ACTIVE)) { glfwSleep(0.100); } } } // Clean up OglUtilsKillFont(); glfwTerminate(); std::cout << "\nReturning 0 from main().\n"; return 0; }