本文整理汇总了C++中SDL_SetEventFilter函数的典型用法代码示例。如果您正苦于以下问题:C++ SDL_SetEventFilter函数的具体用法?C++ SDL_SetEventFilter怎么用?C++ SDL_SetEventFilter使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SDL_SetEventFilter函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetState
void LocalEvent::SetStateDefaults(void)
{
// enable events
SetState(SDL_ACTIVEEVENT, true);
SetState(SDL_USEREVENT, true);
SetState(SDL_KEYDOWN, true);
SetState(SDL_KEYUP, true);
SetState(SDL_MOUSEMOTION, true);
SetState(SDL_MOUSEBUTTONDOWN, true);
SetState(SDL_MOUSEBUTTONUP, true);
SetState(SDL_QUIT, true);
// ignore events
SetState(SDL_JOYAXISMOTION, false);
SetState(SDL_JOYBALLMOTION, false);
SetState(SDL_JOYHATMOTION, false);
SetState(SDL_JOYBUTTONUP, false);
SetState(SDL_JOYBUTTONDOWN, false);
SetState(SDL_SYSWMEVENT, false);
SetState(SDL_VIDEORESIZE, false);
SetState(SDL_VIDEOEXPOSE, false);
#if SDL_VERSION_ATLEAST(1, 3, 0)
SDL_SetEventFilter(GlobalFilterEvents, NULL);
#else
SDL_SetEventFilter(GlobalFilterEvents);
#endif
}
示例2: SDL_SetEventFilter
void GerenciadorDeEventos::setFiltroDeEventosDeApp(FiltroDeEventosDeApp* filtro)
{
filtroEventosApp = filtro;
if(filtro)
SDL_SetEventFilter(filtrarEventosDeApp, filtroEventosApp);
else
SDL_SetEventFilter(NULL, NULL);
}
示例3: PAL_InitInput
VOID
PAL_InitInput(
VOID
)
/*++
Purpose:
Initialize the input subsystem.
Parameters:
None.
Return value:
None.
--*/
{
memset(&g_InputState, 0, sizeof(g_InputState));
g_InputState.dir = kDirUnknown;
g_InputState.prevdir = kDirUnknown;
#if SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION <= 2
SDL_SetEventFilter(PAL_EventFilter);
#else
SDL_SetEventFilter(PAL_EventFilter, NULL);
#endif
//
// Setup input
//
sceCtrlSetSamplingCycle(0);
sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
pad.Buttons = 0;
//
// Start thread to read data
//
if((pad_sem = SDL_CreateSemaphore(1)) == NULL)
{
TerminateOnError("Can't create input semaphore\n");
return;
}
running = 1;
if((bthread = SDL_CreateThread(PSP_JoystickUpdate, NULL)) == NULL)
{
TerminateOnError("Can't create input thread\n");
return;
}
}
示例4: InitEventFilter
void InitEventFilter(EventFilter filter_function)
{
#if defined(TARGET_SDL)
/* set event filter to filter out certain events */
SDL_SetEventFilter(filter_function);
#endif
}
示例5: clippy_init
void clippy_init(void)
{
SDL_SysWMinfo info;
has_sys_clip = 0;
memset(&info, 0, sizeof(info));
SDL_VERSION(&info.version);
if (SDL_GetWMInfo(&info)) {
#if defined(USE_X11)
if (info.subsystem == SDL_SYSWM_X11) {
SDL_Display = info.info.x11.display;
SDL_Window = info.info.x11.window;
lock_display = info.info.x11.lock_func;
unlock_display = info.info.x11.unlock_func;
SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
SDL_SetEventFilter(_x11_clip_filter);
has_sys_clip = 1;
atom_sel = XInternAtom(SDL_Display, "SDL_SELECTION", False);
atom_clip = XInternAtom(SDL_Display, "CLIPBOARD", False);
orig_xlib_err = XSetErrorHandler(handle_xlib_err);
}
if (!lock_display) lock_display = __noop_v;
if (!unlock_display) unlock_display = __noop_v;
#elif defined(WIN32)
has_sys_clip = 1;
SDL_Window = info.window;
#elif defined(__QNXNTO__)
has_sys_clip = 1;
inputgroup = PhInputGroup(NULL);
#endif
}
}
示例6: IN_EndIgnoringMouseEvents
static void IN_EndIgnoringMouseEvents(void)
{
SDL_EventFilter currentFilter;
void *currentUserdata;
if (SDL_GetEventFilter(¤tFilter, ¤tUserdata) == SDL_TRUE)
SDL_SetEventFilter(NULL, NULL);
}
示例7: main
int main( int argc, char* args[] )
{
unsigned int i;
printf("starting keyboard test\n");
//Initialize SDL
if( SDL_Init( SDL_INIT_EVENTS ) < 0 )
{
printf( "SDL could not initialize! SDL_Error: %s\n", SDL_GetError() );
}
for (i = 0; i < SDL_NUM_SCANCODES; i++)
{
myKeyState[i] = 0;
}
#if !SDL_VERSION_ATLEAST(2,0,0)
SDL_EnableKeyRepeat(0, 0);
#endif
SDL_SetEventFilter(event_sdl_filter, NULL);
while (ok)
{
printf("."); fflush(stdout);
SDL_PumpEvents();
usleep(100000);
}
//Quit SDL subsystems
SDL_Quit();
printf("finished\n");
return 0;
}
示例8: Initialize
void Initialize( void )
{
#if __APPLE__ // Shiny OS X
InitResources();
#else
#if _WIN32
HMODULE module;
char name[MAX_PATH+1], *lastBackslash;
module = GetModuleHandle( NULL );
GetModuleFileName( module, name, MAX_PATH );
lastBackslash = strrchr( name, '\\' );
if( lastBackslash != NULL )
{
*lastBackslash = '\0';
strcpy( candyCrisisResources, name );
strcat( candyCrisisResources, "\\CandyCrisisResources\\" );
}
#endif
#if TARGET_API_MAC_CARBON // Classic MacOS
strcpy( candyCrisisResources, ":CandyCrisisResources:" );
#endif
#ifdef linux
strcpy( candyCrisisResources, "CandyCrisisResources/" );
#endif
#endif
atexit( SDL_Quit );
SDL_SetEventFilter( SDLU_EventFilter );
}
示例9: event_initialize
void event_initialize(void)
{
const char *event_str = NULL;
int i;
/* set initial state of all joystick commands to 'off' */
for (i = 0; i < NumJoyCommands; i++)
JoyCmdActive[i] = 0;
/* activate any joysticks which are referenced in the joystick event command strings */
for (i = 0; i < NumJoyCommands; i++)
{
event_str = ConfigGetParamString(g_CoreConfig, JoyCmdName[i]);
if (event_str != NULL && strlen(event_str) >= 4 && event_str[0] == 'J' && event_str[1] >= '0' && event_str[1] <= '9')
{
int device = event_str[1] - '0';
if (!SDL_WasInit(SDL_INIT_JOYSTICK))
SDL_InitSubSystem(SDL_INIT_JOYSTICK);
if (!SDL_JoystickOpened(device))
SDL_JoystickOpen(device);
}
}
/* set up SDL event filter and disable key repeat */
SDL_EnableKeyRepeat(0, 0);
SDL_SetEventFilter(event_sdl_filter);
}
示例10: PAL_InitInput
VOID PAL_InitInput(VOID
)
/*++
Purpose:
Initialize the input subsystem.
Parameters:
None.
Return value:
None.
--*/
{
memset(&g_InputState, 0, sizeof(g_InputState));
g_InputState.dir = kDirUnknown;
g_InputState.prevdir = kDirUnknown;
SDL_SetEventFilter(PAL_EventFilter);
//
// Check for joystick
//
/*if (SDL_NumJoysticks() > 0)
{
g_pJoy = SDL_JoystickOpen(0);
if (g_pJoy != NULL)
{
SDL_JoystickEventState(SDL_ENABLE);
}
}*/
}
示例11: address
Vga::Vga(sc_core::sc_module_name name) :
sc_core::sc_module(name), address(0), intr(false)
{
SC_THREAD(thread);
if(SDL_Init(SDL_INIT_VIDEO) < 0) {
SC_REPORT_FATAL(sc_module::name(), SDL_GetError());
}
atexit(SDL_Quit);
SDL_SetEventFilter(filter);
screen = SDL_SetVideoMode(VGA_WIDTH, VGA_HEIGHT, 16,
SDL_DOUBLEBUF | SDL_HWSURFACE);
if(screen->format->BytesPerPixel != 2) {
SC_REPORT_FATAL(sc_module::name(), SDL_GetError());
}
black = SDL_MapRGB(screen->format, 0x00, 0x00, 0x00);
white = SDL_MapRGB(screen->format, 0xFF, 0xFF, 0xFF);
SDL_WM_SetCaption(sc_module::name(), NULL);
#ifdef DEBUG
std::cout << "Debug: " << sc_module::name() <<
": LCD controller TLM model\n";
#endif
}
示例12: initWindow
void initWindow(std::string name, int w, int h, int wflags, int rflags){
init();
SDL_SetHint(SDL_HINT_RENDER_OPENGL_SHADERS, "1");
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl");
GRAPHICS::window = SDL_CreateWindow(name.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, w, h, wflags | SDL_WINDOW_OPENGL);
if (GRAPHICS::window == NULL) {std::cout << SDL_GetError() << std::endl;}
GRAPHICS::renderer = SDL_CreateRenderer(GRAPHICS::window, -1, rflags | SDL_RENDERER_TARGETTEXTURE);
if (GRAPHICS::renderer == NULL) {std::cout << SDL_GetError() << std::endl;}
GRAPHICS::glcontext = SDL_GL_CreateContext(GRAPHICS::window);
GRAPHICS::glcontext = SDL_GL_GetCurrentContext();
GRAPHICS::setColor(255,255,255,255);
GRAPHICS::setBackgroundColor(0,0,0,255);
setViewport(w, h);
//yay workarounds
SDL_SetWindowSize(GRAPHICS::window, w, h);
GRAPHICS::resize();
initGL();
/*
Explanation for window resize work-around:
The first resize of an application will reset the openGL context,
all following resizes will have no effect.
To get around this, a resize is forced to the window.
*/
SDL_SetEventFilter(resize_sdl_event, nullptr);
std::cout << "JE: Initiated Window." << std::endl;
}
示例13: eventAddFilter
static int
eventAddFilter(lua_State *L, int type)
{
Filter *f;
luaL_checktype(L, 1, LUA_TFUNCTION);
if ((f = malloc(sizeof (Filter))) == NULL)
return commonPushErrno(L, 1);
f->L = L;
f->type = type;
/* Push the function and ref it */
lua_pushvalue(L, 1);
f->ref = luaL_ref(L, LUA_REGISTRYINDEX);
if (type == EventTypeWatcher)
SDL_AddEventWatch((SDL_EventFilter)eventFilter, f);
else if (type == EventTypeFilter)
SDL_SetEventFilter((SDL_EventFilter)eventFilter, f);
/* Push the object to the user */
commonPushUserdata(L, EventFilterName, f);
return 1;
}
示例14: fv_error_message
void
fv_error_message(const char *format, ...)
{
struct fv_buffer buffer;
va_list ap;
/* Stop drawing or processing any further events */
SDL_SetEventFilter(NULL, NULL);
emscripten_cancel_main_loop();
va_start(ap, format);
fv_buffer_init(&buffer);
fv_buffer_append_vprintf(&buffer, format, ap);
va_end(ap);
EM_ASM_({
console.error(Module.Pointer_stringify($0));
var canvas = document.getElementById("canvas");
canvas.style.display = "none";
var errorMessage =
document.getElementById("error-message");
errorMessage.style.display = "block";
},
示例15: main
int main(int argc, char **argv)
{
opts=new SGraphOptions();
d=new DemoData(opts);
plotter = new SDLPlotter(opts,d);
SDL_Thread *controller = SDL_CreateThread (control,NULL);
SDL_Thread *plotThread= SDL_CreateThread (plot,NULL);
SDL_SetEventFilter(pollforquit);
while(!done)
{
SDL_Delay(50);
if(opts->follow)
{
d->SetEofReached(0);
SDL_Delay(1000);
plotter->PlotData(d);
}
if(opts->update)
{
d->ResetData();
SDL_Delay(1000);
plotter->PlotData(d);
}
}
plotter->QuitPlotting();
SDL_KillThread(controller);
SDL_KillThread(plotThread);
SDL_Quit();
exit(0);
}