slang-users mailing list

[2001 Date Index] [2001 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: Possible bug...


The variables are declared like this and are only changed in the KeyDown-event:

variable x=0,y=0,xvel=2,yvel=2;

The function is triggered by this C-Function

int SLANG_ExecuteKeyDown(short key) { if (SLang_push_short(key)==-1) return(-2); // unable to push key
   return(SLexecute_function(fKeyDown));
}

the strangest is that it only happens with the second line (if (key==275))
with -1.0

but the bytecode-error hasn't something to do with the stack or ? I mean then
it has nothing to do with pushing the key...but dunno...
I am using version 1.4.4 under Windows

Richard van Zon.

John E. Davis wrote:

Richard van Zon <rvanzon@xxxxxxxxxxxx> wrote:

I dont know if bug reports are supposed to be given here.
And maybe it's not a bug, but I dont see anything I do wrong...
I have S-Lang embedded in a C-Program, that calls onKeyDown()
with a given key...


My suspicion is that your C program has trashed some memory somewhere.
I assume that you are using the latest version of slang (1.4.4).

define onKeyDown(key)
{
if (key==276) { yvel=-1.0;y--; }    // this one works fine
if (key==275) { yvel=-1.0;y--; }    // yvel=-1.0 is not valid here ?!
if (key==273) { xvel=1.0;x--; }      // this one works fine
if (key==274) { xvel=-1.0;x++; }   // this one works fine
}


How are x, xvel, y, and yvel defined?

Thanks,
--John







[2001 date index] [2001 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]