1. set tty to raw mode otherwise it will buffer input and you will not be able to catch key events unless tty flushes the buffer (after pressing return by default)
2. attaching async signal (SIGIO) to your STDIN.
Hi ,
I have three funcions f1, f2 and f3 .
f1 calls f2 and f2 calls f3 .
I have a global variable "period" which i want to pass to f3 .
Can i pass the variable directly in the definition of f3 ?
Pls help .
sars (4 Replies)
Hi,
I have a main loop which calls a sub loop, which finally returns to the main loop itself. The main loop runs when a flag is set. Now, I have a signal handler for SIGINT, which resets the flag and thus stops the main loop. Suppose I send SIGINT while the program is in subloop, I get an error... (1 Reply)
Hello,
i am using the sigaction function to handle the SIGCHLD signal.Is it possible to use a class member function as the handler function (the sa_handler member of the sigaction structure)?
The function's signature is:
void (*sa_handler)(int);so i don't think i can use a static member function... (2 Replies)
In my Bash script I have an exit/cleanup function in a trap statement like:
trap exitCleanup 1 2 3 6 15 25
Is there anyway to capture which signal # has occurred to record in a log file. Please note I am trying to avoid something like:
trap 'mySignal=1; exitCleanup' 1
trap... (1 Reply)
This is my function which is creating three variables based on counter & writing these variable to database by calling another function writeRecord
but only one record is getting wrote in DB.... Please advise ASAP...:confused:
function InsertFtg
{
FTGSTR=""
echo "Saurabh is GREAT $#"
let... (2 Replies)
I have a script which does gunzip, zip and untar.
Input to the script is file name and file directory (where file is located)
I am reading the input parameters as follows:
FILENAME=$1
FILEDIR=$2
I have created 3 functions that are as follows:
1) gunzip file
2) unzip file... (2 Replies)
Dear All.
I have a script, which process files one by one. In the script I have two functions.
one sftp files to different server
the other from existing file create file with different name.
My question is:
Will sftp function recognize files names , which are created in another... (1 Reply)
Hi,
I am having script which contains many functions. Need to print each function name at the starting of the function. Like below,
functionname()
{
echo "functionname"
commands....
}
I've tried like below,
func=`grep "()" scriptname | cut -d "(" -f1`
for i in $func
do
nawk -v... (4 Replies)
Hi All,
Good Day, seeking for your assistance on how to not perform my 2nd, 3rd,4th etc.. function if my 1st function is in else condition.
#Body
function1()
{
if
then
echo "exist"
else
echo "not exist"
}
#if not exist in function1 my all other function will not proceed.... (4 Replies)
Discussion started by: meister29
4 Replies
LEARN ABOUT SUSE
keyboard_lowlevel_callback
keyboard_lowlevel_callback(3alleg4) Allegro manual keyboard_lowlevel_callback(3alleg4)NAME
keyboard_lowlevel_callback - User specified low level keyboard event handler. Allegro game programming library.
SYNOPSIS
#include <allegro.h>
extern void (*keyboard_lowlevel_callback)(int scancode);
DESCRIPTION
If set, this function is called by the keyboard handler in response to every keyboard event, both presses (including keyboard repeat rate)
and releases. It will be passed a raw keyboard scancode byte (scancodes are 7 bits long), with the top bit (8th bit) clear if the key has
been pressed or set if it was released. This routine executes in an interrupt context, so it must be in locked memory. Example:
volatile int key_down, key_up;
void keypress_watcher(int scancode)
{
if (scancode & 0x80) {
key_up = 1;
} else {
key_down = 1;
}
} END_OF_FUNCTION(keypress_watcher)
...
install_timer();
LOCK_FUNCTION(silence_g_key);
LOCK_VARIABLE(key_down);
LOCK_VARIABLE(key_up);
install_keyboard();
keyboard_lowlevel_callback = keypress_watcher;
/* Disable keyboard repeat to get typewriter effect. */
set_keyboard_rate(0, 0);
...
while (game_loop) {
if (key_down) {
key_down = 0;
/* Play sample of typewriter key press. */
}
if (key_up) {
key_up = 0;
/* Play sample of typewriter key release. */
}
}
SEE ALSO install_keyboard(3alleg4), keyboard_callback(3alleg4), keyboard_ucallback(3alleg4), exkeys(3alleg4)Allegro version 4.4.2 keyboard_lowlevel_callback(3alleg4)