本文整理汇总了C++中SDL_SendWindowEvent函数的典型用法代码示例。如果您正苦于以下问题:C++ SDL_SendWindowEvent函数的具体用法?C++ SDL_SendWindowEvent怎么用?C++ SDL_SendWindowEvent使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SDL_SendWindowEvent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SDL_SetMouseFocus
void
SDL_SetMouseFocus(SDL_Window * window)
{
SDL_Mouse *mouse = SDL_GetMouse();
if (mouse->focus == window) {
return;
}
/* Actually, this ends up being a bad idea, because most operating
systems have an implicit grab when you press the mouse button down
so you can drag things out of the window and then get the mouse up
when it happens. So, #if 0...
*/
#if 0
if (mouse->focus && !window) {
/* We won't get anymore mouse messages, so reset mouse state */
SDL_ResetMouse();
}
#endif
/* See if the current window has lost focus */
if (mouse->focus) {
SDL_SendWindowEvent(mouse->focus, SDL_WINDOWEVENT_LEAVE, 0, 0);
}
mouse->focus = window;
if (mouse->focus) {
SDL_SendWindowEvent(mouse->focus, SDL_WINDOWEVENT_ENTER, 0, 0);
}
/* Update cursor visibility */
SDL_SetCursor(NULL);
}
示例2: Java_fr_mydedibox_utility_UtilitySDL_nativeResume
// Resume
extern "C" void Java_fr_mydedibox_utility_UtilitySDL_nativeResume(
JNIEnv* env, jclass cls)
{
if (Android_Window) {
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0);
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_RESTORED, 0, 0);
}
}
示例3: Java_org_libsdl_app_SDLActivity_nativeResume
// Resume
extern "C" void Java_org_libsdl_app_SDLActivity_nativeResume(
JNIEnv* env, jclass cls)
{
if (Android_Window) {
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0);
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_RESTORED, 0, 0);
}
}
示例4: Java_org_libsdl_app_SDLActivity_nativePause
// Pause
extern "C" void Java_org_libsdl_app_SDLActivity_nativePause(
JNIEnv* env, jclass cls)
{
if (Android_Window) {
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
}
}
示例5: Java_fr_mydedibox_utility_UtilitySDL_nativePause
// Pause
extern "C" void Java_fr_mydedibox_utility_UtilitySDL_nativePause(
JNIEnv* env, jclass cls)
{
if (Android_Window) {
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
}
}
示例6: Java_org_libsdl_app_SDLActivity_nativePause
// Pause
extern "C" void Java_org_libsdl_app_SDLActivity_nativePause(
JNIEnv* env, jclass cls)
{
if (Android_Window) {
/* Signal the pause semaphore so the event loop knows to pause and (optionally) block itself */
if (!SDL_SemValue(Android_PauseSem)) SDL_SemPost(Android_PauseSem);
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
}
}
示例7: Java_org_libsdl_app_SDLActivity_nativeResume
// Resume
extern "C" void Java_org_libsdl_app_SDLActivity_nativeResume(
JNIEnv* env, jclass cls)
{
if (Android_Window) {
/* Signal the resume semaphore so the event loop knows to resume and restore the GL Context
* We can't restore the GL Context here because it needs to be done on the SDL main thread
* and this function will be called from the Java thread instead.
*/
if (!SDL_SemValue(Android_ResumeSem)) SDL_SemPost(Android_ResumeSem);
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0);
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_RESTORED, 0, 0);
}
}
示例8: Java_org_libsdl_app_SDLActivity_nativePause
// Pause
extern "C" void Java_org_libsdl_app_SDLActivity_nativePause(
JNIEnv* env, jclass cls)
{
if (Android_Window) {
/* Signal the pause semaphore so the event loop knows to pause and (optionally) block itself */
if (!SDL_SemValue(Android_PauseSem)) SDL_SemPost(Android_PauseSem);
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
}
__android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativePause()");
SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND);
SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND);
}
示例9: SDL_SetTouchFocus
void
SDL_SetTouchFocus(SDL_TouchID id, SDL_Window * window)
{
int index = SDL_GetTouchIndexId(id);
SDL_Touch *touch = SDL_GetTouch(id);
int i;
SDL_bool focus;
if (!touch || (touch->focus == window)) {
return;
}
/* See if the current window has lost focus */
if (touch->focus) {
focus = SDL_FALSE;
for (i = 0; i < SDL_num_touch; ++i) {
SDL_Touch *check;
if (i != index) {
check = SDL_touchPads[i];
if (check && check->focus == touch->focus) {
focus = SDL_TRUE;
break;
}
}
}
if (!focus) {
SDL_SendWindowEvent(touch->focus, SDL_WINDOWEVENT_LEAVE, 0, 0);
}
}
touch->focus = window;
if (touch->focus) {
focus = SDL_FALSE;
for (i = 0; i < SDL_num_touch; ++i) {
SDL_Touch *check;
if (i != index) {
check = SDL_touchPads[i];
if (check && check->focus == touch->focus) {
focus = SDL_TRUE;
break;
}
}
}
if (!focus) {
SDL_SendWindowEvent(touch->focus, SDL_WINDOWEVENT_ENTER, 0, 0);
}
}
}
示例10: SDL_SetMouseFocus
void
SDL_SetMouseFocus(int id, SDL_Window * window)
{
int index = SDL_GetMouseIndexId(id);
SDL_Mouse *mouse = SDL_GetMouse(index);
int i;
SDL_bool focus;
if (!mouse || (mouse->focus == window)) {
return;
}
/* See if the current window has lost focus */
if (mouse->focus) {
focus = SDL_FALSE;
for (i = 0; i < SDL_num_mice; ++i) {
SDL_Mouse *check;
if (i != index) {
check = SDL_GetMouse(i);
if (check && check->focus == mouse->focus) {
focus = SDL_TRUE;
break;
}
}
}
if (!focus) {
SDL_SendWindowEvent(mouse->focus, SDL_WINDOWEVENT_LEAVE, 0, 0);
}
}
mouse->focus = window;
if (mouse->focus) {
focus = SDL_FALSE;
for (i = 0; i < SDL_num_mice; ++i) {
SDL_Mouse *check;
if (i != index) {
check = SDL_GetMouse(i);
if (check && check->focus == mouse->focus) {
focus = SDL_TRUE;
break;
}
}
}
if (!focus) {
SDL_SendWindowEvent(mouse->focus, SDL_WINDOWEVENT_ENTER, 0, 0);
}
}
}
示例11: NATIVE_FUNCTION
// Surface created
extern "C" void NATIVE_FUNCTION(onNativeSurfaceCreated)(
JNIEnv* env, jclass cls)
{
if (Android_Window) {
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_SURFACE_CREATED, 0, 0);
}
}
示例12: Java_org_libsdl_app_SDLActivity_nativeResume
// Resume
extern "C" void Java_org_libsdl_app_SDLActivity_nativeResume(
JNIEnv* env, jclass cls)
{
__android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeResume()");
SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND);
SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND);
if (Android_Window) {
/* Signal the resume semaphore so the event loop knows to resume and restore the GL Context
* We can't restore the GL Context here because it needs to be done on the SDL main thread
* and this function will be called from the Java thread instead.
*/
if (!SDL_SemValue(Android_ResumeSem)) SDL_SemPost(Android_ResumeSem);
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0);
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_RESTORED, 0, 0);
}
}
示例13: Android_SetScreenResolution
/* This function gets called before VideoInit() */
void
Android_SetScreenResolution(int width, int height, Uint32 format)
{
Android_ScreenWidth = width;
Android_ScreenHeight = height;
Android_ScreenFormat = format;
if (Android_Window) {
SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_RESIZED, width, height);
}
}
示例14: JAVA_EXPORT_NAME
JNIEXPORT void JNICALL
JAVA_EXPORT_NAME(MediaPlayer_nativeGlContextRecreated) ( JNIEnv* env, jobject thiz )
{
__android_log_print(ANDROID_LOG_INFO, "libSDL", "OpenGL context recreated, sending SDL_ACTIVEEVENT");
#if SDL_VERSION_ATLEAST(1,3,0)
if( ANDROID_CurrentWindow )
SDL_SendWindowEvent(ANDROID_CurrentWindow, SDL_WINDOWEVENT_RESTORED, 0, 0);
#else
SDL_PrivateAppActive(1, SDL_APPACTIVE|SDL_APPINPUTFOCUS|SDL_APPMOUSEFOCUS);
#endif
}
示例15: _BTOS_HandleFrameEvent
static void _BTOS_HandleFrameEvent(wm_Event *event){
SDL_Window *win = _BTOS_GetSDLWindow(event->window_id);
if(win){
switch(event->type){
case wm_EventType_Close:
SDL_SendWindowEvent(win, SDL_WINDOWEVENT_CLOSE, 0, 0);
break;
default: break;
}
}
}