Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: not so smooth transition to C# (sharp noob lol)  (Read 3876 times)

0 Members and 1 Guest are viewing this topic.

Charlie

  • Newbie
  • *
  • Posts: 10
    • View Profile
not so smooth transition to C# (sharp noob lol)
« on: May 29, 2012, 08:08:37 am »
I was messing around with the dot net library and GAAHH I dunno why I'm having such a hard time with it, but I can't even figure out how to do keypressed to make a sprite move..
Someone tell me and make me feel stupid now lol.
So far I'm way more confused with C# than with C++! lol

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: not so smooth transition to C# (sharp noob lol)
« Reply #1 on: May 29, 2012, 08:12:22 am »
Have you first read the C++ tutorials and .Net API documentation?
Laurent Gomila - SFML developer

Charlie

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: not so smooth transition to C# (sharp noob lol)
« Reply #2 on: May 29, 2012, 08:22:57 am »
well I'm using 2.0..didn't see any tutorials besides the setup part..
In C++ I used GetInput().isKeyDown .....i think that was 1.6 though.

basically not picking up on the syntax..

I'm just wondering what the actual syntax is for using isKeyDown ...don't actually need sprite moving code
« Last Edit: May 29, 2012, 08:34:15 am by Charlie »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: not so smooth transition to C# (sharp noob lol)
« Reply #3 on: May 29, 2012, 08:33:15 am »
If you search the forum you'll find that sf::Input has been replaced with sf::Keyboard / sf::Mouse / sf::Joystick.

In the API doc, looking at the list of classes in the sfml-window module (which is not huge), you can also easily spot sf::Keyboard.
Laurent Gomila - SFML developer

Charlie

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: not so smooth transition to C# (sharp noob lol)
« Reply #4 on: May 29, 2012, 08:36:22 am »
yeah i've looked at that and see:


public static bool IsKeyPressed(
   Keyboard..::..Key key
)

but i still dont get the actual syntax to be used.....

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: not so smooth transition to C# (sharp noob lol)
« Reply #5 on: May 29, 2012, 09:06:33 am »
if (Keyboard.IsKeyPressed(Keyboard.Left))
{
    ...
}
Laurent Gomila - SFML developer

Charlie

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: not so smooth transition to C# (sharp noob lol)
« Reply #6 on: May 29, 2012, 09:13:36 am »
Hmmm that was actually exactly what I was attempting but when i do I only get these options:

if (Keyboard.IsKeyPressed(Keyboard.(Equals/isKeyPressed/Key/ReferenceEquals) )
{
}

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: not so smooth transition to C# (sharp noob lol)
« Reply #7 on: May 29, 2012, 09:16:04 am »
Sorry, it's Keyboard.Key.Left (in C#, the name of the enum is part of the full name, unlike in C++03).
Laurent Gomila - SFML developer

Charlie

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: not so smooth transition to C# (sharp noob lol)
« Reply #8 on: May 29, 2012, 09:18:56 am »
yep that did it. thanks...and of course now it looks so obvious. :) lol