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

Pages: [1]
1
General / sfeMovie installation and general building questions
« on: December 07, 2011, 07:52:28 am »
Alright, so I've tried going through everything again with no luck. Just want to go through my steps in case there are any obvious errors.

1. Open build.sh and cmakelists to change 10.5 to 10.6. Also change arch to x86_64, and add the two lines in previous reply.

2. Run build.sh. Selecting 1 or 4 for ffmpeg successfully completes, but there are a ton of warnings. First set encountered:

Code: [Select]
WARNING: pkg-config not found, library detection may fail.
HTML doc/developer.html
HTML doc/faq.html
HTML doc/general.html
HTML doc/libavfilter.html
CC libavdevice/alldevices.o
CC libavdevice/avdevice.o
AR libavdevice/libavdevice.a
CC libavfilter/af_anull.o
CC libavfilter/allfilters.o
CC libavfilter/asink_anullsink.o
CC libavfilter/asrc_anullsrc.o
CC libavfilter/avcodec.o
CC libavfilter/avfilter.o
CC libavfilter/avfiltergraph.o
CC libavfilter/defaults.o
libavfilter/defaults.c: In function ‘set_common_formats’:
libavfilter/defaults.c:207: warning: pointer of type ‘void *’ used in arithmetic
libavfilter/defaults.c:212: warning: pointer of type ‘void *’ used in arithmetic
CC libavfilter/drawutils.o


My question here would be whether or not you get warnings, or if it is a completely clean build?

3. Check that /product folder exists, and that the header and .dylib file are there.

4. Make clean and install to move the files to /usr/local

5. Add that .dylib file to linked libraries and Build phase -> copy files in Xcode.

6. Test movie throws errors mentioned above. The warnings are interesting though:

Code: [Select]
warning: Could not open OSO file /Users/veeneck/GameDev/sfeMovieGit/deps/ffmpeg-build/libswscale.a(rgb2rgb.o) to scan for pubtypes for objfile /usr/local/lib/libsfe-movie.dylib

It looks like it is trying to references files in the deps folder within the main folder I downloaded the source to, and not in /usr/local or the actual project directory. Could this be a permission issue, or is it supposed to look at the directory it was built in? Or, am I missing a step in adding dependencies?

2
General / collsion detection
« on: December 02, 2011, 07:28:47 pm »
For that, this is a good starting point:

https://github.com/SFML/SFML/wiki/SourceSimpleCollisionDetection

If you're just dealing with squares or other simple collisions, something like that seems like the way to go. If you plan to get more complex, I believe box2d or chipmunk have collision detection, which would be a good way to go if you're going to have physics.

3
General / collsion detection
« on: December 01, 2011, 08:48:25 pm »
I'm a beginner, so this could be completely wrong, but here is how I would handle it. Let's assume you have a ball hitting a brick. When they collide, you want the side of the ball to flatten (by replacing the sprite) and the brick to have vibration lines coming out of the side that was hit.

Code: [Select]
BallObj
    float x
    float y
    enum direction {North, East, South, West}
    showCollision()

BrickObj
    float x;
    float y;
    showCollision(impactDirection)

CollisionService
    isColliding(obj1, obj2)


Given that rough structure, code would be:

Code: [Select]
if(isColliding(BallObj, BrickObj)) {
    BallObj.showCollision()
    BrickObj.showCollision(BallObj.direction)
}

BallObj::showCollision() {
    image = ball_north.png //if traveling north
}

BrickObj.showCollision(impactDirection) {
    image = brick_south.png //opposite of direction passed in
}


Then, each frame, maintain the direction the ball is traveling in the BallObj class by looking at the last coords before overriding with the new coords.

That example would work for 4 way directions. If you need 360 degrees, it becomes a bit more complex, but a similar approach should work. Also, if both objects are moving, they could both take the object they hit as a parameter, and check for a getDirection function off of the object. Curious to hear from the experts if this is how it would work out.

4
General / sfeMovie installation and general building questions
« on: December 01, 2011, 07:26:31 am »
No worries. I'll try out more sample movies, and do some digging to try to narrow the problem down.

5
General / sfeMovie installation and general building questions
« on: December 01, 2011, 04:52:42 am »
Argh, so close. I was able to successfully link to the library. It builds and runs and the functions are all available. All that is left is ffmpeg errors. When I ran build.sh, I selected option 4 for all file formats. If I try to play any sample .avi I download, I get the following error:

Code: [Select]
[avi @ 0x102882600] max_analyze_duration 5000000 reached at 5000000
Movie_video::Initialize() - could not find any video decoder for this video format


If I try to play a .mov I created.

Code: [Select]
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x1030b5200] Could not find codec parameters (Video: H.264, 1024x768, 2049 kb/s)
FFmpeg error: Operation not permitted


And if I use .mp4 (I believe this file isn't actually a .mp4, so error may just be indicating that).

Code: [Select]
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x101870200] max_analyze_duration 5000000 reached at 5000000
Movie_video::Initialize() - could not find any video decoder for this video format
Movie_audio::Initialize() - could not find any audio decoder for this audio format


I rebuilding everything and using a blank project, and I am receiving the same errors. There was no sample movie containing in the project download, so if anyone has a movie that definitely works, please link to it.

6
General / sfeMovie installation and general building questions
« on: December 01, 2011, 03:34:20 am »
Awesome, that helped. I also had to change line 60 (62 after the change) from:

Code: [Select]
set (CMAKE_OSX_ARCHITECTURES "i386")

to

Code: [Select]
set (CMAKE_OSX_ARCHITECTURES "x86_64")

I'll start using it in a project now, and let you know how it goes. Thanks again.

7
General / sfeMovie installation and general building questions
« on: November 30, 2011, 04:40:25 pm »
Ah, great. Starting to grasp CMake better. Changing that allowed the build to get to 100%, but it still threw an error when linking.

Code: [Select]
==================== sfeMovie compilation ====================

Running CMake...
cmake -G "Unix Makefiles" CMakeLists.txt
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/veeneck/GameDev/sfeMovieGit
Running make...
[ 16%] Building CXX object CMakeFiles/sfe-movie.dir/src/Movie.cpp.o
In file included from /Users/veeneck/GameDev/sfeMovieGit/deps/headers/libavformat/avformat.h:42,
                 from /Users/veeneck/GameDev/sfeMovieGit/src/Movie.cpp:27:
/Users/veeneck/GameDev/sfeMovieGit/deps/headers/libavcodec/avcodec.h:525: warning: attribute ignored in declaration of ‘enum AVLPCType’
/Users/veeneck/GameDev/sfeMovieGit/deps/headers/libavcodec/avcodec.h:525: warning: attribute for ‘enum AVLPCType’ must follow the ‘enum’ keyword
/Users/veeneck/GameDev/sfeMovieGit/src/Movie.cpp: In member function ‘bool sfe::Movie::OpenFromFile(const std::string&)’:
/Users/veeneck/GameDev/sfeMovieGit/src/Movie.cpp:86: warning: ‘av_open_input_file’ is deprecated (declared at /Users/veeneck/GameDev/sfeMovieGit/deps/headers/libavformat/avformat.h:1093)
/Users/veeneck/GameDev/sfeMovieGit/src/Movie.cpp:86: warning: ‘av_open_input_file’ is deprecated (declared at /Users/veeneck/GameDev/sfeMovieGit/deps/headers/libavformat/avformat.h:1093)
/Users/veeneck/GameDev/sfeMovieGit/src/Movie.cpp:106: warning: ‘dump_format’ is deprecated (declared at /Users/veeneck/GameDev/sfeMovieGit/deps/headers/libavformat/avformat.h:1535)
/Users/veeneck/GameDev/sfeMovieGit/src/Movie.cpp:106: warning: ‘dump_format’ is deprecated (declared at /Users/veeneck/GameDev/sfeMovieGit/deps/headers/libavformat/avformat.h:1535)
[ 33%] Building CXX object CMakeFiles/sfe-movie.dir/src/Movie_audio.cpp.o
In file included from /Users/veeneck/GameDev/sfeMovieGit/deps/headers/libavformat/avformat.h:42,
                 from /Users/veeneck/GameDev/sfeMovieGit/src/Movie_audio.h:31,
                 from /Users/veeneck/GameDev/sfeMovieGit/src/Movie_audio.cpp:25:
/Users/veeneck/GameDev/sfeMovieGit/deps/headers/libavcodec/avcodec.h:525: warning: attribute ignored in declaration of ‘enum AVLPCType’
/Users/veeneck/GameDev/sfeMovieGit/deps/headers/libavcodec/avcodec.h:525: warning: attribute for ‘enum AVLPCType’ must follow the ‘enum’ keyword
[ 50%] Building CXX object CMakeFiles/sfe-movie.dir/src/Movie_video.cpp.o
In file included from /Users/veeneck/GameDev/sfeMovieGit/deps/headers/libavformat/avformat.h:42,
                 from /Users/veeneck/GameDev/sfeMovieGit/src/Movie_video.h:29,
                 from /Users/veeneck/GameDev/sfeMovieGit/src/Movie_video.cpp:26:
/Users/veeneck/GameDev/sfeMovieGit/deps/headers/libavcodec/avcodec.h:525: warning: attribute ignored in declaration of ‘enum AVLPCType’
/Users/veeneck/GameDev/sfeMovieGit/deps/headers/libavcodec/avcodec.h:525: warning: attribute for ‘enum AVLPCType’ must follow the ‘enum’ keyword
[ 66%] Building CXX object CMakeFiles/sfe-movie.dir/src/utils.cpp.o
[ 83%] Building CXX object CMakeFiles/sfe-movie.dir/src/Condition.cpp.o
[100%] Building CXX object CMakeFiles/sfe-movie.dir/src/Unix/ConditionImpl.cpp.o
Linking CXX shared library libsfe-movie.dylib
ld: library not found for -lsfml-system.2.0
collect2: ld returned 1 exit status
make[2]: *** [libsfe-movie.dylib] Error 1
make[1]: *** [CMakeFiles/sfe-movie.dir/all] Error 2
make: *** [all] Error 2
*** an error occured, aborting.

8
General / sfeMovie installation and general building questions
« on: November 30, 2011, 05:41:30 am »
Appreciate the detailed reply. I changed build.sh to use x86_64, and to use MacOSX10.6 instead of 10.5, and that allowed me to successfully build FFmpeg. So, progress was made. I'm still hitting a ton of errors though. Here is the full log:

http://pastebin.com/regwfbiB

I'm running Lion 10.7.1 on an i7 iMac.

9
General / sfeMovie installation and general building questions
« on: November 29, 2011, 05:19:46 am »
Being new to C++, I'm having trouble understanding how to compile, build and link to libraries. I was able to get SFML working more out of luck than actually understanding the core concepts. Now that I'm trying to install sfeMovie, I'm hitting a wall. I've been at this for a few hours, so I'll go over the steps I took, and would love any pointers in the right direction.

Step 1: dynamic linking

I grabbed the download here under binaries. Then, I added the libsfe-movie.dylib to Xcode under Target -> Summary -> Linked Frameworks and Libraries. I added the header file to the project as well. The project was built successfully, but threw a warning that the file format was not correct for the architecture being linked (x86_64). Changing my project to 32-bit got rid of the warning, but caused a fatal error when running.

Question 1: My assumption at this point is that my options are to compile SFML as 32-bit, or to compile sfeMovie as 64-bit. Is that correct, or are there other factors at play?

Step 2: Using build.sh

I took the approach of trying to compile sfeMovie on my own. I tried both the beta file and the current Git repo. In terminal, I placed:

Code: [Select]
sudo bash build.sh macosx -arch x86_64

For both attempts, a ton of errors were thrown. Sample of errors:

Code: [Select]
ormat/avformat.h:1374: error: expected declaration specifiers or ‘...’ before ‘int64_t’
./libavformat/avformat.h:1384: error: expected declaration specifiers or ‘...’ before ‘int64_t’
./libavformat/avformat.h:1393: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_gen_search’
./libavformat/avformat.h:1552: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘parse_date’
./libavformat/avformat.h:1558: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘av_gettime’
make: *** [libavdevice/alldevices.o] Error 1
*** an error occured, aborting.


Question 2: The only thing I could think of here is that I'm not using GCC. Is it used by default if I have it installed, or do I have to specify it? Or, is that a false lead, and is something else causing the errors?

Step 3: using CMake

I basically tried the same approach I used to install SFML. opened CMake, set the Git folder to the source path, tried both Debug and Release, and set the architecture to both Default and x86_64. Hit Configure again, and then generate. Went to the directory in terminal, ran a make clean and then a sudo make install. Sample errors are:

Code: [Select]
/Users/veeneck/GameDev/sfeMovieGit/src/Movie.cpp:402: error: ‘av_malloc’ cannot be used as a function
/Users/veeneck/GameDev/sfeMovieGit/src/Movie.cpp:421: error: ‘cerr’ is not a member of ‘std’
/Users/veeneck/GameDev/sfeMovieGit/src/Movie.cpp:421: error: ‘endl’ is not a member of ‘std’
/Users/veeneck/GameDev/sfeMovieGit/src/Movie.cpp: In member function ‘bool sfe::Movie::SaveFrame(AVPacket*)’:
/Users/veeneck/GameDev/sfeMovieGit/src/Movie.cpp:450: error: ‘cerr’ is not a member of ‘std’
make[2]: *** [CMakeFiles/sfe-movie.dir/src/Movie.cpp.o] Error 1
make[1]: *** [CMakeFiles/sfe-movie.dir/all] Error 2
make: *** [all] Error 2


Question 3: At this point, I'm just copy/pasting from the SFML install tutorial. Can someone explain the different concepts going on between step 2 and step 3?

And lastly, 2 more follow up questions.

Question 4: Any tips on other approaches I should try?

Question 5: Does anyone have a favorite article, tutorial or book on building, compiling, static linking, dynamic linking and frameworks?

Thanks a ton.

10
Window / Beginner question about RenderWindow::Display()
« on: November 27, 2011, 01:01:06 am »
That seems like the case. If anyone knows why it is, I would love to know the inner workings. The sample code is run on OS X Lion and built with Xcode btw.

11
Window / Beginner question about RenderWindow::Display()
« on: November 26, 2011, 09:45:01 pm »
I'm still getting the same behavior even if I use:

Code: [Select]
while(true) {

}


Edit - Actually just created a blank project using the SFML template, and removed the lines under the //Process events comment -- same behavior occurred. So, nothing in my app logic is getting in the way. I just don't understand the tie in between events and display.

12
Window / Beginner question about RenderWindow::Display()
« on: November 26, 2011, 08:26:30 pm »
I'm having trouble understanding the core concept of a game loop, and when the display actually happens. Could someone explain why this code (using SFML 2.0) successfully pops up a blank window:

Code: [Select]
void Game::Start(void) {    
    _mainWindow.Create(sf::VideoMode(1024, 768), "Otto");
    _mainWindow.SetFramerateLimit(60);

   
    while (!IsExiting()) {
        sf::Event currentEvent;
        while (_mainWindow.PollEvent(currentEvent)) {        
           
        }
        _mainWindow.Clear(sf::Color(0,0,0));
        _mainWindow.Display();
    }
   
    _mainWindow.Close();
}


But this code does not:

Code: [Select]
void Game::Start(void) {    
    _mainWindow.Create(sf::VideoMode(1024, 768), "Otto");
    _mainWindow.SetFramerateLimit(60);

   
    while (!IsExiting()) {
        _mainWindow.Clear(sf::Color(0,0,0));
        _mainWindow.Display();
    }
   
    _mainWindow.Close();
}


All that I removed is the event handling. Is there some tie in at the SFML level that actually triggers the display, or does the display happen immediately when .Display() is called?

Thanks for any help!

13
General / Installing on Mac (Xcode)
« on: November 22, 2011, 08:23:30 am »
First post. Hello, and thanks so much for all of the work on SFML!

In response to the original thread question -- I'm completely new to this, and have decided to document my experience. Installing SFML 2 on Xcode 4 took me about 4 hours (mainly due to me skipping steps or not reading correctly). Here is a basic walkthrough that groups together all of the help resources on this site:

http://gameandcode.com/post/13145870775/sfml-2-0-with-xcode-4

Pages: [1]