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

Pages: [1]
1
Graphics / Complex Image Handling
« on: May 04, 2011, 10:36:44 pm »
Quote from: "Laurent"
With this code, what you write/read is the value of a pointer. If you want to write the actual values that are pointed by this pointer, you have to write them one by one in the output stream.
And you also need to write the width and height to know how many elements are stored in the file.


Ahhh righto then. I'll get onto that, thanks for your help mate.

2
Graphics / Complex Image Handling
« on: May 04, 2011, 03:11:45 pm »
Quote from: "Laurent"
What does "Uint8" refer to? Pixel components, or bytes of a JPG file? In other words, what kind of information is there in the data that you load from your file?


I'm using the GetPixelPtr function to fill the dat file through the ofstream and then using the ifstream to pull it back. It appears to be working up until I'm pulling the data back through the ifstream and then it crashes.

The code looks something like this:
Code: [Select]

sf::Uint8* myImageArray;
sf::Image test;
void myFunction()
{
  test.LoadFromFile("Image1.jpg");
 
  ofstream arrayData("C:\\array.dat", ios::out);
  ifstream inData("C:\\array.dat", ios::in);

  arrayData << test.GetPixelsPtr() << endl;
  arrayData.close();

  inData >> myImageArray;
  test.LoadFromPixels(600, 600, myImageArray);
};

It's changed slightly as I've been experimenting while waiting, so now what happens is the application crashes on the inData >> myImageArray. Rather than getting an error at compile about being unable to convert to sf::Uint8.

I feel what I have is possibly close to what I need.

3
Graphics / Complex Image Handling
« on: May 04, 2011, 02:21:19 pm »
Hi Guys,

So cutting to the chase and avoiding beating around the bush here is what I want to do:

I have created a .dat file (binary) which contains the Uint8 information for a jpg. What I want to do is using iostream load that file into my application and then load it into an sf::Image.

So far I can restore the information into the application as Data (void*) where I get stuck is the converting this information back into Uint8. Does anyone have any ideas as to how I might do this?

Cheers,

Aaron

4
General / Problem installing
« on: November 03, 2010, 10:48:48 am »
I'm having the same issue, it seems to be more of an issue with Code::Blocks than with SFML. Code::Blocks is looking for a particular structure however this isn't sitting right with SFML (this is with the default application when choosing SFML Project in Code::Blocks).

5
Audio / [Resolved] Moving to next or previous song
« on: March 28, 2010, 10:31:43 pm »
Thanks for the suggestion Laurent, I didn't have any success though. :( I know where the problem is coming from now though if that helps.

It has something to do with sf::Music::Stop(). If I load a song in and then use stop and then play it doesn't work, but if I use sf::Music::Pause() and then change the song it does work.

6
Audio / [Resolved] Moving to next or previous song
« on: March 28, 2010, 12:06:46 pm »
I'm writing a program which as a side thing will have a jukebox feature.

The problem I have run into is that when moving to the next song or a previous song, the program gets the filename from the jukebox class and then opens the file.

minimal Jukebox code:
Code: [Select]

class Jukebox
{
    public  :
                //Load next song.
                std::string LoadSong()
                {
                    std::stringstream Filename;
                    Filename << MusicLoca.c_str() << MusicList[(lastSong+1)].c_str();
                    lastSong += 1;
                    std::cout<<Filename.str() << lastSong;
                    return Filename.str();
                }
private :
    std::string MusicLoca;
    std::string MusicList[19];
    int lastSong;
}


Access from main program:
Code: [Select]
Music.OpenFromFile(myJukebox.LoadSong());
        Music.Play();//Works
        Sleep(1000);
        Music.Stop();
        Music.OpenFromFile(myJukebox.LoadSong());
        Music.Play();//Doesn't work.


Now I know the Filename is being returned because of the std::cout.
I believe the issue is that I'm not using the sf::Music class correctly. If anyone can help that would be great.

Cheers,
Psychohyena

Pages: [1]
anything