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.


Messages - Blink

Pages: [1]
1
General / Conflict with X11
« on: April 06, 2014, 04:41:00 am »
So I had an issue with X11 and the Networking module where Status was defined as an int in X11 but used as an enum in SFML. My fix was that I separated the file using Glee from the file using SFML's networking, so they don't reference the two libraries at the same time, and this worked, but if I ever did need to use both in one file then that might be a problem. Here's the error log:

Quote
clang++  -c src/lodepng.cpp -o bin/lodepng.o
clang++   -c src/flatRender.cpp -o bin/flatRender.o
In file included from src/flatRender.cpp:20:
In file included from src/networking.h:15:
In file included from /usr/local/include/SFML/Network.hpp:33:
In file included from /usr/local/include/SFML/Network/Ftp.hpp:32:
In file included from /usr/local/include/SFML/Network/TcpSocket.hpp:32:
/usr/local/include/SFML/Network/Socket.hpp:53:10: error: unnamed enumeration must be a
      definition
    enum Status
         ^
/usr/include/X11/Xlib.h:87:16: note: expanded from:
#define Status int
               ^
In file included from src/flatRender.cpp:20:
In file included from src/networking.h:15:
In file included from /usr/local/include/SFML/Network.hpp:33:
/usr/local/include/SFML/Network/Ftp.hpp:74:14: error: unnamed enumeration must be a
      definition
        enum Status
             ^
/usr/include/X11/Xlib.h:87:16: note: expanded from:
#define Status int
               ^
In file included from src/flatRender.cpp:20:
In file included from src/networking.h:15:
In file included from /usr/local/include/SFML/Network.hpp:33:
/usr/local/include/SFML/Network/Ftp.hpp:146:41: error: use of undeclared identifier
      'InvalidResponse'
        explicit Response(Status code = InvalidResponse, const std::string& ...
                                        ^
In file included from src/flatRender.cpp:20:
In file included from src/networking.h:15:
In file included from /usr/local/include/SFML/Network.hpp:34:
In file included from /usr/local/include/SFML/Network/Http.hpp:32:
/usr/local/include/SFML/Network/IpAddress.hpp:184:28: error: expected member name or ';'
      after declaration specifiers
    static const IpAddress None;      ///< Value representing an empty/invalid address
    ~~~~~~~~~~~~~~~~~~~~~~ ^
/usr/include/X11/X.h:115:30: note: expanded from:
#define None                 0L /* universal null resource or null atom */
                             ^
In file included from src/flatRender.cpp:20:
In file included from src/networking.h:15:
In file included from /usr/local/include/SFML/Network.hpp:34:
/usr/local/include/SFML/Network/Http.hpp:199:14: error: unnamed enumeration must be a
      definition
        enum Status
             ^
/usr/include/X11/Xlib.h:87:16: note: expanded from:
#define Status int
               ^

but all I had to do was remove networking.h from flatRender, where flatRender has an include "GLee.h", and then it worked. This had me stuck for a while until I was really seeing exactly where the error came from, then I realized that my code was modular enough (go self! :P) that I didn't need to reference my networking.h file in flatRender, and removing it plus the one sprintf that used it seemed to solve everything. None of the other SFML libraries (window/graphics/system) referenced in flatRender caused issue.

Hope this helps!

2
Window / Re: sf::Joystick::update() destroying my framerate?
« on: October 11, 2012, 10:45:38 am »
Oh darn! You beat me to it by two minutes! Apparently my refresh + edit were just slightly too late.

Thanks again though! All good now :)

3
Window / Re: sf::Joystick::update() destroying my framerate?
« on: October 11, 2012, 10:11:22 am »
Thank you sir, I am quite indebted to your work on the forum tonight :)

Currently I'm going through the tutorial for compiling 2.0 on my own and I'm guessing that's the path I need to take, using the latest snapshot as the Downloads page calls it. Is this correct, or is there some simpler way than this?

(and again, I shall race to finish building this before you can answer, but it's all new to me right now)

EDIT: I win! Followed the above instructions using CMake and built my own latest libraries and dlls, then copied them over in place of my current ones. No lag now, runs smoothly, and very happy. :) Thanks again!

4
Window / sf::Joystick::update() destroying my framerate?
« on: October 11, 2012, 08:32:56 am »
Hey guys,

First, thanks for having this forum! I am quite appreciative that you are all contributing to the community.

Second: I'm brand new! Never used SFML before, was wary due to setup complications at first, but enjoying it now that it's working. I got it for an OpenGL project that I'm already ten months into, where I needed joystick and audio support. I even have joysticks working now! But... the framerate is absolutely obliterated by making a call to Joystick::update().

If I comment out that one line, everything runs fine again, but my speed gets cut in half if I use it every frame. I can call it once every five frames, and that helps, or once every ten (and the problem is gone, but the controls are terrible - it's a platformer, so it needs to feel tight), but I'd really like to be able to call it at least every other frame and still have it running at the same framerate it was before. My code is as follows, where sendCommands is called once per frame:

Code: [Select]
// Once per loop, send off the commands from these inputs
void sendCommands() {

  // joystick support, ALWAYS update its input
  sf::Joystick::update();
 
  // Update each joystick's info before sending commands
  for (int i=0; i < 4; i++) {
    joystickCommands(i);
    mergeInput(i); // then stick it and key inputs together
  }

  // Then get to those commands being issued!
  if (getGameplayRunning()) {
    ... // the meat of sending off those commands here, no issues previously with this code
  }

Here is where I create the joystick commands from SFML's reports, and temporarily/sloppily reassign joystick positions to key presses:

Code: [Select]
// Figure out all joystick input translations to key presses, for now
void joystickCommands(int i) {
  int joystick = joystickNum(i);
 
  // Accept any not-start-or-select button for jumping
  jumpButton[i] = 0;
  for (int b=0; b<8; b++) {
    if (b != 6 && b != 7) {
      jumpButton[i] = jumpButton[i] || sf::Joystick::isButtonPressed(joystick,b);
    } else if (b == 6) { // Join
      playerJoin(i,sf::Joystick::isButtonPressed(joystick,b));
    } else if (b == 7) { // Pause
      playerPause(i,sf::Joystick::isButtonPressed(joystick,b));
    }
  }

  // Convert (for now) joystick to direction buttons
  upButton[i]   = sf::Joystick::getAxisPosition(joystick,sf::Joystick::Y) <-50;
  downButton[i] = sf::Joystick::getAxisPosition(joystick,sf::Joystick::Y) > 50;
  leftButton[i] = sf::Joystick::getAxisPosition(joystick,sf::Joystick::X) <-50;
  rightButton[i]= sf::Joystick::getAxisPosition(joystick,sf::Joystick::X) > 50;

}

And mergeInput, which just combines the keys and button presses:

Code: [Select]
// Combine buttons and keys under one input system
void mergeInput(int i) {
  // Only covering stuff really used here
  // join and pause handled seperately
  upInput[i] = upButton[i] || upKey[i];
  downInput[i] = downButton[i] || downKey[i];
  leftInput[i] = leftButton[i] || leftKey[i];
  rightInput[i] = rightButton[i] || rightKey[i];
  jumpInput[i] = jumpButton[i] || jumpKey[i];
}

And then there's this extra bit, which shouldn't influence things, but converts the joystick num that the 360 controllers are giving vs. order that they really should be in.

Code: [Select]
// Given a player num, returns joystick num
int joystickNum(int i) {
  // Please note... I don't understand the order either,
  // but until I make player order based on joining order,
  // this works.
  switch(i) {
    case 0: // Player 1
      return 1;
    case 1: // Player 2
      return 2;
    case 2: // Player 3
      return 0;
    case 3: // Player 4
      return 3;
    default:
      return 1;
  }
}

So, does anyone know what could be causing this? Thanks guys!

EDIT: Also, using SFML 2.0 from the download page for Windows, C++ Visual Studio 2010 (32-bit since that's the only one available). Did a Google search with laggy as the keyword now and getting some relevant results, so reading through those now. Hoping I can find another answer and apologize for making the thread!

Pages: [1]