Tag Archives: C#

Unreal Engine 4 Set Up for Programming in Visual Studio 2013

There are many tutorials and other info in the Internet, but no concrete and fast tips for people who are experienced developers and only need to start using the Unreal environment for making games.

You need:

1/ Unreal Engine 4

2/ Visual Studio Community 2013

3/ Visual Studio 2013 SDK

You do:

1/ Install Visual Studio 2013

2/ Install Visual Studio 2013 SDK

3/ Install Unreal Engine 4

4/ Follow the steps: https://docs.unrealengine.com/latest/INT/Programming/Development/VisualStudioSetup/UnrealVS/index.html

5/ Run Unreal Engine 4 and choose the project template with C++ code not with blueprints

6/ Your chosen project should be open in Visual Studio 2013

7/Now, the Unreal power is in your hand if you are an experienced programmer.

 

 

 

“The Type or Namespace ‘GTK’ could not be found” error – MonoDevelop on Linux

“The Type or Namespace ‘GTK’ could not be found” error – MonoDevelop on Linux

MonoDevelop 3.0.6
GTK# 2.12
openSuse 13.1

When you press F5 to build and get this error in MonoDevelop, just go to:

Project -> Your Project name Options -> Build -> General

You probably see:

Target Framework: Mono /.Net 3.5

Change it to:

Target Framework: Mono /.Net 4.0

Do all what MonoDevelop wants from you. Now, your project has no errors during building.

Class in C#

Class in C#

Let’s write a simple class in C#:

/* A simple class for adding two integers */

using System;

class Moro
{
public int a;
public int b;
}

class Poro
{
public static void Main()
{
int c;
int d;

Moro pik = new Moro();
pik.a = 2;
pik.b = 3;
c = pik.a + pik.b;

Moro lik = new Moro();
lik.a = 5;
lik.b = 6;
d = lik.a + lik.b;

Console.WriteLine(“pik: ” + c);
Console.WriteLine(“lik: ” + d);
}
}

We have the result:

D:\SharpDevelop Projects\CSharp>csc cs9.cs
Microsoft (R) Visual C# 2010 Compiler version 4.0.30319.1
Copyright (C) Microsoft Corporation. All rights reserved.

D:\SharpDevelop Projects\CSharp>cs9
pik: 5
lik: 11

D:\SharpDevelop Projects\CSharp>

So it’s work! Let’s add a method:

/* A simple class for adding two integers */

using System;

class Moro
{
public int a;
public int b;
public double wynik;

public double Mira()
{
wynik = a + b * 100;
return wynik;
}
}

class Poro
{
public static void Main()
{
int c;
int d;
double f;
double g;

Moro pik = new Moro();
pik.a = 2;
pik.b = 3;
c = pik.a + pik.b;
f = pik.Mira();

Moro lik = new Moro();
lik.a = 5;
lik.b = 6;
d = lik.a + lik.b;
g = lik.Mira();

Console.WriteLine(“pik: ” + c + ” and Mira: ” + f);
Console.WriteLine(“lik: ” + d + ” and Mira: ” + g);
}
}

We have the result:

D:\SharpDevelop Projects\CSharp>csc cs10.cs
Microsoft (R) Visual C# 2010 Compiler version 4.0.30319.1
Copyright (C) Microsoft Corporation. All rights reserved.

D:\SharpDevelop Projects\CSharp>cs10
pik: 5 and Mira: 302
lik: 11 and Mira: 605

D:\SharpDevelop Projects\CSharp>

Now, let’s write a class with constructor:

using System;
class Boro
{
public int an;
public int bn;
public int wynik;

public Boro(int a, int b)
{
{
an = a;
bn = b;
}
}

public int Goga()
{
{

wynik = an + bn;
return wynik;
}
}
}

class Moka
{
public static void Main()
{
int c;
int d;
int e;
int f;

Boro adel = new Boro(1,2);
c = adel.Goga();
Console.WriteLine(“Mamy ” + c);

Boro adel1 = new Boro(3,8);
d = adel1.Goga();
Console.WriteLine(“Mamy ” + d);

Boro adel2 = new Boro(12345,5566);
e = adel2.Goga();
Console.WriteLine(“Mamy ” + e);

Boro adel3 = new Boro(-123,455);
f = adel3.Goga();
Console.WriteLine(“Mamy ” + f);

}
}

We have the result:

D:\SharpDevelop Projects\CSharp>cs12
Mamy 3
Mamy 11
Mamy 17911
Mamy 332

D:\SharpDevelop Projects\CSharp>

We can have a method overloading if we need:

using System;
class Mat
{
public int Fig(int a)
{
return a * a ;
}
public double Fig(double a)
{
return a * a ;
}
public int Fig(int a, int b)
{
return a * b;
}
public double Fig(double a, double b)
{
return a * b;
}
}

class Obl
{
public static void Main()
{
Mat ob = new Mat();
Console.WriteLine(“Suma: ” + ob.Fig(2));

Mat ob1 = new Mat();
Console.WriteLine(“Suma: ” + ob1.Fig(0.3));

Mat ob2 = new Mat();
Console.WriteLine(“Suma: ” + ob2.Fig(4,5));

Mat ob3 = new Mat();
Console.WriteLine(“Suma: ” + ob3.Fig(4.5, 6.7));
}
}

We have the result:

D:\SharpDevelop Projects\CSharp>cs13
Suma: 4
Suma: 0.09
Suma: 20
Suma: 30.15

D:\SharpDevelop Projects\CSharp>

Now,  we can see how method overloading works for constructors:

using System;

class Spok
{
public int an;
public int bn;
public double cn;
public double dn;
public double en;

public Spok (int a, int b, double c)
{
an = a;
bn = b;
cn = c;
}

public Spok (int a, int b)
{
an = a;
bn = b;
}

public Spok(double d, double e)
{
dn = d;
en = e;
}

public double Oro()
{
return an + bn + cn + dn + en;
}
}

class Eti
{
public static void Main()
{

Spok adel = new Spok(1,2);
Console.WriteLine(adel.Oro());
Spok adel1 = new Spok(1,2,3);
Console.WriteLine(adel1.Oro());
Spok adel2 = new Spok(1.2, 4.5);
Console.WriteLine(adel2.Oro());
}
}

We have the result:

D:\SharpDevelop Projects\CSharp>cs14
3
6
5.7

D:\SharpDevelop Projects\CSharp>