Discussion:
important SDL BUG : Keyboard and Mouse classes dont work : Please HELP!!!
Pablo Marty
2012-08-21 22:58:57 UTC
Permalink
Hi Ladies and Guys
 
I have found out what my problem was: a simple, but very important SDL bug. As I had told you before, the keyboard input didn t move my character (Mario) ... and I was ignoring the Events class in order to introduce multithreading to my program
 
I tried in a new simple program, that just tests these functions (Keyboard.IsKeyPressed(Key) and Mouse.IsButtonPressed(MouseButton))
and they ALWAYS return false, that s they don t recognize the key press and the mouse button press
 
// this app never ends or crashesusingSdlDotNet;usingSdlDotNet.Graphics;usingSdlDotNet.Input;usingSystem.Drawing;namespace
{KEYBOARDclassProgram{
{
{
}
}
}
}publicstaticvoidMain()Video.Initialize();Video.SetVideoMode(800, 600, 24);for( ; ; )Video.Screen.Fill(Color.Orange);Video.Screen.Update();if(Mouse.IsButtonPressed(MouseButton.PrimaryButton)) break;if(Keyboard.IsKeyPressed(Key.Escape)) break;
 
Can you confirm this and tell me how to solve it? It seems there are not too many list members that use C# with SDL, but I supposse and hope that someone is able to terminate with this problem ... my Mario game really was getting very nice
 
Thank you very much
 
Pablo

Asesinar y comer un perro o un gato es lo mismo q hacerlo a una vaca, un pollo, un cerdo o un pez. El genocidio no discrimina. No seas complice de genocidas. No seas genocida. En la vida tarde o temprano todo vuelve. No comas cadaveres. No seas necrófago.
Christian Leger
2012-08-21 23:13:33 UTC
Permalink
Hi,

If I were you, I'd make sure that your program still doesn't crash or
exit when you check for more than either the primary mouse button or
the escape key.

I suggest you try the same program, but with every mouse button, and
with a number of other keys (like a, b, c, etc. which shouldn't move
between a UK/US and latin-configured keyboard). Then mash the keyboard
to see that really none of these work.

So for example in the keyboard-checking part (you'll have to ensure
correct variable/constant names):

if
(
Keyboard.IsKeyPressed(Key.Escape) ||
Keyboard.IsKeyPressed(Key.Up) ||
Keyboard.IsKeyPressed(Key.Down) ||
...
Keyboard.IsKeyPressed(Key.a) ||
Keyboard.IsKeyPressed(Key.b) ||
Keyboard.IsKeyPressed(Key.c)
...

)
{
break;
}

Finally, I'll point out that I'm not familiar with how this C# package
wraps SDL - it seems to test for 'key pressed' - does that mean the
key must be in the 'down' position when that function runs? What if
you just have quick fingers and the state of the keys is not down when
the program checks for 'pressed'?

Good luck!

Christian

On Tue, Aug 21, 2012 at 6:58 PM, Pablo Marty
Post by Pablo Marty
Hi Ladies and Guys
I have found out what my problem was: a simple, but very important SDL bug.
As I had told you before, the keyboard input didn t move my character
(Mario) ... and I was ignoring the Events class in order to introduce
multithreading to my program
I tried in a new simple program, that just tests these functions
(Keyboard.IsKeyPressed(Key) and Mouse.IsButtonPressed(MouseButton))
and they ALWAYS return false, that s they don t recognize the key press and
the mouse button press
// this app never ends or crashes
using
SdlDotNet;
using
SdlDotNet.Graphics;
using
SdlDotNet.Input;
using
System.Drawing;
namespace
KEYBOARD
{
class Program
{
public static void Main()
{
Video.Initialize();
Video.SetVideoMode(800, 600, 24);
for ( ; ; )
{
Video.Screen.Fill(Color.Orange);
Video.Screen.Update();
if (Mouse.IsButtonPressed(MouseButton.PrimaryButton)) break;
if (Keyboard.IsKeyPressed(Key.Escape)) break;
}
}
}
}
Can you confirm this and tell me how to solve it? It seems there are not too
many list members that use C# with SDL, but I supposse and hope that someone
is able to terminate with this problem ... my Mario game really was getting
very nice
Thank you very much
Pablo
Asesinar y comer un perro o un gato es lo mismo q hacerlo a una vaca, un
pollo, un cerdo o un pez. El genocidio no discrimina. No seas complice de
genocidas. No seas genocida. En la vida tarde o temprano todo vuelve. No
comas cadaveres. No seas necrófago.
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Pablo Marty
2012-08-22 06:17:21 UTC
Permalink
Hello girls and boys; Christian
 
Here comes the program edited as you told me
 {
{
||
||
||
||
{
}
||
||
||
{
}
}
}publicstaticvoidMain()Video.Initialize();Video.SetVideoMode(800, 600, 24);for( ; ; )Video.Screen.Fill(Color.Orange);Video.Screen.Update();if(Mouse.IsButtonPressed(MouseButton.PrimaryButton)Mouse.IsButtonPressed(MouseButton.SecondaryButton)Mouse.IsButtonPressed(MouseButton.WheelUp)Mouse.IsButtonPressed(MouseButton.WheelDown)Mouse.IsButtonPressed(MouseButton.None))break;if(Keyboard.IsKeyPressed(Key.Escape)Keyboard.IsKeyPressed(Key.A)Keyboard.IsKeyPressed(Key.Space)Keyboard.IsKeyPressed(Key.Return)) break;
 
I was sure it wouldn t work. Both input functions still return false, even the Mouse.IsButtonPressed(MouseButton.None), that teorethically should return true if no mouse button is pressed
Nevertheless, Christian, I really thank you strongly, cos you were the unique member of the list that replied me, even not being used to C#
 
I changed the Subject of this mail in order to catch the atention of those who use SDL on C# .NET programming language
 
I wonder, is C#SDL library (I mean the binarys, the DLLs) the same than the C/C++ library, or the VB one, or others. I really doubt if this could be an SDL bug. Perhaps the SDL library for C/C++ hasn t this problem, and the C#'s one does ...
 
Is there any older version of C# SDL than 6.1.1 beta, that maybe doesn t have this problem?
 
Could someone who uses C# (and SdlDotNet or C#SDL) tell me what to do with this? I would thank you very much

Pablo

Asesinar y comer un perro o un gato es lo mismo q hacerlo a una vaca, un pollo, un cerdo o un pez. El genocidio no discrimina. No seas complice de genocidas. No seas genocida. En la vida tarde o temprano todo vuelve. No comas cadaveres. No seas necrófago.

De: Christian Leger <***@gmail.com>
Para: Pablo Marty <***@yahoo.com.ar>; SDL Development List <***@lists.libsdl.org>
Enviado: martes, 21 de agosto de 2012 20:13
Asunto: Re: [SDL] important SDL BUG : Keyboard and Mouse classes dont work : Please HELP!!!

Hi,

If I were you, I'd make sure that your program still doesn't crash or
exit when you check for more than either the primary mouse button or
the escape key.

I suggest you try the same program, but with every mouse button, and
with a number of other keys (like a, b, c, etc. which shouldn't move
between a UK/US and latin-configured keyboard). Then mash the keyboard
to see that really none of these work.

So for example in the keyboard-checking part (you'll have to ensure
correct variable/constant names):

if
(
Keyboard.IsKeyPressed(Key.Escape) ||
Keyboard.IsKeyPressed(Key.Up) ||
Keyboard.IsKeyPressed(Key.Down) ||
...
Keyboard.IsKeyPressed(Key.a) ||
Keyboard.IsKeyPressed(Key.b) ||
Keyboard.IsKeyPressed(Key.c)
...

)
{
    break;
}

Finally, I'll point out that I'm not familiar with how this C# package
wraps SDL - it seems to test for 'key pressed' - does that mean the
key must be in the 'down' position when that function runs? What if
you just have quick fingers and the state of the keys is not down when
the program checks for 'pressed'?

Good luck!

Christian

On Tue, Aug 21, 2012 at 6:58 PM, Pablo Marty
Post by Pablo Marty
Hi Ladies and Guys
I have found out what my problem was: a simple, but very important SDL bug.
As I had told you before, the keyboard input didn t move my character
(Mario) ... and I was ignoring the Events class in order to introduce
multithreading to my program
I tried in a new simple program, that just tests these functions
(Keyboard.IsKeyPressed(Key) and Mouse.IsButtonPressed(MouseButton))
and they ALWAYS return false, that s they don t recognize the key press and
the mouse button press
// this app never ends or crashes
using
SdlDotNet;
using
SdlDotNet.Graphics;
using
SdlDotNet.Input;
using
System.Drawing;
namespace
KEYBOARD
{
class Program
{
public static void Main()
{
Video.Initialize();
Video.SetVideoMode(800, 600, 24);
for ( ; ; )
{
Video.Screen.Fill(Color.Orange);
Video.Screen.Update();
if (Mouse.IsButtonPressed(MouseButton.PrimaryButton)) break;
if (Keyboard.IsKeyPressed(Key.Escape)) break;
}
}
}
}
Can you confirm this and tell me how to solve it? It seems there are not too
many list members that use C# with SDL, but I supposse and hope that someone
is able to terminate with this problem ... my Mario game really was getting
very nice
Thank you very much
Pablo
Asesinar y comer un perro o un gato es lo mismo q hacerlo a una vaca, un
pollo, un cerdo o un pez. El genocidio no discrimina. No seas complice de
genocidas. No seas genocida. En la vida tarde o temprano todo vuelve. No
comas cadaveres. No seas necrófago.
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Fabio Panettieri
2012-08-22 06:51:32 UTC
Permalink
Hi Pablo,

I think you can get more attention if you follow some simple
Nettiquete rules, here are a few things that made me ignore your post.

* Try to write in plain text, avoid html.

* Try to sound humble when you write, not cocky "I found this very
important bug in SDL", even if true can be expressed as "I think there
is something not working here, can you help me fin what's wrong?".

* If others answer you, it's because you present an interesting
problem, and you show that you have tried all before asking for help,
not because you are about to finish that nice Mario game.

Regarding your problem.

* C#SDL 6.1.1 is the last version as the main page says
(http://cs-sdl.sourceforge.net/)
In their forum you will probably get faster answers, out you can try
using their chat ( although I'm not sure if it's alive ).

* It seems to me that Keyboard events can be accessed through
KeyboardState class (
http://cs-sdl.sourceforge.net/apidocs/html/class_sdl_dot_net_1_1_input_1_1_keyboard_state.html
)

Have you tried using that class? Did it gave you an error or something?

--
sn00py
Post by Pablo Marty
Hello girls and boys; Christian
Here comes the program edited as you told me
public static void Main()
{
Video.Initialize();
Video.SetVideoMode(800, 600, 24);
for ( ; ; )
{
Video.Screen.Fill(Color.Orange);
Video.Screen.Update();
if (Mouse.IsButtonPressed(MouseButton.PrimaryButton)
|| Mouse.IsButtonPressed(MouseButton.SecondaryButton)
|| Mouse.IsButtonPressed(MouseButton.WheelUp)
|| Mouse.IsButtonPressed(MouseButton.WheelDown)
|| Mouse.IsButtonPressed(MouseButton.None))
{
break;
}
if (Keyboard.IsKeyPressed(Key.Escape)
|| Keyboard.IsKeyPressed(Key.A)
|| Keyboard.IsKeyPressed(Key.Space)
|| Keyboard.IsKeyPressed(Key.Return))
{
break;
}
}
}
I was sure it wouldn t work. Both input functions still return false, even
the Mouse.IsButtonPressed(MouseButton.None), that teorethically should
return true if no mouse button is pressed
Nevertheless, Christian, I really thank you strongly, cos you were the
unique member of the list that replied me, even not being used to C#
I changed the Subject of this mail in order to catch the atention of those
who use SDL on C# .NET programming language
I wonder, is C#SDL library (I mean the binarys, the DLLs) the same than the
C/C++ library, or the VB one, or others. I really doubt if this could be an
SDL bug. Perhaps the SDL library for C/C++ hasn t this problem, and the C#'s
one does ...
Is there any older version of C# SDL than 6.1.1 beta, that maybe doesn t have this problem?
Could someone who uses C# (and SdlDotNet or C#SDL) tell me what to do with
this? I would thank you very much
Pablo
Asesinar y comer un perro o un gato es lo mismo q hacerlo a una vaca, un
pollo, un cerdo o un pez. El genocidio no discrimina. No seas complice de
genocidas. No seas genocida. En la vida tarde o temprano todo vuelve. No
comas cadaveres. No seas necrófago.
Enviado: martes, 21 de agosto de 2012 20:13
Asunto: Re: [SDL] important SDL BUG : Keyboard and Mouse classes dont work : Please HELP!!!
Hi,
If I were you, I'd make sure that your program still doesn't crash or
exit when you check for more than either the primary mouse button or
the escape key.
I suggest you try the same program, but with every mouse button, and
with a number of other keys (like a, b, c, etc. which shouldn't move
between a UK/US and latin-configured keyboard). Then mash the keyboard
to see that really none of these work.
So for example in the keyboard-checking part (you'll have to ensure
if
(
Keyboard.IsKeyPressed(Key.Escape) ||
Keyboard.IsKeyPressed(Key.Up) ||
Keyboard.IsKeyPressed(Key.Down) ||
...
Keyboard.IsKeyPressed(Key.a) ||
Keyboard.IsKeyPressed(Key.b) ||
Keyboard.IsKeyPressed(Key.c)
...
)
{
break;
}
Finally, I'll point out that I'm not familiar with how this C# package
wraps SDL - it seems to test for 'key pressed' - does that mean the
key must be in the 'down' position when that function runs? What if
you just have quick fingers and the state of the keys is not down when
the program checks for 'pressed'?
Good luck!
Christian
On Tue, Aug 21, 2012 at 6:58 PM, Pablo Marty
Post by Pablo Marty
Hi Ladies and Guys
I have found out what my problem was: a simple, but very important SDL bug.
As I had told you before, the keyboard input didn t move my character
(Mario) ... and I was ignoring the Events class in order to introduce
multithreading to my program
I tried in a new simple program, that just tests these functions
(Keyboard.IsKeyPressed(Key) and Mouse.IsButtonPressed(MouseButton))
and they ALWAYS return false, that s they don t recognize the key press and
the mouse button press
// this app never ends or crashes
using
SdlDotNet;
using
SdlDotNet.Graphics;
using
SdlDotNet.Input;
using
System.Drawing;
namespace
KEYBOARD
{
class Program
{
public static void Main()
{
Video.Initialize();
Video.SetVideoMode(800, 600, 24);
for ( ; ; )
{
Video.Screen.Fill(Color.Orange);
Video.Screen.Update();
if (Mouse.IsButtonPressed(MouseButton.PrimaryButton)) break;
if (Keyboard.IsKeyPressed(Key.Escape)) break;
}
}
}
}
Can you confirm this and tell me how to solve it? It seems there are not too
many list members that use C# with SDL, but I supposse and hope that someone
is able to terminate with this problem ... my Mario game really was getting
very nice
Thank you very much
Pablo
Asesinar y comer un perro o un gato es lo mismo q hacerlo a una vaca, un
pollo, un cerdo o un pez. El genocidio no discrimina. No seas complice de
genocidas. No seas genocida. En la vida tarde o temprano todo vuelve. No
comas cadaveres. No seas necrófago.
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Ryan C. Gordon
2012-08-22 16:23:23 UTC
Permalink
Post by Pablo Marty
publicstaticvoidMain()
{
Video.Initialize();
Video.SetVideoMode(800, 600, 24);
for( ; ; )
{
Video.Screen.Fill(Color.Orange);
Video.Screen.Update();
if(Mouse.IsButtonPressed(MouseButton.PrimaryButton)
Having not used C#, I can't say for certain, but if you had written this
in C, you would need to tell SDL to run it's event queue, otherwise it
won't ever notice mouse or keyboard input (and thus, always tell you
that the mouse button isn't pressed).

A quick Googling says there's something like Event.Run() you should call
somewhere. You'll have to look into it further, but something like that
should make IsButtonPressed() work correctly.

Example code: http://swinbrain.ict.swin.edu.au/wiki/Sdl_Dot_Net_Tutorial

--ryan.
Christian Leger
2012-08-22 17:58:31 UTC
Permalink
Hi,

Pablo you're very welcome. I try to help anyone that I think I can
help, and the same is true for many people here. Fabio makes a good
point - it's difficult sometimes to answer people who might be jumping
to certain conclusions, like if there is a bug or not. How you choose
your words can often make a difference, and I'd say it's good to show
you know the difference between what you know and what you don't.
Extra care has to be placed on what you *might think* you know but
actually don't. I'm not the best at this which is why I always qualify
my statements with 'is it possible that' and 'am I wrong to suppose
that...'. It's my airbag for those times where I slip outside my
universal politeness zone.

Take care to draw the line between what you really know (100% or 90%),
and what you don't really know. Everything you don't 100% know is open
to questioning. People here are very polite and they won't question
you as easily as you will, if you're willing to do it. The more easily
you show yourself questioning your own line of reasoning (which means,
the more willing you are to investigate and demonstrate your
investigations - in as much detail as required but as simple as
possible, with all unnecessary detail left out) , the more people will
jump on your investigation to help out. That's my pop philosophy :-)

TL; DR: what Fabio said :-D

What Ryan suggests is a better expression of what I was trying to say:
in C, you have to poll the event queue to find out if anything was
generated by the input (or other) subsystems. Your C# code doesn't
seem to have any calls directly related to polling, and that is why I
pointed out that my ignorance of C# could be a blind spot. If I didn't
mention it, I should have mentioned event polling.

Please let us know if you are able to use something like Event.run.

If you are still having difficulties, I suggest you get your hands on
a demo that uses SDL in C#, because I would be surprised if that
doesn't work out of the box. Then you can carefully compare your event
processing code to the code in the demo, and I think there is a good
chance you will make progress with that.

Good luck!

Christian
Post by Pablo Marty
publicstaticvoidMain()
{
Video.Initialize();
Video.SetVideoMode(800, 600, 24);
for( ; ; )
{
Video.Screen.Fill(Color.Orange);
Video.Screen.Update();
if(Mouse.IsButtonPressed(MouseButton.PrimaryButton)
Having not used C#, I can't say for certain, but if you had written this in
C, you would need to tell SDL to run it's event queue, otherwise it won't
ever notice mouse or keyboard input (and thus, always tell you that the
mouse button isn't pressed).
A quick Googling says there's something like Event.Run() you should call
somewhere. You'll have to look into it further, but something like that
should make IsButtonPressed() work correctly.
Example code: http://swinbrain.ict.swin.edu.au/wiki/Sdl_Dot_Net_Tutorial
--ryan.
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Jared Maddox
2012-08-23 03:49:10 UTC
Permalink
Date: Tue, 21 Aug 2012 15:58:57 -0700 (PDT)
Subject: [SDL] important SDL BUG : Keyboard and Mouse classes dont
work : Please HELP!!!
Content-Type: text/plain; charset="iso-8859-1"
Can you confirm this and tell me how to solve it? It seems there are not too
many list members that use C# with SDL, but I supposse and hope that someone
is able to terminate with this problem ... my Mario game really was getting
very nice
?
Thank you very much
?
Pablo
I was looking through the mailing-list archives recently, and it looks
like you've been postoing on this game for a while. Always nice to see
some activity, so thanks.
Date: Tue, 21 Aug 2012 23:17:21 -0700 (PDT)
Subject: [SDL] someone who uses C# SDL please - Re: important SDL BUG
: Keyboard and Mouse classes dont work : Please HELP!!!
Content-Type: text/plain; charset="iso-8859-1"
I wonder, is C#SDL library (I mean the binarys, the DLLs) the same than the
C/C++ library, or the VB one, or others. I really doubt if this could be an
SDL bug. Perhaps the SDL library for C/C++ hasn t this problem, and the C#'s
one does ...
?
As a matter of fact, no, SDL# (or whatever it's proper name is) isn't
actually part of the SDL project. That, I suspect, is why you're
finding little help (and finding problems). It's certainly why I
haven' been posting on this, since I don't even use C# (lately I've
even been shifting to plain C!).
Could someone who uses C# (and SdlDotNet or C#SDL) tell me what to do with
this? I would thank you very much
I'm afraid that for real help you'll probably need to try the SDL#
project's own resources, though whether there's any activity there I
don't know.
Pablo
Date: Wed, 22 Aug 2012 12:23:23 -0400
Subject: Re: [SDL] someone who uses C# SDL please - Re: important SDL
BUG : Keyboard and Mouse classes dont work : Please HELP!!!
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Having not used C#, I can't say for certain, but if you had written this
in C, you would need to tell SDL to run it's event queue, otherwise it
won't ever notice mouse or keyboard input (and thus, always tell you
that the mouse button isn't pressed).
A quick Googling says there's something like Event.Run() you should call
somewhere. You'll have to look into it further, but something like that
should make IsButtonPressed() work correctly.
Example code: http://swinbrain.ict.swin.edu.au/wiki/Sdl_Dot_Net_Tutorial
--ryan.
He's specifically said that he's avoiding using the Event class so
that he can use multithreading, though some sort of marshalling system
might work. Unfortunately, such a system would probably be somewhat
redundant as well, since SDL# presumably has one of it's own.
Date: Wed, 22 Aug 2012 13:58:31 -0400
Subject: Re: [SDL] someone who uses C# SDL please - Re: important SDL
BUG : Keyboard and Mouse classes dont work : Please HELP!!!
Content-Type: text/plain; charset=ISO-8859-1
Hi,
If you are still having difficulties, I suggest you get your hands on
a demo that uses SDL in C#, because I would be surprised if that
doesn't work out of the box. Then you can carefully compare your event
processing code to the code in the demo, and I think there is a good
chance you will make progress with that.
I suspect that he already has. He's been posting off-and-on about
various problems that he's needed help with, this is just the most
recent one (and presumably an attempt to make the game faster). I
strongly suspect that he's simply outgrown the constraints of the demo
code.
Pablo Marty
2012-08-24 02:02:56 UTC
Permalink
Thanks to you, Jared
 
I also found out, searching the Internet, that C# SDL (or SDL.NET) is not supported at all !!! ... and as one of you told me, the forum or chat of C# SDL Main page is not alive
 
Well, fortunately, I also know C (plain C, not C++) ... I used the DJGPP(C/C++ for DOS) for a time, but it s no longer suported in any actual machine

Here you said you use C now, so, if I shift to C I won t have problems? What C Development Environment (or Compiler, or SDK) should I use? There is a Visual C/C++ for .NET? (because I m used to Visual Studio s nice Editor) ... Where can I get SDL for C?
Thank you

About my game, now I m writting a new version, ... now it s much better, nothing to do with the first version
I returned to using the Events class loop, and it worked again, but I still want to be able to use Threads and ignore that Events loop, ... that is, to handle my own loops, like this

for ( ; ; )
{
    ReadKbrd();
    DrawGame();
}


Asesinar y comer un perro o un gato es lo mismo q hacerlo a una vaca, un pollo, un cerdo o un pez. El genocidio no discrimina. No seas complice de genocidas. No seas genocida. En la vida tarde o temprano todo vuelve. No comas cadaveres. No seas necrófago.

De: Jared Maddox <***@gmail.com>
Para: ***@lists.libsdl.org
Enviado: jueves, 23 de agosto de 2012 0:49
Asunto: Re: [SDL] someone who uses C# SDL please - Re: important SDL BUG : Keyboard and Mouse classes dont work : Please HELP!!!
Date: Tue, 21 Aug 2012 15:58:57 -0700 (PDT)
Subject: [SDL] important SDL BUG : Keyboard and Mouse classes dont
    work :    Please HELP!!!
Content-Type: text/plain; charset="iso-8859-1"
Can you confirm this and tell me how to solve it? It seems there are not too
many list members that use C# with SDL, but I supposse and hope that someone
is able to terminate with this problem ... my Mario game really was getting
very nice
?
Thank you very much
?
Pablo
I was looking through the mailing-list archives recently, and it looks
like you've been postoing on this game for a while. Always nice to see
some activity, so thanks.
Date: Tue, 21 Aug 2012 23:17:21 -0700 (PDT)
Subject: [SDL] someone who uses C# SDL please - Re: important SDL BUG
    :    Keyboard and Mouse classes dont work : Please HELP!!!
Content-Type: text/plain; charset="iso-8859-1"
I wonder, is C#SDL library (I mean the binarys, the DLLs) the same than the
C/C++ library, or the VB one, or others. I really doubt if this could be an
SDL bug. Perhaps the SDL library for C/C++ hasn t this problem, and the C#'s
one does ...
?
As a matter of fact, no, SDL# (or whatever it's proper name is) isn't
actually part of the SDL project. That, I suspect, is why you're
finding little help (and finding problems). It's certainly why I
haven' been posting on this, since I don't even use C# (lately I've
even been shifting to plain C!).
Could someone who uses C# (and SdlDotNet or C#SDL) tell me what to do with
this? I would thank you very much
I'm afraid that for real help you'll probably need to try the SDL#
project's own resources, though whether there's any activity there I
don't know.
Pablo
Date: Wed, 22 Aug 2012 12:23:23 -0400
Subject: Re: [SDL] someone who uses C# SDL please - Re: important SDL
    BUG : Keyboard and Mouse classes dont work : Please HELP!!!
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Having not used C#, I can't say for certain, but if you had written this
in C, you would need to tell SDL to run it's event queue, otherwise it
won't ever notice mouse or keyboard input (and thus, always tell you
that the mouse button isn't pressed).
A quick Googling says there's something like Event.Run() you should call
somewhere. You'll have to look into it further, but something like that
should make IsButtonPressed() work correctly.
Example code: http://swinbrain.ict.swin.edu.au/wiki/Sdl_Dot_Net_Tutorial
--ryan.
He's specifically said that he's avoiding using the Event class so
that he can use multithreading, though some sort of marshalling system
might work. Unfortunately, such a system would probably be somewhat
redundant as well, since SDL# presumably has one of it's own.
Date: Wed, 22 Aug 2012 13:58:31 -0400
Subject: Re: [SDL] someone who uses C# SDL please - Re: important SDL
    BUG : Keyboard and Mouse classes dont work : Please HELP!!!
Content-Type: text/plain; charset=ISO-8859-1
Hi,
If you are still having difficulties, I suggest you get your hands on
a demo that uses SDL in C#, because I would be surprised if that
doesn't work out of the box. Then you can carefully compare your event
processing code to the code in the demo, and I think there is a good
chance you will make progress with that.
I suspect that he already has. He's been posting off-and-on about
various problems that he's needed help with, this is just the most
recent one (and presumably an attempt to make the game faster). I
strongly suspect that he's simply outgrown the constraints of the demo
code.
Jared Maddox
2012-08-24 04:52:43 UTC
Permalink
Date: Thu, 23 Aug 2012 19:02:56 -0700 (PDT)
Subject: Re: [SDL] someone who uses C# SDL please - Re: important SDL
BUG : Keyboard and Mouse classes dont work : Please HELP!!!
Content-Type: text/plain; charset="iso-8859-1"
Thanks to you, Jared
?
I also found out, searching the Internet, that C# SDL (or SDL.NET) is not
supported at all !!! ... and as one of you told me, the forum or chat of C#
SDL Main page is not alive
?
Well, fortunately, I also know C (plain C, not C++) ... I used the
DJGPP(C/C++ for DOS) for a time, but it s no longer suported in any actual
machine
Here you said you use C now, so, if I shift to C I won t have problems? What
C Development Environment (or Compiler, or SDK) should I use? There is a
Visual C/C++ for .NET? (because I m used to Visual Studio s nice Editor) ...
Well, I didn't say that there won't be problems, bugs even pop up in
SDL 1.2 on occasion, but almost everything is already fixed.

As for the compiler suite you should use, I use MinGW/MSys, so you
should really ask someone who uses a gui. ;)

However, there are several free open source IDEs, and Microsoft also
provides one called MSVC++ (the C# version you're used to started out
with the C and C++ versions). However, .Net is not directly available
through C or C++, you have to use Microsoft's proprietary
compatibility system for C++. If you really want .Net, then you might
as well just use the compatibility system to provide your own SDL
wrapper for C#.

Fortunately, the C version of SDL is fully compatible with C++, so if
you don't need stuff from .Net, then you can go that route (though I
think MSVC++ is written in C#, so if that's what you were talking
about...).
Where can I get SDL for C?
Thank you
The primary SDL site is here: http://www.libsdl.org/ . If you look to
the side, under "Downloads" it says "SDL 1.2" and "SDL HG". The first
is a link to a download page, the second is a link to a SCM page. The
already released stuff is in the first link, the in-development stuff
is in the second link.
About my game, now I m writting a new version, ... now it s much better,
nothing to do with the first version
I returned to using the Events class loop, and it worked again, but I still
want to be able to use Threads and ignore that Events loop, ... that is, to
handle my own loops, like this
for ( ; ; )
{
??? ReadKbrd();
??? DrawGame();
}
I don't know C#, but I assume that by this point they've provided a
thread-safe queue container (first-in, first-out). If you have the
event handlers just store event messages into that container then you
should be able to pull them out in your own loop in another thread.

That having been said, I don't know C#, or how SDL# implemented their
wrapper, so this might not work. The only way to know is to
investigate it.

Loading...