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

Pages: [1]
1
General / Issues using sfe movie
« on: April 23, 2014, 11:16:50 pm »
I have my project set up to use Sfe Movie and my program builds fine, but everytime I run the executable it crashes when it tries to load an .ogv file (including one from the working demo). When I run in CMD, I get the errors:

Code: [Select]
N:\Projects\C++\SkipiEngineTest\Debug>N:\Projects\C++\SkipiEngineTest\Debug\SkipiEngineTest.exe
bad allocation
Could not open res/mov/IntroMovie.ogv
An internal OpenAL call failed in Sound.cpp (87) : AL_INVALID_NAME, an unacceptable name has been specified
An internal OpenAL call failed in SoundSource.cpp (64) : AL_INVALID_NAME, an unacceptable name has been specified
An internal OpenAL call failed in SoundSource.cpp (65) : AL_INVALID_NAME, an unacceptable name has been specified
An internal OpenAL call failed in Sound.cpp (87) : AL_INVALID_NAME, an unacceptable name has been specified
An internal OpenAL call failed in SoundSource.cpp (64) : AL_INVALID_NAME, an unacceptable name has been specified
An internal OpenAL call failed in SoundSource.cpp (65) : AL_INVALID_NAME, an unacceptable name has been specified
An internal OpenAL call failed in SoundBuffer.cpp (75) : AL_INVALID_NAME, an unacceptable name has been specified
An internal OpenAL call failed in SoundBuffer.cpp (75) : AL_INVALID_NAME, an unacceptable name has been specified
AL lib: FreeContext: (006c78b8) Deleting 1 Source(s)
AL lib: FreeContext: (0069af68) Deleting 3 Source(s)

The code to open the movie file looks like this:

Code: [Select]
for(int i = 0; i < NUM_MOVIE_FILES; i++){
sfe::Movie* m = new sfe::Movie;
try{
if(!m -> openFromFile(MOVIE_PATH + MOVIE_FILENAMES[i] + ".ogv")){
return -4;
}
}catch(std::exception& e){
std::cerr << e.what() << "\n";
std::cout << "Could not open " << MOVIE_PATH + MOVIE_FILENAMES[i] + ".ogv" << "\n";
return -4;
}
ResManager::movieMap[MOVIE_FILENAMES[i]] = m;
}

It's a pretty straightforward way of opening the files, and I assume the .ogv file in the demo has acceptable codecs. Maybe it's because I'm loading it through a pointer?

Thanks.

Edit:

Looks like it was because I was building in the debug configuration. Most of my issues are solved, expect one. Now when I run the program, I hear audio but no video is displayed. What I get with debugging messages enabled:

Code: [Select]
Input #0, ogg, from 'res/mov/IntroMovie.ogv':
  Duration: 00:03:05.07, start: 0.000000, bitrate: 1093 kb/s
    Stream #0:0: Video: theora, yuv444p, 876x622 [SAR 1:1 DAR 438:311], 100 fps,
 100 tbr, 100 tbn, 100 tbc
    Stream #0:1: Audio: flac, 22050 Hz, stereo, s16
    Metadata:
      TITLE           : Microsoft Waveform: ~temp-20130824_0004_36.wav
      ENCODER         : Lavf55.15.100
Using video framerate : 100
Wanted frame time is 10
[0.679s] Movie_video::DecodeFrontFrame() - frame not decoded (or incomplete)
[0.681s] Movie_video::DecodeFrontFrame() - frame not decoded (or incomplete)
[0.684s] Movie_video::DecodeFrontFrame() - frame not decoded (or incomplete)
[0.686s] Movie_video::DecodeFrontFrame() - frame not decoded (or incomplete)
[0.717s] did decode a full image
[0.730s] did decode a full image
[0.744s] did load an audio chunk
[0.744s] did load an audio chunk
[0.745s] did load an audio chunk
[0.759s] did start movie timer
[0.760s] audio playing : 0.019954s
[0.760s] reference playing : 0.021001s
[0.771s] audio playing : 0.019954s
[0.772s] reference playing : 0.032776s
[0.803s] did decode a full image
[0.856s] audio playing : 0.099954s
[0.860s] reference playing : 0.121183s
Movie_video::Run() - warning: skipping frame because we are late by 93ms (movie
playing offset is 123ms)
Mov[0.880s] audio playing : 0.139954s
ie[0.881s] reference playing : 0.14231s
_video::Run() - warning: skipping frame because we are late by 110[0.898s] audio
 playing : 0.139954s
m[0.899s] reference playing : 0.16023s
s (movie playing offset is 140ms)

Looks like frames are being skipped because the program thinks the video needs to be much farther ahead than it is?

Edit 2:

So the reason no video was displayed was because I accidentally set the scale to 0, 0. Fixing that, looks like the video is being displayed but only on the first frame..

Edit 3:

Looks like it was just an issue with my actual video file. Tried other files and it works.

2
Java / Is there a more efficient way of updating VertexArrays?
« on: January 22, 2014, 07:27:02 pm »
Hello.

I'm working on a project in which I'm using VertexArray to draw moving lines as well as a particle system based off the code shown here:
http://www.sfml-dev.org/tutorials/2.0/graphics-vertex-array.php

It's an easy enough implementation, however I end up with code that looks like this:

Note, the Vector2f is my own implementation since the values in org.jsfml.system.Vector2f are final.

Code: [Select]
import org.jsfml.graphics.*;
import org.jsfml.system.Time;
import systemcrash.math.Vector2f;

class MachinegunBullet extends Bullet {
    private VertexArray shape;
   
    @Override
    public void tick(Time t) {
pos.x += direction.x * velocity * t.asSeconds();
pos.y += direction.y * velocity * t.asSeconds();

shape.set(0, new Vertex(new org.jsfml.system.Vector2f(pos.x, pos.y), new Color(255, 255, 0, 100)));
shape.set(1, new Vertex(new org.jsfml.system.Vector2f(pos.x + 5*direction.y, pos.y + 5*direction.y), Color.YELLOW));

    }

    @Override
    public void draw(RenderTarget rt, RenderStates rs) {
rt.draw(shape);
    }
   
    public MachinegunBullet(Vector2f pos, Vector2f direction, float angle) {
super(pos, direction, angle);
shape = new VertexArray(PrimitiveType.LINES);
shape.add(new Vertex(new org.jsfml.system.Vector2f(pos.x, pos.y), new Color(255, 255, 0, 100)));
shape.add(new Vertex(new org.jsfml.system.Vector2f(pos.x + 5*direction.y, pos.y + 5*direction.y), Color.YELLOW));
    }

   
   
}

Since Vertexes are final, I have to create new vertex objects with the updated positions as well as colors in some cases. So that leaves me wondering if there is a better method of updating the Vertices in the Array than throwing away two objects per frame per bullet?

Thanks.

3
General / Issue with static linking in MSVC 2012
« on: July 19, 2013, 05:43:34 am »
I've been looking through threads for a few hours now trying to find a solution to my problem, but nothing I'm finding appears to be my issue.

Anyways, I'm using MS Visual Studio 2012 with SFML 2.0 and I am trying to statically link the libraries. The errors I am getting are:

Code: [Select]
Error 1 error LNK2019: unresolved external symbol "public: __thiscall sf::String::String(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::locale const &)" (??0String@sf@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABVlocale@3@@Z) referenced in function _main N:\Projects\C++\RTS\RTS\main.obj RTS
Error 2 error LNK2019: unresolved external symbol "public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (??0VideoMode@sf@@QAE@III@Z) referenced in function _main N:\Projects\C++\RTS\RTS\main.obj RTS
Error 3 error LNK2019: unresolved external symbol "public: void __thiscall sf::Window::create(class sf::VideoMode,class sf::String const &,unsigned int,struct sf::ContextSettings const &)" (?create@Window@sf@@QAEXVVideoMode@2@ABVString@2@IABUContextSettings@2@@Z) referenced in function _main N:\Projects\C++\RTS\RTS\main.obj RTS
Error 4 error LNK2019: unresolved external symbol "public: void __thiscall sf::Window::close(void)" (?close@Window@sf@@QAEXXZ) referenced in function "void __cdecl getEvents(void)" (?getEvents@@YAXXZ) N:\Projects\C++\RTS\RTS\main.obj RTS
Error 5 error LNK2019: unresolved external symbol "public: bool __thiscall sf::Window::isOpen(void)const " (?isOpen@Window@sf@@QBE_NXZ) referenced in function _main N:\Projects\C++\RTS\RTS\main.obj RTS
Error 6 error LNK2019: unresolved external symbol "public: bool __thiscall sf::Window::pollEvent(class sf::Event &)" (?pollEvent@Window@sf@@QAE_NAAVEvent@2@@Z) referenced in function "void __cdecl getEvents(void)" (?getEvents@@YAXXZ) N:\Projects\C++\RTS\RTS\main.obj RTS
Error 7 error LNK2019: unresolved external symbol "public: __thiscall sf::RenderWindow::RenderWindow(void)" (??0RenderWindow@sf@@QAE@XZ) referenced in function "void __cdecl `dynamic initializer for 'app''(void)" (??__Eapp@@YAXXZ) N:\Projects\C++\RTS\RTS\main.obj RTS
Error 8 error LNK2019: unresolved external symbol "public: virtual __thiscall sf::RenderWindow::~RenderWindow(void)" (??1RenderWindow@sf@@UAE@XZ) referenced in function "void __cdecl `dynamic atexit destructor for 'app''(void)" (??__Fapp@@YAXXZ) N:\Projects\C++\RTS\RTS\main.obj RTS
Error 9 error LNK2019: unresolved external symbol "void __cdecl getInputs(void)" (?getInputs@@YAXXZ) referenced in function _main N:\Projects\C++\RTS\RTS\main.obj RTS
Error 10 error LNK2019: unresolved external symbol "void __cdecl tick(void)" (?tick@@YAXXZ) referenced in function _main N:\Projects\C++\RTS\RTS\main.obj RTS
Error 11 error LNK2019: unresolved external symbol "void __cdecl updateScreen(void)" (?updateScreen@@YAXXZ) referenced in function _main N:\Projects\C++\RTS\RTS\main.obj RTS
Error 12 error LNK1120: 11 unresolved externals N:\Projects\C++\RTS\Debug\RTS.exe RTS

Also, some of my output I got during compilation:

Code: [Select]
1>  Unused libraries:
1>    N:\Projects\C++\RTS\RTS\libs\SFML\sfml-graphics-s-d.lib
1>    N:\Projects\C++\RTS\RTS\libs\SFML\sfml-window-s-d.lib
1>    N:\Projects\C++\RTS\RTS\libs\SFML\sfml-system-s-d.lib
1> 
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall sf::String::String(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::locale const &)" (??0String@sf@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABVlocale@3@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (??0VideoMode@sf@@QAE@III@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall sf::Window::create(class sf::VideoMode,class sf::String const &,unsigned int,struct sf::ContextSettings const &)" (?create@Window@sf@@QAEXVVideoMode@2@ABVString@2@IABUContextSettings@2@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall sf::Window::close(void)" (?close@Window@sf@@QAEXXZ) referenced in function "void __cdecl getEvents(void)" (?getEvents@@YAXXZ)
1>main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall sf::Window::isOpen(void)const " (?isOpen@Window@sf@@QBE_NXZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall sf::Window::pollEvent(class sf::Event &)" (?pollEvent@Window@sf@@QAE_NAAVEvent@2@@Z) referenced in function "void __cdecl getEvents(void)" (?getEvents@@YAXXZ)
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall sf::RenderWindow::RenderWindow(void)" (??0RenderWindow@sf@@QAE@XZ) referenced in function "void __cdecl `dynamic initializer for 'app''(void)" (??__Eapp@@YAXXZ)
1>main.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall sf::RenderWindow::~RenderWindow(void)" (??1RenderWindow@sf@@UAE@XZ) referenced in function "void __cdecl `dynamic atexit destructor for 'app''(void)" (??__Fapp@@YAXXZ)
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl getInputs(void)" (?getInputs@@YAXXZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl tick(void)" (?tick@@YAXXZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl updateScreen(void)" (?updateScreen@@YAXXZ) referenced in function _main
1>N:\Projects\C++\RTS\Debug\RTS.exe : fatal error LNK1120: 11 unresolved externals

I had a problem before of the linker not finding the .lib files, but after fixing that, I am certain it is finding them. I have them set in Linker>Input>Additional Dependencies as *-s-d.lib and I also have SFML_STATIC set in C/C++>Preprocessor>Preprocessor Definitions. Furthermore, I've seen some sources saying to set C/C++>Code Generation>Runtime Library to Multi-threaded Debug (/MDd).

The only thing I have not done is set up everything for Release, but I don't think that should affect me as long as I'm working in Debug mode. The libraries I am using are sfml-system-s-d.lib, sfml-windows-s-d.lib, and sfml-graphics-s-d.lib.

I've been working with SFML for a few years now, but I constantly get these linker errors and can never solve them. Obviously I'm missing something. Any help or insights would be greatly appreciated.

4
Graphics / Need help with '&#8734;' symbol
« on: December 01, 2011, 04:39:28 am »
Hello,

I am trying to display the infinity symbol for a game I am making.

The code I use to get it is:

Code: [Select]

AmmoText = sf::String(sf::Unicode::Text(L"\u221E"), sf::Font::GetDefaultFont(), 10.f);


But nothing shows up for it.

How can I make it so that '∞' will be outputted?

Thanks

5
SFML projects / TileCat Map Editor
« on: November 12, 2011, 12:00:53 am »
Hello.

While developing another project I started this project as a small utility program to make maps for an RPG game. I've since turned it into its own project.

What it is, is a tile map editor with a few rather simple functions.

You can load/Save files

Copy/Paste sections of tiles

Fill a block of tiles

Select two different tiles to "paint"

A full README is included.

Here's a screen shot:



Download here:

https://sourceforge.net/p/tilecat/home/Home/

So what do you all think?

I want to eventually make it so I can have multiple maps open at once each with their own window. But I've ran into many problems and bugs trying this.

6
Graphics / Help with sf::RenderWindow*
« on: November 02, 2011, 09:47:47 pm »
Hello,

I'm having a small issue with a pointer to a render window. I basically have a vector of a class I wrote where each instance has their own render window, although because render window is noncopyable, I am using a pointer to a render window. Here's the code:

Code: [Select]

class TileMap
{
public:
        sf::RenderWindow* App;
        sf::RenderWindow* App2;
}
int main()
{
    vector<TileMap> Maps;
    Maps.push_back(TileMap());
}

TileMap::TileMap()
{
    App = new sf::RenderWindow(sf::VideoMode(1088, 832), MapType + " - " + MapName);
    App2 = new sf::RenderWindow(sf::VideoMode(64, 640), "Images");
}  


What ends up happening is two white windows flash on the screen then disappear. Then the program crashes when it checks if App is open.

So what am I doing wrong in this? I believe that, somehow, the pointer is being broken somewhere. I tried making the RenderWindows on the heap but I got a whole slew of bugs.

Thanks

7
Window / problem with view movement
« on: October 22, 2011, 08:48:43 pm »
Hello,

I am making an RPG using SFML and I'm running into this problem when it comes to views. I have this code:

Code: [Select]

/////////////
//ANIMATE
/////////////
 
void Character::Animate(sf::RenderWindow& App, Game& Game)
{
    float offset =  128 * App.GetFrameTime();
    if(PosX < MapX * 64)
        {
            PosX += offset;
            Game.View.Move(offset, 0);
        }
    else if(PosX > MapX * 64)
        {
            PosX -= offset;
            Game.View.Move(-offset, 0);
        }
    else if(PosY < MapY * 64)
        {
            PosY += offset;
            Game.View.Move(0, offset);
        }
    else if(PosY > MapY * 64)
        {
            PosY -= offset;
            Game.View.Move(0, -offset);
        }
    else if(PosX == MapX * 64 && PosY == MapY * 64)
        {
            Moving = false;
            //PosX ++;
            //MapX++;
            //PosY++;
            //MapY++;
            //cout << "Moving == false";
        }
    Timer++;
    if(Timer == 1 && Moving)
        Direction++;
    else if(Timer == 8 && Moving)
        Direction--;
    else if(Timer == 16 && Moving)
        Direction += 2;
    else if (Timer == 24 && Moving)
        Direction -= 2;
    if(Moving)
     cout << Timer << " ";
    //else if (Timer == 64)
    //cout << PosX << " " << PosY << " " << MapX << " " << MapY << "\n";
 
 
    return;
}


Which is called once a arrow key is pressed. However, the view is moving faster than the character though they ought to be moving at the same speed. Any ideas as to what's going wrong? Thanks! :D

8
Graphics / Problem using Images and Sprites from within a class
« on: July 26, 2011, 06:54:12 am »
Hello, I am trying to display sprites inside a class function to display to the screen. However I am getting nothing but a wall of white. Here's my code:

Code: [Select]

class Game
{
public:

        sf::RenderWindow App;
        sf::View View;
        vector <sf::Sprite> SpriteFiles;
        vector <int> MapData;
        vector <int> CollisionData;
        vector <int> TransitionData;
vector <sf::Image> ImageFiles;
void Setup();
        void LoadMap(string);//Map to load ID
void Display();

        //void Setup();
        void MainMenu();
        void GetEvents();

        void LevelUp(string, int*);//Daemon name, pointer to Daemon stats array

//Game();
//~Game();
private:
bool FilesExist;


int MapWidth, MapHeight, ScreenWidth, ScreenHeight, PosX, PosY;
};


^ The class sf::Sprite and sf::Image are initialized in

Code: [Select]

void Game::Setup()
{
App.Create(sf::VideoMode(1024, 768), "Daemons");

App.UseVerticalSync(true);//Clearer graphics ftw

//sf::View View(sf::FloatRect(0,0,1024,768));
    View.SetFromRect(sf::FloatRect(0,0,1024,768));
App.SetView(View);//Sets up the view. So you can see stuff
App.SetFramerateLimit(60);

FilesExist = true;
int ImageNum = 0;
ScreenWidth = 17;
ScreenHeight = 13;
PosX = -1;
PosY = -1;
stringstream PictureName;

for(ImageNum = 0; ImageNum < 10; ImageNum++)
    {

        PictureName << "data/images/map/" << ImageNum << ".png";

ImageFiles.resize(ImageNum + 1);
SpriteFiles.resize(ImageNum + 1);


        if(ImageFiles[ImageNum].LoadFromFile(PictureName.str().c_str()))
        {
            ImageFiles[ImageNum].SetSmooth(false);
            SpriteFiles[ImageNum].SetImage(ImageFiles[ImageNum]);
        }
cout << "\n" << PictureName.str().c_str() << "\n";
PictureName.str(string());
       

    }

return;
}



////////////////////
//DISPLAY
////////////////////
void Game::Display()
{
try
{
        App.Clear();
        for (int y=PosY; y<ScreenHeight; y++)
            {
                for (int x=PosX; x<ScreenWidth; x++)
                {
                    if ((y >= 0 && x >= 0) && (y <= ScreenHeight && x <= ScreenWidth))
                    {
                        if (MapData[x + (y * MapWidth)] == -1)
                            continue;
                        int holder = MapData[x + (y * MapWidth)];
                        SpriteFiles[holder].SetPosition(x * 64, y * 64);

                        //cout << holder;
                        App.Draw(SpriteFiles[holder]);
                    }
                }

            }
        App.Display();
}
catch(exception& e)
{
   cout << e.what() << "\n";
}
return;
}


^Where they are used

So what exactly is causing the images to not display correctly and how can I fix it?

Thanks.

Pages: [1]
anything