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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - rcplusplus

Pages: [1]
DotNet / System.DllNotFoundException on Mac OS
« on: August 19, 2019, 06:57:50 am »
I'm on Mac OS Mojave using Visual Studio Community 2019.

First I created a blank C# project. Then I installed the SFML.Net NuGet. After that, this is what my packages.config file looked like:

<?xml version="1.0" encoding="utf-8"?>
  <package id="CSFML" version="2.5.0" targetFramework="net47" />
  <package id="SFML.Audio" version="2.5.0" targetFramework="net47" />
  <package id="SFML.Graphics" version="2.5.0" targetFramework="net47" />
  <package id="SFML.Net" version="2.5.0" targetFramework="net47" />
  <package id="SFML.System" version="2.5.0" targetFramework="net47" />
  <package id="SFML.Window" version="2.5.0" targetFramework="net47" />

I then create a simple main program:

using System;
using SFML;
using SFML.Graphics;
using SFML.Window;

namespace HelloSFML
    class MainClass
        private static RenderWindow _window;

        public static void Main(string[] args)
            _window = new RenderWindow(new VideoMode(640, 480), "Hello SFML!");
            _window.Closed += new EventHandler(OnClosed);
            while (_window.IsOpen)

        private static void OnClosed(object sender, EventArgs e)

After building, I then copy the following files to my the Debug/bin folder of my project:


I then also create a file called sfmlnet-graphics.dll.config in that same folder with the following contents:

<?xml version="1.0" encoding="utf-8"?>
        <dllmap dll="csfml-graphics" target="libcsfml-graphics.2.5.0.dylib"/>
        <dllmap dll="csfml-audio" target="libcsfml-audio.2.5.0.dylib"/>
        <dllmap dll="csfml-window" target="libcsfml-window.2.5.0.dylib"/>
        <dllmap dll="csfml-system" target="libcsfml-system.2.5.0.dylib"/>
        <dllmap dll="csfml-network" target="libcsfml-network.2.5.0.dylib"/>

However, when I run the program, I get the following exception:

{System.DllNotFoundException: csfml-graphics
  at (wrapper managed-to-native) SFML.Graphics.RenderWindow.sfRenderWindow_createUnicode(SFML.Window.VideoMode,intptr,SFML.Window.Styles,SFML.Window.ContextSettings&)
  at SFML.Graphics.RenderWindow..ctor (SFML.Window.VideoMode mode, System.String title, SFML.Window.Styles style, SFML.Window.ContextSettings settings) [0x00040] in <e68fba52605f4eee88783890392bddfc>:0
  at SFML.Graphics.RenderWindow..ctor (SFML.Window.VideoMode mode, System.String title) [0x0000b] in <e68fba52605f4eee88783890392bddfc>:0
  at HelloSFML.MainClass.Main (System.String[] args) [0x00001] in /Users/rutvik/Desktop/hello-csharp/hello-csharp/MainClass.cs:14 }

I'm really not sure what other steps are required to get this to work. There are some other posts on this forum:



^ Both of those posts seem inconclusive and don't fix my problem (from what I can tell). Not sure what other steps are needed to get this to work...

Java / Trouble setting the viewport
« on: September 09, 2013, 02:28:16 am »
I made a very simple app to test JSFML and learn how to use views, but when I tried to set the viewport, nothing happened; the view still takes up the whole screen when it should take up half. I looked through my code a few times, but I was unable to catch the problem. I've tested similar code in the c++ version and it works, so I'm not sure if there's a difference in how I need to use the viewports in java or if I'm making a silly error...

If anyone could point me to the problem I'd really be grateful.

        RenderWindow window = new RenderWindow();
        ContextSettings ctxSettings = new ContextSettings(8);
        int screenWidth = 720;
        int screenHeight = 480;
        window.create(new VideoMode(screenWidth, screenHeight),
                              "JSFML Test",
                               RenderWindow.CLOSE | RenderWindow.TITLEBAR,

        Texture bgTexture = new Texture();
        // load the bg picture with an InputStream
        Vector2i worldSize = bgTexture.getSize();
        RectangleShape bg = new RectangleShape();
        bg.setSize(new Vector2f(bgTexture.getSize()));
        View view = new View(window.getDefaultView().getCenter(), new Vector2f(screenWidth, screenHeight));
        view.setViewport(new FloatRect(0, 0, 0.5f, 1.f));
        RectangleShape player1 = new RectangleShape();
        player1.setSize(new Vector2f(20, 20));
        player1.setPosition(0, 0);
        int player1MoveSpeed = 200;
        Clock clock = new Clock();
        while (window.isOpen())

            float dt = clock.restart().asSeconds();        
            // move the player at `player1MoveSpeed`
            for (Event event : window.pollEvents())
                switch (event.type)
                    case CLOSED:

General / SFML Empty Application Xcode template
« on: July 13, 2012, 02:54:25 am »
I downloaded SFML 2.0 using the wizard, and got everything up an running smoothly. However, the templates given aren't empty, they have some sample files and sample code. I know I could just delete the files and the sample code, but it gets annoying to do that every time I want to create an SFML project. Does anyone know how to edit the xctemplate files that control the given templates, or has anyone already made a blank project template themselves?

Graphics / Animating a sprite independently from the main loop
« on: July 09, 2012, 08:23:53 pm »
So i have a sprite that needs to flash when it gets hit, and for convenience purposes, let's say (theoretically) I have a flash method in the spaceship object class like so

class Spaceship: public Object {
   void flash()
      if (t < 1.5) {
         float opacityRatio = cos(3t);

The problem is that how do I get the "t" value? The game loop is repeated multiple times and relies on a clock, so if I use the clock value (which gets reset ever iteration) for "t" , the whole flash animation will mess up. So how do I get the "t" value? Should I use static variables (however I have a feeling that implementation isn't very graceful), or should I animate it in a separate thread (although I'm not sure it's possible)? Games use effects like this all the time, so I'm sure there's an easy way... Any suggestions/solutions would be extremely helpful.

Graphics / Best way to display sprites
« on: June 18, 2012, 03:38:52 am »
I have a window on which I'm going to display a ton of sprites for a game. I'm using SFML 2.0 which adds a view to windows automatically, which is good I hear because it converts measurements and locations for the window so it behaves the same, regardless of size. Problem is, when I resize the window, it stretches/shrinks all the sprites. Is there a way to resize the window but NOT the view? And what is the best way to set up views/windows to adjust to ALL resolutions? Because I want the game to look more or less the same on ALL screen sizes... thanks.

Window / Get the x/y coordinates of a window
« on: June 08, 2012, 08:11:30 pm »
I have a window that I'm using for a game, and I'm going to use the windows function ClipCursor()to confine the mouse to the window like make game do. However, I need to know how to get the coordinates of the window. I've looked through the documentation, but I can't seem to find it. Is there any way to do this? I plan on moving to mac later on, so cross-platform solutions would be best.

Graphics / Rotating a sprite
« on: June 01, 2012, 02:19:57 am »
I have this sprite I want to rotate, but when I call SetRotation() on it, it behaves weird, like the hinge is on the top left corner. I'm aware that I can use SetCenter() to place the hinge in the center of the sprite, but I like positioning elements using the top left corner. I wrote a wrapper class for sf::Sprite and wrote the setRotation() method like this:

void CSprite::setRotation(float degrees)
   float oldXCenter = drawable.GetCenter().x;
   float oldYCenter = drawable.GetCenter().y;
   drawable.SetPosition(oldXCenter, oldYCenter);

But it still doesn't do what I want... Does anyone have a solution?

Graphics / Large text appears blurry
« on: May 22, 2012, 07:21:19 pm »
I use the sf::String class to show text on the screen, and it looks okay at small sizes, but if I make the text 96pt, the it appears really blurry. I did SetSmooth(false) on the sf::Font object, but the it appears blurry and pixel-y! Is there any way  to have large, clean-looking text in SFML 1.6?

Graphics / Help with rotating a sprite
« on: May 10, 2012, 11:20:47 pm »
I have a character sprite that I need to rotate to face up, left, right, and down. The way I'm currently rotating it is like this:

(SpriteX is a wrapper class I made around an sf::Sprite, and these are some rotation methods)

void SpriteX::rotate(float degrees)
   sprite.SetCenter(get_width()/2, get_height()/2);
   sprite.SetCenter(0, 0);

void SpriteX::set_rotation(float degrees)
   sprite.SetCenter(get_width()/2, get_height()/2);
   sprite.SetCenter(0, 0);

The sprite still rotates around its top left corner, how do I make it rotate around it's center just for the scope of the rotation method? I still want to position the sprite based on its top left corner.

Will I just have to make 4 separate image files?

Any help is appreciated!

Pages: [1]