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

Pages: [1] 2
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 / Re: Issue with static linking in MSVC 2012
« on: July 19, 2013, 08:07:54 pm »
How would it compile if it couldn't find the headers?

I don't think that could be it since I put it in the compiler include folder. But just in case, I set the include directory in the settings to the SFML headers and I get the same result.

4
General / Re: Issue with static linking in MSVC 2012
« on: July 19, 2013, 05:15:39 pm »
It's possible I've changed something I shouldn't have. I'm not too familiar with many of the options.

All the files were added correctly to the project, and all my current functions are implemented in main.cpp, so it shouldn't be that. The output from my code was the linker. I set it to verbose so it outputs everything. My code is compiling fine, it's just linking improperly.

I've attached the project file.

5
SFML projects / Re: The best SFML games
« on: July 19, 2013, 06:01:57 am »
The best SFML game I have encountered would have to be Open Hexagon.

http://vittorioromeo.info/projects.html

It's a remake of Terry Cavanagh’s famous Super Hexagon that greatly extends the game.

6
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.

7
Graphics / Need help with '&#8734;' symbol
« on: December 03, 2011, 06:39:15 pm »
Sorry for the double post, but when I use the code above I get this message in the console:

Code: [Select]

     Failed to load font "arial.ttf" (Cannot open Resource"


It only occurs when I pass the character set to the font.

How do I fix this? Thanks :D

8
Graphics / Need help with '&#8734;' symbol
« on: December 01, 2011, 04:40:47 pm »
I checked and Arial does seem to include it. However it's still not showing up.

Here's the code I have now:

Code: [Select]

    sf::Font Font;
    sf::Uint32 CharSet[] = {0x221E,0x0};
    Font.LoadFromFile("arial.ttf", 30, CharSet);

...

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

9
Graphics / Need help with '&#8734;' symbol
« on: December 01, 2011, 03:26:01 pm »
Ok, I see. What font can I use that includes the symbol?

10
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

11
SFML projects / TileCat Map Editor
« on: November 12, 2011, 02:50:40 am »
Thanks! Eventually, once I make more progress I'll post a thread about the game I made this for.

12
SFML projects / TileCat Map Editor
« on: November 12, 2011, 12:37:00 am »
Well, more or less for the experience of coding it. Also I can change it easily to suit my needs.

Also I'd like to expand it and make it unique eventually.

13
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.

14
Graphics / Help with sf::RenderWindow*
« on: November 02, 2011, 10:18:01 pm »
I actually forgot to change something.

Code: [Select]

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


Should be

Code: [Select]

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


And that's what I'm getting an error with. The rest of my code(Minus unrelated functions, of course):

Code: [Select]

class TileMap
{
public:
        sf::RenderWindow* App;
        sf::RenderWindow* App2;
        sf::View View;
        vector<int> MapData;
        vector<sf::Sprite> Sprites;
        vector<sf::Image> Images;
        vector<sf::Shape> Shapes;
        vector<string> MapTypes;
        int MapWidth, MapHeight, ImageSize;
        string MapType, MapName;

        //void Draw(int, int, int);//Done
        void Inputs();
        void Inputs(vector<TileMap>&);//Done
        void LoadImages();//Done
        void LoadSprites();//Done

        void SaveFile();//Done
        void LoadFile();//Done

        void GetEvents();//Done
        void Display();
        void Display(vector<sf::Sprite>&, vector<int>&);
        //void SaveCalc();
        //void SendCalc();//This will be the last thing to be implemented
TileMap();//Type of Map
//TileMap(string, string);
//~TileMap();
protected:

private:
        int ImgListNum, selectedimage, selectedimage2;
};
int main()
{
    vector<TileMap> Maps;
    Maps.push_back(TileMap());
    while(Maps[0].App -> IsOpened())
    {
        for(int i = 0; i < Maps.size(); i++)
        {
            Maps[i].GetEvents();
            if(!Maps[i].App -> IsOpened())
                Maps.erase(Maps.begin() + i);
            Maps[i].Inputs(Maps);
            Maps[i].App -> Clear();
            Maps[i].App2 -> Clear(sf::Color::White);
            if(Maps[i].MapType == "visual")
                Maps[i].Display();
            else
                Maps[i].Display(Maps[0].Sprites, Maps[0].MapData);
        }
    }
    return 0;
}
TileMap::TileMap()
{
    bool load = false;
    MapTypes.push_back("visual");
    MapTypes.push_back("collision");
    MapTypes.push_back("transitional");
    MapTypes.push_back("events");
    MapTypes.push_back("NPC");

    int choice = -1;
    while(choice < 0 || choice > MapTypes.size())
    {
        system("cls");
        cout << "Map Type";
        for(int i = 0; i < MapTypes.size(); i++)
            cout << "\n" << i << ":\t" << MapTypes[i];
        cout << "\n(1, 2, 3, 4...): ";
        cin >> choice;
    }
    MapType = MapTypes[choice];
    cout << "Do you want to load a map? (1/0)";
    cin >> load;
    if(load)
    {
        cout << "Name of Map to Load: ";
        cin >> MapName;
    }
    else
    {
        cout << "Name of New Map: ";
        cin >> MapName;

        cout << "Input Map Size (X Y): ";
        cin >> MapWidth >> MapHeight;

        MapData.resize(MapWidth * MapHeight, -1);
    }

    cout << "Input Image Size: ";
    cin >> ImageSize;

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

App -> UseVerticalSync(true);
    App2 -> UseVerticalSync(true);

    View.SetFromRect(sf::FloatRect(0,0,1088,832));
App -> SetView(View);

LoadImages();
cout << "Images Loaded\n";
    LoadSprites();
    cout << "Sprites Loaded\n";
    selectedimage = 0;
    selectedimage2 = 1;

    Shapes.push_back(sf::Shape::Rectangle(0,0,(MapWidth * ImageSize), (MapHeight * ImageSize),sf::Color(255,255,255,0),4,sf::Color(0,0,255,127)));
    Shapes.push_back(sf::Shape::Rectangle(0,0,ImageSize,ImageSize,sf::Color(255,255,255,0),4,sf::Color(0,0,255,127)));
    Shapes.push_back(sf::Shape::Rectangle(0,0,ImageSize,ImageSize,sf::Color(255,255,255,0),4,sf::Color(0,255,0,127)));

}

15
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

Pages: [1] 2