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

Pages: [1]
1
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?

2
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;
}
 

3
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