SDL / C ++ OpenGL程序,如何阻止SDL捕获SIGINT [英] SDL/C++ OpenGL Program, how do I stop SDL from catching SIGINT

查看:126
本文介绍了SDL / C ++ OpenGL程序,如何阻止SDL捕获SIGINT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 SDL 执行Linux上的OpenGL应用程式。我的问题是,SDL正在捕获SIGINT并忽略它。这是一个痛苦,因为我正在通过一个屏幕会话,我不能杀死正在运行的程序与CTRL-C(计算机正在运行的程序连接到投影机,没有输入设备)。

I am using SDL for an OpenGL application, running on Linux. My problem is that SDL is catching SIGINT and ignoring it. This is a pain because I am developing through a screen session, and I can't kill the running program with CTRL-C (the program the computer is running on is connected to a projector and has no input devices).

有没有标志或东西,我可以传递到SDL,使其不捕获SIGINT?我真的只是希望程序在收到信号时停止(即当我按ctrl-c时)。

Is there a flag or something I can pass to SDL so that it does not capture SIGINT? I really just want the program to stop when it receives the signal (ie when I press ctrl-c).

推荐答案

C在控制台生成SDL_QUIT事件。您可以使用SDL_PollEvent或SDL_WaitEvent来监视此事件,并在检测到该事件时退出(干净地)。

Ctrl-C at the console generates an SDL_QUIT event. You can watch for this event using SDL_PollEvent or SDL_WaitEvent, and exit (cleanly) when it is detected.

请注意,其他操作可以生成SDL_QUIT事件您的主窗口通过窗口管理器)。

Note that other actions can generate an SDL_QUIT event (e.g. attempting to close your main window via the window manager).

这篇关于SDL / C ++ OpenGL程序,如何阻止SDL捕获SIGINT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆