| 178 | } |
| 179 | |
| 180 | bool Init(HContext context) |
| 181 | { |
| 182 | if (context != 0x0) |
| 183 | { |
| 184 | if (!context->m_Window) |
| 185 | { |
| 186 | dmLogFatal("No window has been created."); |
| 187 | return false; |
| 188 | } |
| 189 | |
| 190 | assert(context->m_Window && "No window has been set."); |
| 191 | dmPlatform::SetKeyboardCharCallback(context->m_Window, GLFWAddKeyboardChar, (void*) context); |
| 192 | dmPlatform::SetKeyboardMarkedTextCallback(context->m_Window, GLFWSetMarkedText, (void*) context); |
| 193 | #if !defined(__APPLE__) |
| 194 | dmPlatform::SetKeyboardDeviceChangedCallback(context->m_Window, GLFWDeviceChangedCallback, (void*) context); |
| 195 | #endif |
| 196 | |
| 197 | assert(context->m_NativeContextUserData == 0); |
| 198 | context->m_Finalizing = 0; |
| 199 | context->m_NativeContextUserData = new NativeContextUserData(); |
| 200 | |
| 201 | InitializeGamepads(context); |
| 202 | |
| 203 | return true; |
| 204 | } |
| 205 | return false; |
| 206 | } |
| 207 | |
| 208 | void Final(HContext context) |
| 209 | { |