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 - jaredcaruso

Pages: [1]
1
Audio / Re: How to link audio if you build yourself?
« on: May 20, 2016, 10:21:05 pm »
I figured it out. I just didn't have the sfml-audio-d included

2
Audio / How to link audio if you build yourself?
« on: May 20, 2016, 08:50:10 pm »
I built SFML with cmake and it works fine. However, I can't find OpenAL32.dll anywhere. Did I do something wrong?

3
General / Re: App not running in Xcode
« on: April 24, 2016, 09:50:47 pm »
The template runs fine until I add this:
       
        if (sf::Keyboard::isKeyPressed(sf::Keyboard::Key::Down))
        {
            playerSquare.move(0, 2);
        }
        if (sf::Keyboard::isKeyPressed(sf::Keyboard::Key::Up))
        {
            playerSquare.move(0, -2);
        }
        if (sf::Keyboard::isKeyPressed(sf::Keyboard::Key::Left))
        {
            playerSquare.move(-2, 0);
        }
        if (sf::Keyboard::isKeyPressed(sf::Keyboard::Key::Right))
        {
            playerSquare.move(2, 0);
        }
 

However, it runs just fine when I use Visual Studio/Visual C++. Is that just because of the compiler or something? And how would I fix the event handling?

4
General / Re: App not running in Xcode
« on: April 24, 2016, 09:22:42 pm »
I tried removing the window.clear in all the if statements but it still doesn't work :(

5
General / App not running in Xcode
« on: April 24, 2016, 09:06:09 pm »
Whenever I try to build my project in Xcode, the app appears on the dock but it just bounces forever. I don't have any errors or anything. Also, the template worked and I could run that just fine.

Here is my code if it matters:
//
// Disclamer:
// ----------
//
// This code will work only if you selected window, graphics and audio.
//
// Note that the "Run Script" build phase will copy the required frameworks
// or dylibs to your application bundle so you can execute it on any OS X
// computer.
//
// Your resource files (images, sounds, fonts, ...) are also copied to your
// application bundle. To get the path to these resource, use the helper
// method resourcePath() from ResourcePath.hpp
//

#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>

// Here is a small helper for you ! Have a look.
#include "ResourcePath.hpp"

void initShape(sf::RectangleShape& shape, sf::Vector2f const& pos, sf::Color const& color)
{
    shape.setFillColor(color);
    shape.setPosition(pos);
    shape.setOrigin(shape.getSize() * 0.5f);
}

int main()
{
   
    sf::RenderWindow window(sf::VideoMode(480, 380), "Bad Squares");
    window.setFramerateLimit(60); //set the frame limit to 60 FPS
   
    sf::Image icon;
    if (!icon.loadFromFile(resourcePath() + "icon.png")) {
        return EXIT_FAILURE;
    }
    window.setIcon(icon.getSize().x, icon.getSize().y, icon.getPixelsPtr());
   
    sf::Vector2f startPosition = sf::Vector2f(50, 50);
    sf::RectangleShape playerSquare(sf::Vector2f(25, 25));
    initShape(playerSquare, startPosition, sf::Color::Yellow);
    sf::RectangleShape targetSquare(sf::Vector2f(50, 50));
    initShape(targetSquare, sf::Vector2f(400, 50), sf::Color::Green);
    sf::RectangleShape badSquareOne(sf::Vector2f(50, 100));
    initShape(badSquareOne, sf::Vector2f(250, 50), sf::Color::Red);
    sf::RectangleShape badSquareTwo(sf::Vector2f(50, 200));
    initShape(badSquareTwo, sf::Vector2f(250, 250), sf::Color::Red);
    sf::RectangleShape changeToRedZoneOne(sf::Vector2f(425, 75));
    initShape(changeToRedZoneOne, sf::Vector2f(400, 50), sf::Color::Yellow);
    window.clear(sf::Color::Black);
   
    while (window.isOpen())
    {
        window.draw(targetSquare);
        window.draw(badSquareOne);
        window.draw(badSquareTwo);
        window.draw(playerSquare);
       
        if (sf::Keyboard::isKeyPressed(sf::Keyboard::Key::Down))
        {
            window.clear(sf::Color::Black);
            playerSquare.move(0, 2);
        }
        if (sf::Keyboard::isKeyPressed(sf::Keyboard::Key::Up))
        {
            window.clear(sf::Color::Black);
            playerSquare.move(0, -2);
        }
        if (sf::Keyboard::isKeyPressed(sf::Keyboard::Key::Left))
        {
            window.clear(sf::Color::Black);
            playerSquare.move(-2, 0);
        }
        if (sf::Keyboard::isKeyPressed(sf::Keyboard::Key::Right))
        {
            window.clear(sf::Color::Black);
            playerSquare.move(2, 0);
        }
       
        if (playerSquare.getGlobalBounds().intersects(targetSquare.getGlobalBounds()))
        {
            window.clear(sf::Color::Red);
        }
        if (playerSquare.getGlobalBounds().intersects(badSquareOne.getGlobalBounds()))
        {
            window.clear(sf::Color::Red);
        }
        if (playerSquare.getGlobalBounds().intersects(changeToRedZoneOne.getGlobalBounds()))
        {
            targetSquare.setFillColor(sf::Color::Red);
        }
       
        badSquareTwo.rotate(2);
        window.clear(sf::Color::Black);
        window.display();
    }
   
    return EXIT_SUCCESS;
}
 

6
Audio / Re: undefined reference to `sf::Music::openFromFile
« on: March 17, 2016, 10:51:06 pm »
I downloaded and did the same stuff for the 32 bit one but it still doesn't work and I get the same errors :(

7
Audio / Re: undefined reference to `sf::Music::openFromFile
« on: March 17, 2016, 06:54:02 pm »
I installed Code::Blocks and did everything it says to do. My 5 libraries I linked are
sfml-graphics-d
sfml-window-d
sfml-audio-d
sfml-network-d
sfml-system-d

It still doesn't work with when I use the same code as before. It's currently set in debug and I copied all the DLL files from the sfml/bin folder to the debug folder in the code blocks project that has the executable. Also, I didn't set put SFML_STATIC this time so it can be dynamic or whatever

This is my error: http://pastebin.com/rAJ6aJSL

8
Audio / Re: undefined reference to `sf::Music::openFromFile
« on: March 17, 2016, 03:40:14 pm »
I linked only
sfml-graphics-s
sfml-window-s
sfml-audio-s
sfml-network-s
sfml-system-s

And now I have this error: http://pastebin.com/gMTq9WUw

And would it be better to do this dynamically? How would I do that instead?

9
Audio / Re: undefined reference to `sf::Music::openFromFile
« on: March 17, 2016, 02:54:01 pm »
Don't link dynamic AND static libraries.

Which ones are static and which ones are dynamic? And do I only link the static ones?

10
Audio / Re: undefined reference to `sf::Music::openFromFile
« on: March 17, 2016, 02:38:11 pm »
My linked libraries are now:
sfml-graphics
sfml-window
sfml-audio
sfml-network
sfml-system
sfml-graphics-s
sfml-window-s
sfml-audio-s
sfml-network-s
sfml-system-s
opengl32
freetype
jpeg
winmm
gdi32
openal32
ws2_32
vorbis
vorbisenc
vorbisfile
flac
ogg


It still doesn't work and I get the same error. What else do I have to do?

11
Audio / Re: undefined reference to `sf::Music::openFromFile
« on: March 17, 2016, 01:55:02 pm »
How do I do that? I'm fairly new to coding and I the only tutorials I could find in the docs were for Visual Studio and Code::Blocks

12
Audio / undefined reference to `sf::Music::openFromFile
« on: March 17, 2016, 01:43:45 pm »
I'm using CodeLite. I am using "SFML 2.3.2 GCC 4.8.1 TDM (SJLJ) - 64-bit" from the download page. My library search path is "C:/SFML-2.3.1/lib", and SFML-2.3.1 is on my C drive. My compiler is MiniGW(TDM GCC 32). The include path is "C:/SFML-2.3.1/include". Precursors are SFML_STATIC. Basically, I set it up like the tutorial at:
http://en.sfml-dev.org/forums/index.php?topic=18820.0

The libraries in the linker setting looks like this:
sfml-graphics
sfml-window
sfml-audio
sfml-network
sfml-system


My code looks like this:
#include <iostream>
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
using namespace std;

int sftest()
{
    sf::Music music;
    if (!music.openFromFile("research.ogg"))
        {
            //okkkkk
        }
    music.setPosition(0, 1, 10); // change its 3D position
    music.setPitch(2);           // increase the pitch
    music.setVolume(50);         // reduce the volume
    music.setLoop(true);         // make it loop
   
    music.play();
    return 0;
}  

sflab()
{
    system("cls");
    cout << "Welcome to the SFML Lab." << endl;
    sftest();
    return 0;
}
My log is here: http://pastebin.com/DENYQqu1
'research.ogg' is in the Debug folder of the Codelite project.

Pages: [1]
anything