当前位置: 首页>>代码示例>>C++>>正文


C++ SDL_SendWindowEvent函数代码示例

本文整理汇总了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);
}
开发者ID:CannonballStudio,项目名称:powdertoy,代码行数:35,代码来源:SDL_mouse.c

示例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);
    }
}
开发者ID:Cpasjuste,项目名称:NeoDroid,代码行数:9,代码来源:SDL_android.cpp

示例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);
    }
}
开发者ID:IronYan,项目名称:kudou-player,代码行数:9,代码来源:SDL_android.cpp

示例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);
    }
}
开发者ID:IronYan,项目名称:kudou-player,代码行数:9,代码来源:SDL_android.cpp

示例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);
    }
}
开发者ID:Cpasjuste,项目名称:NeoDroid,代码行数:9,代码来源:SDL_android.cpp

示例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);
    }
}
开发者ID:orionpax,项目名称:socoolpal,代码行数:11,代码来源:SDL_android.cpp

示例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);
    }
}
开发者ID:orionpax,项目名称:socoolpal,代码行数:14,代码来源:SDL_android.cpp

示例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);
}
开发者ID:mhernando,项目名称:SDL2,代码行数:15,代码来源:SDL_android.cpp

示例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);
        }
    }
}
开发者ID:DarkWolk,项目名称:libsdl,代码行数:49,代码来源:SDL_touch.c

示例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);
        }
    }
}
开发者ID:Avin15,项目名称:dospad,代码行数:49,代码来源:SDL_mouse.c

示例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);
    }
}
开发者ID:jjiezheng,项目名称:urho3d,代码行数:8,代码来源:SDL_android.cpp

示例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);
    }
}
开发者ID:mhernando,项目名称:SDL2,代码行数:18,代码来源:SDL_android.cpp

示例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);
    }
}
开发者ID:AG-Dev,项目名称:wesnoth_ios,代码行数:12,代码来源:SDL_androidvideo.c

示例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
}
开发者ID:Alocaly,项目名称:dolphin-player.nextgen,代码行数:11,代码来源:SDL_androidvideo.c

示例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;
		}
	}
}
开发者ID:mallardtheduck,项目名称:osdev,代码行数:11,代码来源:SDL_btosevents.c


注:本文中的SDL_SendWindowEvent函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。