This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| auto get_bbox = [](const vector<ofVec2f> pts) -> ofRectangle | |
| { | |
| auto xpair = std::minmax_element(pts.begin(), pts.end(), | |
| [](const ofVec2f& a, const ofVec2f& b) { | |
| return a.x < b.x; | |
| }); | |
| auto ypair = std::minmax_element(pts.begin(), pts.end(), | |
| [](const ofVec2f& a, const ofVec2f& b) { | |
| return a.y < b.y; | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| auto get_buf_from_img = [](ofPixels& img, ofBuffer& buf, ofImageFormat fmt) -> ofBuffer | |
| { | |
| buf.clear(); | |
| ofSaveImage(img, buf, fmt); | |
| return buf; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| std::stoul("0x" + s, nullptr, 16) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| auto conv_utf8_to_sjis = [](string srcUTF8) -> string | |
| { | |
| int lenghtUnicode = MultiByteToWideChar(CP_UTF8, 0, srcUTF8.c_str(), srcUTF8.size() + 1, NULL, 0); | |
| wchar_t* bufUnicode = new wchar_t[lenghtUnicode]; | |
| MultiByteToWideChar(CP_UTF8, 0, srcUTF8.c_str(), srcUTF8.size() + 1, bufUnicode, lenghtUnicode); | |
| int lengthSJis = WideCharToMultiByte(CP_THREAD_ACP, 0, bufUnicode, -1, NULL, 0, NULL, NULL); | |
| char* bufShiftJis = new char[lengthSJis]; | |
| WideCharToMultiByte(CP_THREAD_ACP, 0, bufUnicode, lenghtUnicode + 1, bufShiftJis, lengthSJis, NULL, NULL); | |
| string strSJis(bufShiftJis); | |
| delete bufUnicode; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #pragma comment(linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"") | |
| #include "ofMain.h" | |
| #include "ofApp.h" | |
| int main() | |
| { | |
| ofGLWindowSettings glWindowSettings; | |
| glWindowSettings.setGLVersion(2, 1); | |
| glWindowSettings.width = 1920; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| HWND AppWindow = GetActiveWindow(); | |
| SetWindowPos(AppWindow, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // TheradedVLCPlayerEx.cpp | |
| // ofxVLCVideoPlayerExample | |
| // | |
| // Created by Akira Hayasaka on 2017/01/16. | |
| // | |
| // | |
| #include "TheradedVLCPlayerEx.hpp" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| vector<string> get_signed_char(const char byte) | |
| { | |
| vector<string> busy_state; | |
| for (auto i = 7; i >= 0; i--) | |
| { | |
| busy_state.push_back(ofToString((byte>>i) & 1)); | |
| } | |
| std::reverse(begin(busy_state), end(busy_state)); | |
| return busy_state; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| vk1D::LCtrl | |
| #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
| ; #Warn ; Enable warnings to assist with detecting common errors. | |
| SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
| SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. | |
| ; NEEDS '*' because LCtrl key-repeat is otherwise interpreted as ALT+LCtrl. | |
| *LCtrl:: | |
| CtrlTabbed := false` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static int getGCD(int a, int b) // greatest common divisor | |
| { | |
| if (a == 0) | |
| return b; | |
| return getGCD(b%a, a); | |
| } | |
| static int getLCM(int a, int b) // least common multiple | |
| { | |
| return abs(a * b) / getGCD(a, b); |