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

Author Topic: using #include <Rect.hpp> in C# and Collisition between two Rect´s  (Read 1362 times)

0 Members and 1 Guest are viewing this topic.

Atvus

  • Newbie
  • *
  • Posts: 1
    • View Profile
Hi Guys,
i have to programm Pong for my university. The challenge is, that it has to been done in c#. Unfortunately, I have my problems to convert the examples from c++ to c#. I found thsi great page:
https://www.sfml-dev.org/documentation/2.4.2/classsf_1_1Rect.php
I´d like to use them, but i don´t get it, how i could use it in c#
How could i include Rect in c# and how could i use intersects() in c#
I hope my englisch is not soooo bad ^^
« Last Edit: April 19, 2017, 05:26:35 pm by Atvus »

Tigre Pablito

  • Full Member
  • ***
  • Posts: 226
    • View Profile
    • Email
Re: using #include <Rect.hpp> in C# and Collisition between two Rect´s
« Reply #1 on: April 21, 2017, 04:35:26 pm »
Hi

C# does not take 'includes', but 'usings' (like using System;)
(And for me is easier than C++)

IntRect rect1, rect2;
rect1 = new IntRect(new Vector2i(100, 100), new Vector2i(300, 150));
rect2 = new IntRect(300, 200, 400, 100);
if (rect1.Intersects(rect2))
{
    // the code here will execute because the condition is true
}
 

Do you know C# and programming? Or you have the project already done in C++ and just need to translate it to C#?