I want to write the game in C #.
I use the following code.
using System;
using System.Runtime.InteropServices;
using SFML.Graphics;
using SFML.System;
using SFML.Window;
namespace opengl
{
static class Program
{
static void Main()
{
RenderWindow app = new RenderWindow(VideoMode.DesktopMode,"Game");
app.SetFramerateLimit(60);
while (app.IsOpen)
{
app.Clear();
drawQuad(app, Color.Green, 500, 500, 200, 500, 300, 100);
app.Display();
}
}
static void drawQuad(RenderWindow w ,Color c,int x1,int y1,int w1,int x2,int y2,int w2)
{
ConvexShape shape = new ConvexShape(4);
shape.FillColor = c;
shape.SetPoint(0, new Vector2f(x1 - w1, y1));
shape.SetPoint(1, new Vector2f(x2 - w2, y2));
shape.SetPoint(2, new Vector2f(x1 + w1, y1));
shape.SetPoint(3, new Vector2f(x2 + w2, y2));
w.Draw(shape);
}
}
}
But I am faced with the following error.
System.BadImageFormatException: 'Could not load file or assembly 'sfmlnet-window-2, Version=2.4.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.'
The problem was solved. I should not use the 64-bit version, I should use the 32-bit version.