|
Dear Pete O'Hanlon,
Yes, this could be done but my case is little bit different.
Is there any way the second event can know that the first event has occured successfully??
X
|
|
|
|
|
Also, does anyone know some GOOD articles on Xinput that I could see? (I'll accept DirectInput, too. And DirectSound.) Thanks.
-- modified at 15:57 Sunday 11th November, 2007
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|
|
These[^] articles are quite decent.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Also, I see about devices, but it gives me an error. If you know some DirectX, could you tell me? Do I need to make an Enum?
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|
|
Sure, but are they any GOOD?
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I keep seeing (or something close to it...):
public void InitalizeDevice()<br />
{<br />
keyb = new Device(SystemGuid.KeyBoard);<br />
^ gives me error<br />
}
keyb or whatever you want to call it is what Im asking about
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|
|
Download the source code from the site. It is available, but keyb is a member variable of type Device .
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Yup - as well as being fully clothed, they are actually quite instructive.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Since we all know (well, most of you) that I'm trying to construct a game, there's a couple more things I would like to know.
A) How do I use more than one key at a time. I have a player moving, and then jumping, but then he stops moving to the side once you press the jump button. This code looks somewhat like below.
protected override ProcessCmdKey(stuff)<br />
{<br />
switch (keydata)<br />
{<br />
case Keys.Space: <br />
Jump();<br />
case Keys.Right:<br />
Move_Right();<br />
}<br />
}
B) How to rotate Recangle rect . Say rect is hooked up to a timer though.
Also, if anyone could provide some articles on game physics, I'd like that. Or just to explain it a little. No code necessary, but I just want to have an idea on it. My thought was that developers set up points with algorithms to have a point stay to a certain part of, say a cube, and assign weight and rotation so it just goes by the points. Confusig, duh. That's why I want to know. Thaks SO MUCH in advance.
P.S. I should be just about done with stupid questions!
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|
|
Hi,
1.
my app gets KeyPress events for every (printable) key I press, even when another
printable key is down at the same time, so the sequence "Adown,Sdown,Sup,Aup" generates
both the A and the S KeyPress event.
Two ideas though:
- it may depend on the actual keyboard firmware; long time ago I had a KB that only
could handle a single key action at a time (i.e. one key down blocked everything else,
except of course for the modifier keys)
- "printable" keys tend to autorepeat (i.e. generate extra Down and Press events when you
keep them down), maybe that is confusing you.
2.
you can translate, rotate, scale anything you like WHILE painting it, by using the
appropriate Graphics methods in OnPaint, such as Graphics.RotateTransform()
and the general Graphics.Transform().
Warning: these transforms are cumulative, they modify everything that follows.
3.
MasterSharp wrote: I should be just about done with stupid questions!
I trust you will discover more.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
How does RotateTransform work? I put in a float and it appears nothing happened.
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|
|
Oh, I got it. But another question. How do you set up a switch for variables?
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|
|
MasterSharp wrote: How do you set up a switch for variables?
please clarify what it is you are curious about
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
switch (what goes here)<br />
{<br />
case x = 1:<br />
blah<br />
break;<br />
<br />
case x = 2:<br />
blah <br />
break;<br />
}
Also with bools and other numerical types, chars. Thanks.
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|
|
Hi,
switch(numeric expression) {
case constant_value_1: statement1; break;
case constant_value_2: statement2; break;
case constant_value_3: statement3; break;
...
default: statement_default; break;
}
switch expects a variable or expression of integer numeric type, char or string;
each case just expects a single constant of the same type (no "x=").
This is something you should find yourself by reading an introductory book on the
language you use, as well as by reading the available documentation (MSDN).
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
DirectX has DirectInput, which I think works better for input in games. You can also use keydown and keyup to track which keys are down at once.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Usually for games i don't do any actions on the keypress event, instead i set a flag to say that a key is pressed, and then when the main logic loop runs through, it checks the flags and performs different actions based on whether or not a key is pressed.
for example:
bool key = false;
onKeyDown() {
key = true;
}
onKeyUp() {
key = false;
}
main()
{
if(key)
}
My current favourite word is: PIE!
Good ol' pie, it's been a while.
|
|
|
|
|
How would you know which key id down?
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|
|
So how can you tell which key is down? I figured out the KeyDown / KeyUp, but I need to know KEYS now. Thanks so far, though.
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|
|
Hi
I've just created a simple application loader which recognizes a certain attribute i created and then loads a static method Load()
this is used to load particular classes which have to run as the application starts.
the weird thing is that in one of the classes the static constructor is called twice:
first time - when the application loader calls it via reflection
second time - when another part of the application uses this class for the first time.
if anyone has a clue
thanks
gil
|
|
|
|
|
gilaz11 wrote: this is used to load particular classes which have to run as the application starts.
the weird thing is that in one of the classes the static constructor is called twice:
first time - when the application loader calls it via reflection
second time - when another part of the application uses this class for the first time.
This only happens with one of the classes?
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Hi!
form1 has a function to draw a line.For example: public void draw();
I also have form2 with a button.
when i click this button, a line will be drawn on form1.
(in the function of button click event, i call draw like this:
form1 myform=new form1();
myform.draw();
)
but it doesn't work.
So what should i do?
Best Regards!
|
|
|
|
|
It works, you just don't see it. The line is drawn on form1 which is invisible as you haven't displayed it.
|
|
|
|
|
Form1 appears behide form2, when i click button, i choose form1 to watch but i did not see the line.
So how can i see the line on form1? (because your reply is i did not display form1)
Thanks for replying!
|
|
|
|
|
When you call form1 myform=new form1(); you are creating a new instance of Form1 and the line is drawn on the new instance.
|
|
|
|