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 - Me-Myself-And-I

Pages: [1] 2 3 4
1
General / Re: Can you integrate allegro into an sfml window?
« on: May 19, 2024, 12:23:08 am »
Thankyou.
There's a problem though. 
216   3   ...\pl_mpeg.h   [Error] conflicting declaration 'typedef struct plm_plane_t plm_plane_t'

2
General / Re: Can you integrate allegro into an sfml window?
« on: May 17, 2024, 03:23:41 pm »
Quote
What sort of video do you need to support? If it's just for some intro videos/cutscenes pl_mpeg is pretty easy to integrate with a RenderTexture/AudioStream
This sounds like what I need. Could you please show me an example script of the video player being used for sfml?

3
General / Re: Can you integrate allegro into an sfml window?
« on: May 15, 2024, 01:18:35 am »
I see... I thought perhaps allegro would be reasonably easy to put into an sfml window. Looks like that brings me back to sfemovie, which is something I have so far unsuccessfully setup.  ::)  Thanks anyways. :)

4
General / Can you integrate allegro into an sfml window?
« on: May 13, 2024, 02:46:11 pm »
Hey, everybody.

I've been thinking sfml isn't up to the task for video playing so I thought i'd use allegro just for the videos. I want  to have the video display in the sfml window but I'm not sure if this works. I don't know allegro. I don't even have it set up yet. But I would like to find out if its even possible to do this before I waste time on allegro. I know allegro and sfml are built on opengl so there is some possibility.
Thanks

5
Graphics / Re: What is the best way to animate large frames?
« on: April 30, 2024, 04:54:55 am »
Quote
At what point would it make sense to use a video format instead of trying to manually create an animation of images? ;)
That was my first choice but I haven't been too successful at playing videos in an SFML window. Also I was under the impression that something like sfeMovie doesn't support drawing sprites on-top of the video as its playing, which is something I need. I also notice a slight blur that usually occurs when you scale up a video as opposed to a scaled up image which does not blur. And by scaled up I mean zoomed into by the view.  Maybe its just some setting I have wrong for that so i'm open to considering using a video instead.



Quote
You could perform the reading in a separate thread, so you don't block your "UI" thread, but make sure to only do this for the disk reading part (i.e. sf::Image) and not to try to do any OpenGL calls in a separate thread.

Could you please show me how to do that? I'm not too good at doing multithreading for class objects.
 I would really appreciate it.

6
Graphics / What is the best way to animate large frames?
« on: April 29, 2024, 01:45:07 am »
I have a class called "Life" which loads each frame into a vector of images and plays it when needed. I need something that can load 960x540 frames so I surely abandoned trying to use spritesheets. This method i'm using now works but is extremely inefficient. Just using the load function causes the entire program to stop till the process of loading finishes. 10 or so frames causes a 1/2 second pause and any decent length animation of 200 frames  causes a whopping 10 to 15 second lag. Of course I can't have this. Is this method impossible? I know there must be some way to load and play the frames of an animation that is 960x540. I just don't know how.


Here is my loading code.
                DIR *dr;
               
                struct dirent *en;
               
                dr=opendir(folder.c_str());
                for(int a=1;a<2000;a++)
                {

                        if(en=readdir(dr))
                        {
                                if(en->d_name==NULL)
                                {
                                        break;
                                }
                                if(a>2)
                                {
                                        Image newimage;
                                        newimage.loadFromFile(folder+en->d_name);
                                        image.push_back(newimage);
                                }
                        }
                        else
                                break;
                               
                               
                }
                closedir(dr);
 

I'm sure its not dirent that is causing the process pause because I manually loaded each frame to test if it was dirent or not and it still halted the processing the same.

I also tried loading only portions at a time as needed by loading the next few frames as needed. This still caused a 1/2 second lag that happened every few frames.



I know that loading from files is not good on performance, since several have told me that before. So I'm looking for either a new method,or a fix to this current method. So any ideas?

I also would like to know if it  would work to load into each image one loop at a time instead of all in one for() iterator.

 

7
Audio / Re: Music not playing even though its loaded.
« on: April 24, 2024, 06:08:16 pm »

Quote
Why this would have an impact on the music playing or not playing, I don't know, since those are separate modules without any overlaps.  ???
I too thought that was very strange.


Quote
You shouldn't use any SFML resources globally, in general avoid globals as much as possible.
Initialization and destruction order at a global scope aren't guaranteed, so you can run into issues where some expected internal SFML global isn't initialize or already destructed, leading to crashes. As for globals in general, they make it very hard to impossible to track the state and code flow at any given moment.

The solution is for me to make a better habit of not declaring SFML elements globally. Thankyou for your help.


Quote
I tried the same code (both global and local window) and music played fine in both cases. Although I'm using SFML 3 so maybe it doesn't have the issue.
I even tried playing the music without a window and it worked. (I replaced the while open loop with a Sleep(10000)).

But I see some bits of the audio system have changed since SFML 2.5 with how the global audio device is handled.

Yes, its likely that this problem was fixed in sfml 3. I use 2.4.0 so it might be more likely for this error to occur in this version when the window is declared globally.

8
Audio / Re: Music not playing even though its loaded.
« on: April 24, 2024, 02:55:33 am »
So strange. I cut it down to a bare minimum and I located the problem at the window declaration.

In main.h
#include <SFML\Graphics.hpp>




extern sf::RenderWindow window;
 


In main.cpp
#include <SFML\Graphics.hpp>
#include <SFML\Audio.hpp>
#include "main.h"
#include <windows.h>




               
sf::RenderWindow window(sf::VideoMode(960,540),"Weather Dodger");



int main()
{
       
       
       






        sf::Music themusic;
        if(!themusic.openFromFile("ASSETS/snow.wav"))
        {
                MessageBox(NULL,"Not found","Error",MB_OK);

        }
        themusic.setVolume(100);
        themusic.play();


        while(window.isOpen())
        {

                sf::Event e;
                while(window.pollEvent(e))
                {
                        if(e.type==sf::Event::Closed)
                                window.close();
                }
               
       
               
               
               
               
               
               
               
               
                window.clear();

                window.display();
        }
}



 

With this code the music does not play.


But with window declared locally theres no problem.Any ideas why this problem occurs?

In main.cpp with window local.

#include <SFML\Graphics.hpp>
#include <SFML\Audio.hpp>
#include "main.h"
#include <windows.h>




               



int main()
{
       
       
       



        sf::RenderWindow window(sf::VideoMode(960,540),"Weather Dodger");



        sf::Music themusic;
        if(!themusic.openFromFile("ASSETS/snow.wav"))
        {
                MessageBox(NULL,"Not found","Error",MB_OK);

        }
        themusic.setVolume(100);
        themusic.play();


        while(window.isOpen())
        {

                sf::Event e;
                while(window.pollEvent(e))
                {
                        if(e.type==sf::Event::Closed)
                                window.close();
                }
               
       
               
               
               
               
               
               
               
               
                window.clear();

                window.display();
        }
}








 

Seems like a window error to me.But why? :P

9
Audio / (SOLVED)Music not playing even though its loaded.
« on: April 23, 2024, 12:43:38 am »
I have this strange problem where the music is loaded but nothing happens when the program is run.

This is put before my window.isOpen() loop.
        Music themusic;
        if(!themusic.openFromFile("ASSETS/snow.wav"))
        {
                MessageBox(NULL,"Not found","Error",MB_OK);

        }
        themusic.setVolume(100);
        themusic.play();


The game updates fine.Theres no freezing going on.And I'm sure the audio file works.I have been using audio files in music and suddenly it doesn't make a sound.I'm sure my computer audio works too because sf::sound works. Either i'm doing something wrong here or something in my other code is stopping themusic. I'm certain there is no themusic.stop() anywhere in my code so i'm wondering if its some sort of problem with sfml. I did use 500 sounds. Could this effect sf:Music? I know. Why use 500 sounds? Well its actually for a sound that is played very fast so I need it.
Any ideas where the problem is?
Thanks

10
Graphics / Re: invisible window border causes smaller top of window
« on: February 04, 2024, 10:11:29 pm »
Ok.Nevermind.I found a solution. It seems this happens because the window is set to create in the center of the screen.All that was needed was to move the window to point 0,0 after creating it.

11
Graphics / (solved)invisible window border causes smaller top of window
« on: February 04, 2024, 08:40:27 pm »
I have a program that gets the desktops workarea size then makes a window with that size and it works good for displaying the window as large as the screen and not cover up the taskbar but either this or sfml's window class is causing a transparent border to shrink the window at the top.

Here's my code:



IntRect getWorkArea()
{
        RECT rcWorkArea = { 0 };
        SystemParametersInfo( SPI_GETWORKAREA, 0, &rcWorkArea, 0 );
        return IntRect(int(rcWorkArea.left),int(rcWorkArea.top),int(rcWorkArea.right),int(rcWorkArea.bottom));
}


int main()
{
        IntRect workarea;
        workarea=getWorkArea();
        RenderWindow window(VideoMode(workarea.width,workarea.height),"Blupi Desktop",Style::None);
       
       //loop stuff
}
 

12
I thought I should mention what solved my problem in case anyone wants to know. The solution was to load the entire picture into an sf::image then to load the necessary rect from that into the amount of textures needed.  That way the texture doesn't have to be loading a rect directly from file and instead make the texture reusable by allowing the rect to change as its loading from the memory of sf::image. I don't know if this is a dummy solution or not but hey, it works. :P

13
Thankyou for your help.

14
Hello all.

I know I have asked about this before but I still haven't found a solution. My biggest problem is trying to load dimentionally large animations into a game without causing performance lagging or having an overabundance of texture objects. If I put any large dimention animations into a spritesheet its too large to load to texture. Recently I heard something about it being possible to load large textures using vertices. Is this correct? If so, How? My game isn't so dimentionally large.Its only 960x540 at most. There must be a way to display large frames without hitting performance issues. If I split up an animation thats large into dimentionally small frame rects and save each as files,and load each into the game,it still requires either loading a lot into memory or lloading from file as its needed. Loading from file as needed definitely causes lag I know.  Would it be possible to create several textures when they are needed for preloading and delete them after its done playing the animation?Or would this still cause lag?Also I know that each texture is loaded into memory anyways so why can't it treat one large image as memory the same way that it treats several loaded images as the same amount of memory?

15
Graphics / Re: Image doesn't save but gives no error report.
« on: November 17, 2023, 05:09:49 am »
Thanks for the advice.

Pages: [1] 2 3 4