Unified · Split
| @@ -128,6 +128,8 @@ ChucK::ChucK() · 127 unmodified lines | ||
| 128 | 128 | initDefaultParams(); |
| 129 | 129 | // did user init? |
| 130 | 130 | m_init = FALSE; |
| 131 | + // zero out the hook | |
| 132 | + m_hook = NULL; // m_hook = nullptr | |
| 131 | 133 | |
| 132 | 134 | // global init, if needed |
| 133 | 135 | if( !o_isGlobalInit ) globalInit(); |
| @@ -1129,9 +1131,11 @@ void ChucK::poop() · 995 unmodified lines | ||
| 1129 | 1131 | |
| 1130 | 1132 | |
| 1131 | 1133 | |
| 1134 | + | |
| 1132 | 1135 | //----------------------------------------------------------------------------- |
| 1133 | 1136 | // name: setMainThreadHook() |
| 1134 | −// desc: | |
| 1137 | +// desc: set a function pointer to call from the main thread loop | |
| 1138 | +// e.g., for graphics, MAUI, potentially from a chug-in | |
| 1135 | 1139 | //----------------------------------------------------------------------------- |
| 1136 | 1140 | bool ChucK::setMainThreadHook(Chuck_DL_MainThreadHook * hook) |
| 1137 | 1141 | { |
| @@ -1139,9 +1143,12 @@ bool ChucK::setMainThreadHook(Chuck_DL_MainThreadHook * hook) · 1 unmodified line | ||
| 1139 | 1143 | return true; |
| 1140 | 1144 | } |
| 1141 | 1145 | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1142 | 1149 | //----------------------------------------------------------------------------- |
| 1143 | 1150 | // name: getMainThreadHook() |
| 1144 | −// desc: | |
| 1151 | +// desc: get pointer to current function to be called from main loop | |
| 1145 | 1152 | //----------------------------------------------------------------------------- |
| 1146 | 1153 | Chuck_DL_MainThreadHook * ChucK::getMainThreadHook() |
| 1147 | 1154 | { |
| @@ -122,9 +122,9 @@ public: · 121 unmodified lines | ||
| 122 | 122 | public: |
| 123 | 123 | // additional native chuck bindings/types (use with extra caution) |
| 124 | 124 | bool bind( f_ck_query queryFunc, const std::string & name ); |
| 125 | − | |
| 126 | − bool setMainThreadHook(Chuck_DL_MainThreadHook * hook); | |
| 127 | − | |
| 125 | + // set a function pointer to call from the main thread loop | |
| 126 | + bool setMainThreadHook( Chuck_DL_MainThreadHook * hook ); | |
| 127 | + // get pointer to current function to be called from main loop | |
| 128 | 128 | Chuck_DL_MainThreadHook * getMainThreadHook(); |
| 129 | 129 | |
| 130 | 130 | public: |
| @@ -205,7 +205,7 @@ protected: · 74 unmodified lines | ||
| 205 | 205 | // did user init? |
| 206 | 206 | t_CKBOOL m_init; |
| 207 | 207 | // main thread "hook" (if there is a main thread) |
| 208 | − Chuck_DL_MainThreadHook * m_hook = nullptr; | |
| 208 | + Chuck_DL_MainThreadHook * m_hook; | |
| 209 | 209 | }; |
| 210 | 210 | |
| 211 | 211 | |