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

Author Topic: 32 bit to 64 bit  (Read 13201 times)

0 Members and 1 Guest are viewing this topic.

Saadin Dassum

  • Newbie
  • *
  • Posts: 20
    • View Profile
32 bit to 64 bit
« on: October 24, 2014, 05:58:51 am »
I recently made a program with SFML.  It involved a "music player" type interaction with the user.  The main difference was that the user could change the music through a joypad.  A while after completing the first version of my program, I switched from a really incapable intel core i3 32 bit HP to an i7 64 bit Alienware.  Unfortunately, I can't use my new computer's great potential to continue making my program better.  The program seems to run perfectly.  The problem is that when I try to change the music, nothing will happen.  It's as if the program was completely ignoring the controller input.  The input I'm using is exactly the same as in my last computer.  Does my problem have to do with the software and specs?  Do you guys know what my problem might be?  Is it because my new computer is 64 bits? Forgive my ignorance.  I'm a little bit new to all of this.  I can give you guys more information if you need it to help me.  Thank you.

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: 32 bit to 64 bit
« Reply #1 on: October 24, 2014, 08:05:29 am »
Could you provide a complete and minimal code example that demonstrates the problem?  If there really is a problem in SFML's input handling then a simple game loop that prints joystick events to std::cout should suffice.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: 32 bit to 64 bit
« Reply #2 on: October 24, 2014, 10:31:12 am »
In addition to Ixrec's note, you should read this post.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Saadin Dassum

  • Newbie
  • *
  • Posts: 20
    • View Profile
Sorry, here's the material
« Reply #3 on: October 26, 2014, 01:19:13 am »
Okay... Sorry about not posting everything that was needed.  I just thought it might have been a problem that was more typical and appeared more commonly when working with both 32-bit and 64-bit operations.
  Anyway, for you guys to understand what my code is supposed to do, there are different playlists.  You can switch to different playlists, and within those playlists, you can pause, play and go to the next or previous song.  You can also raise and lower the volume.  If a song is switched within a playlist, the program loads another file onto the sf::Music object that already exists and simply begins to play the sf::Music object again.  If a playlist is switched, the current sf::Music object's volume is set to 0, and the next playlist's sf::Music object's volume is raised to the user volume.
  All of this worked perfectly on my 32-bit HP.  I don't get why it's not working on my new computer.  None of the controls are working, and the code is the exact same on both systems.  The only other detail that might be important is that for a joypad, I'm using a Dualshock 3 (Playstation controller) with the DS3 tool, which is software to make it act like a joypad.
if (sf::Joystick::isButtonPressed(0, 12)) {  //Up button
        if (userVolume < 100)
            userVolume++;
        else
            userVolume = 100;

        switch (playlist) {
//set current playlist to new user volume
}
//A similar code for the Down button is placed here

    if (sf::Joystick::isButtonPressed(0, 13)) { //Right button
        switch (playlist) {
//set the current playlist's volume to 0 and the new one to userVolume
}
//A similar code for the Left button is placed here

if (playlist == genre1)    {  //While the radio station is set to genre1
        if (sf::Joystick::isButtonPressed(0, 1)) { //X button
                if (genre1Playlist.getStatus() == sf::Music::Playing) {
            genre1playlist.pause(); //Pause
                }
                else{
                genre1playlist.play(); //Play or resume
                }
        }
        if (sf::Joystick::isButtonPressed(0, 7)) { //R1 button
           if (genre1Number < grenre1Max) {
            genre1TrackNumber++;
           }
       //Reload song and play  (Next)
       }
//A similar code for the L1 button is placed here.
}
 

  That's it.  The code seems fine.  I have no idea why this isn't working.

Gambit

  • Sr. Member
  • ****
  • Posts: 283
    • View Profile
Re: 32 bit to 64 bit
« Reply #4 on: October 26, 2014, 05:35:28 am »
The architecture "bit-ness" should not have any impact on the performance (Or lack there-of) of your program. The team behind SFML does their best to make sure that it works on as many platforms as possible with as much support as possible. The problem could simply reside with a compatibility issue between the gamepad you are using and your specs. This could be a hardware incompatibility or you are simply missing drivers. Check if the OS is recognizing your gamepad and if you can use it in games or anything else.

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: 32 bit to 64 bit
« Reply #5 on: October 26, 2014, 05:58:06 am »
I can't help noticing that this sounds a lot like my Jukebox class.
Nothing to do with your problem, I just thought you might want to take a look :-)

Saadin Dassum

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: 32 bit to 64 bit
« Reply #6 on: October 26, 2014, 06:51:11 pm »
Gambit, my OS is recognizing the gamepad exactly as it was before.  The way I tested it was with GTA: San Andreas.  I've tested it and it still works with San Andreas.  The only thing that it's not working is my program.  The only difference I can spot between both of my comoputers is that the HP is bluetooth compatible with the Dualshock 3, but the Alienware isn't.

Saadin Dassum

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: 32 bit to 64 bit
« Reply #7 on: November 19, 2014, 02:36:42 am »
Hi again everyone.  I might have found another clue to why my program isn't working.  What I found out another clue (yeah, I'll call it that) as to what is going on in my new system.  I tried to change the window size and realized that this was not working either.  The program that was running in my new computer was probably just compiled in my old computer and being executed in my new one.  The program is not actually compiling.  When trying to build the program from scratch, the build log gives me this:
mingw32-g++.exe: error: unrecognized command line option '-static-libstdc++'
mingw32-g++.exe: error: unrecognized command line option '-static-libstdc++'

By the way, in Code::Blocks's, my Build Options Linker Settings has this:
"
-static-libgcc
-static-libstdc++
-std=c++11
"
in other linker settings.  These lines are the ones I used to be able to compile SFML from the beginning.  Do they have something to do with my problem?

Gambit

  • Sr. Member
  • ****
  • Posts: 283
    • View Profile
Re: 32 bit to 64 bit
« Reply #8 on: November 19, 2014, 05:10:38 am »
You should consider updating the compiler and IDE, then adjust your code to the updates. When you run into problems like these, the first thing you should do is consider what version of the softwares you are using and update if you need to.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11007
    • View Profile
    • development blog
    • Email
AW: 32 bit to 64 bit
« Reply #9 on: November 19, 2014, 07:57:24 am »
If you have issues with your game pad, you should write a simple example to see if you get any connected devices and any input. Just because it works with a random game, doesn't mean it will automatically work for SFML.

Next you should make sure to use the latest SFML version from GitHub to rule out, that it is an already fixed issue.

The error you're getting about -static-xyz is becausr your using the awful TDM compiler, which links the runtine libs statically by default.
If that error occurs when building SFML, then you're using an old version.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Saadin Dassum

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: 32 bit to 64 bit
« Reply #10 on: November 21, 2014, 09:41:18 pm »
The error you're getting about -static-xyz is becausr your using the awful TDM compiler, which links the runtine libs statically by default.

What compiler would you recommend for me?  I've used codeblocks for everything I have learned in C++.  Should I use Visual C++?

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: 32 bit to 64 bit
« Reply #11 on: November 21, 2014, 09:56:28 pm »
There are many compilers to chose from. The intel compiler, gcc, clang, visual studio's compiler and more.
You should pick a compiler based on whether it supports the features you need on the platforms you want to support, not based on what IDE it happens to integrate well with (although that may of course be a parameter).
My point is; your IDE is /not/ the same as your compiler and there are many options for the latter.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: 32 bit to 64 bit
« Reply #12 on: November 21, 2014, 10:41:56 pm »
eXpl0it3r probably didn't mean to get rid of gcc, but only to choose another distribution of it. You can download mingw-w64 or nuwen gcc, and then just change one path in Code::Blocks and continue everything as you did before.
Laurent Gomila - SFML developer

wintertime

  • Sr. Member
  • ****
  • Posts: 255
    • View Profile
Re: 32 bit to 64 bit
« Reply #13 on: November 22, 2014, 06:41:43 pm »
Or even simpler: just remove those options that the compiler/linker does not know, as TDM already links statically without them.

Saadin Dassum

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: 32 bit to 64 bit
« Reply #14 on: November 22, 2014, 09:33:59 pm »
Or even simpler: just remove those options that the compiler/linker does not know, as TDM already links statically without them.

I just tried that.  Codeblocks gave me something that looks like this:
||=== Build: Debug in MPlayer (compiler: GNU GCC Compiler) ===|
C:\SFML-2.1\lib\libsfml-audio-s.a(Music.cpp.obj):Music.cpp|| undefined reference to `_Unwind_Resume'|
(.text$_ZN2sf4TextD0Ev[__ZN2sf4TextD0Ev]+0xa6)||undefined reference to `_Unwind_Resume'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build failed: 50 error(s), 0 warning(s) (0 minute(s), 2 second(s)) ===|

I deleted all the build log errors that were repeated or similair.  All of them were undefined references.
I also tried downloading mingw-w64.  The program still won't compile.  I'll run some experiments on my program and then come back after I have deduced more.  Thank you all for trying to help.
« Last Edit: November 22, 2014, 09:35:49 pm by Saadin Dassum »