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

Pages: [1] 2
1
Window / Window Position
« on: July 25, 2010, 07:11:32 pm »
Is there any way to find out where the user has moved a window? I'm trying to save a file that contains the size and position of the window.

Currently, I set the window's position with SetPosition, but is there no way to find out if/where the user moves it?

2
Audio / [Resolved] Moving to next or previous song
« on: June 05, 2010, 02:21:02 am »
The issue only happens when using OpenFromMemory.

3
Audio / [Resolved] Moving to next or previous song
« on: June 04, 2010, 04:31:04 am »
Code: [Select]

int main()
{
    sf::Clock clock;

MusicManager::getInstance()->getResource("Death.ogg")->Play();
while(clock.GetElapsedTime() < 7);
clock.Reset();

MusicManager::getInstance()->getResource("Death.ogg")->Stop();
MusicManager::getInstance()->getResource("Relief.ogg")->Play();
while(clock.GetElapsedTime() < 7);
clock.Reset();

MusicManager::getInstance()->getResource("Relief.ogg")->Stop();
MusicManager::getInstance()->getResource("Death.ogg")->Play();
while(clock.GetElapsedTime() < 7);
clock.Reset();

MusicManager::getInstance()->getResource("Death.ogg")->Stop();
MusicManager::getInstance()->getResource("Relief.ogg")->Play();
while(clock.GetElapsedTime() < 7);
clock.Reset();

    return EXIT_SUCCESS;
}


Death.ogg doesn't play the second time.

Code: [Select]

MusicManager* MusicManager::musicManager;

sf::Music* MusicManager::load(const std::string& stringID)
{
    sf::Music* music = new sf::Music();

    char* buffer = resourceLoader.GetFile(stringID);

    if(!music->OpenFromMemory(buffer, resourceLoader.GetFileSize(stringID)))
    {
        #ifdef DEBUG
            std::cout<< "MusicManager failed to load: " << stringID << std::endl;
        #endif
    }

    music->SetVolume(25);

    return music;
}


The above is my music manager class which is inheriting from:
http://www.sfml-dev.org/wiki/en/sources/resource_manager

4
Audio / [Resolved] Moving to next or previous song
« on: June 04, 2010, 04:15:10 am »
I'm currently putting together a small example to reproduce this, but one thing I noticed is that it only happens when using OpenFromMemory. If I use OpenFromFile it works fine.

5
Audio / [Resolved] Moving to next or previous song
« on: June 03, 2010, 02:17:25 am »
I'm getting a very similar issue to this with SFML 1.6

Whenever my character dies, I play a death song. This plays correctly. Whenever I attempt to switch back to the main song however, it incorrectly plays the death song again.

Code: [Select]

if(deathTimer.GetElapsedTime() < 7 && immortal.GetElapsedTime() > 7)
    {
        if(currentSong != "Death.ogg")
        {
            MusicManager::getInstance()->getResource(currentSong)->Stop();
            currentSong = "Death.ogg";
            MusicManager::getInstance()->getResource(currentSong)->Play();
        }
    }
    else if(currentSong != "Relief.ogg")
    {
        MusicManager::getInstance()->getResource(currentSong)->Stop();
        currentSong = "Relief.ogg";
        MusicManager::getInstance()->getResource(currentSong)->Play();
    }


When it calls attempts to restart Relief.ogg, it instead plays Death.ogg

6
Graphics / Bad Huffman Compression
« on: April 29, 2010, 02:51:56 am »
Here's the call stack when it crashes.

#0 00484896   zget8()
#1 004848E3   fill_bits()
#2 00484959   zhuffman_decode(z=0x6abc730)
#3 00484B4D   parse_huffman_block()
#4 004853DC   parse_zlib(parse_header=1)
#5 00485434   do_zlib(obuf=0xd0aced0 "8+f\r\020qW\rîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþ"..., olen=16384, exp=1, parse_header=1)
#6 0048547B   stbi_zlib_decode_malloc_guesssize(initial_size=16384, outlen=0xed7f3fc) (D:/Programmation/Cpp/SFML/tags/1.5/src/SFML/Graphics/SOIL/stb_image_aug.c:1829)
#7 004854E0   stbi_zlib_decode_malloc(buffer=0xd980020 "XÃ…\230Í\217\\W\021Å\177Uuß›ž±\215mœÄò\220(DQ\024\004B¬\220\"±\002\026‘\b°‹Ø±aÇ’¿%‚\210\035\022\vÄ\016„\"\201„ØÀŠ\005\bœ\020)
#8 00486B78   parse_png_file(scan=0, req_comp=4)
#9 00486DB7   do_png(x=0xed7f928, y=0xed7f924, n=0xed7f920, req_comp=4)
#10 00486F54   stbi_png_load_from_memory(buffer=0xd6a2eb8 "Ä", len=285292, x=0xed7f928, y=0xed7f924, comp=0xed7f920, req_comp=4)
#11 00480756   stbi_load_from_memory(buffer=0xd6a2eb8 "Ä", len=285292, x=0xed7f928, y=0xed7f924, comp=0xed7f920, req_comp=4)
#12 00466D55   SOIL_load_image_from_memory(buffer=0xd6a2eb8 "Ä", buffer_length=285292, width=0xed7f928, height=0xed7f924, channels=0xed7f920, force_channels=4)
#13 0045B383   sf::priv::ImageLoader::LoadImageFromMemory(this=0x6ab86a0, Data=0xd6a2eb8 "Ä", SizeInBytes=285292, Pixels=..., Width=@0x75efb90, Height=@0x75efb94)
sf::Image::LoadFromMemory(this=0x75efb78, Data=0xd6a2eb8 "Ä", SizeInBytes=285292)

This is a link to the image.
http://yfrog.com/0fspritezombiep

7
Graphics / Bad Huffman Compression
« on: April 28, 2010, 04:25:58 am »
Occasionally when loading an image, I get a debug message saying Bad Huffman Compression.

I can get more info on this later, but any ideas as to what it is related?

8
Network / Upgraded to SFML 1.6, now linker issues.
« on: April 10, 2010, 10:03:56 pm »
I just recently upgraded to SFML 1.6, now I'm getting linker errors that say

"undefined reference to '_Unwind_Resume'

I couldn't figure out how to fix it, any ideas?

9
Graphics / SFML 2.0 - Missing letters when drawing sf::Text
« on: January 21, 2010, 08:58:30 pm »
It works with size 14.

I can't test it now because I'm at work, but I did have several error messages, mostly involving opengl errors in sf::Image.

I can post them once I get home.

10
Graphics / SFML 2.0 - Missing letters when drawing sf::Text
« on: January 21, 2010, 02:33:47 pm »
I attempted to make a sample program that displayed this issue, but I found it only happened in the context of my program.

My original code was this -
Code: [Select]

sf::Text sfString;
sfString.SetCharacterSize(16);
sfString.SetPosition(inventory.sprite.GetPosition().x+55, inventory.sprite.GetPosition().y+9);
sfString.SetString("Bindle");
window->Draw(sfString);


And that resulted in broken text.


When I switched to this -
Code: [Select]

sf::Text sfString;
sfString.SetScale(0.533333333, 0.533333333);
sfString.SetPosition(inventory.sprite.GetPosition().x+55, inventory.sprite.GetPosition().y+9);
sfString.SetString("Bindle");
window->Draw(sfString);


It works just fine.

11
Graphics / SFML 2.0 - Missing letters when drawing sf::Text
« on: January 21, 2010, 04:18:16 am »
I narrowed this down to an issue with the SetString method.

If I set the text by constructor, it works fine. But if I use the SetString method, I get the broken text.

Edit:: This is due to the default font not supporting the character size of 16 I guess? What sizes does it support?

12
Graphics / SFML 2.0 - Missing letters when drawing sf::Text
« on: January 21, 2010, 04:01:07 am »
I recently switched to SFML 2.0 to see if there was a performance increase, however, I'm having trouble with my sf::Text classes. When I attempt to draw certain letters it instead just draws a space. If I print out the actual string, it prints correctly, however when I use SetString(string), the text that is drawn on the string is broken.

Is there something new with SFML 2.0 and text that I'm missing?

13
Graphics / [SOLVED] Little bit of trouble with loading from memory.
« on: December 10, 2009, 02:44:35 am »
I used that tutorial and it worked. Thanks!

14
Graphics / [SOLVED] Little bit of trouble with loading from memory.
« on: December 10, 2009, 12:11:22 am »
This is the reading method.

Code: [Select]

static char* GetBufferFromResource(char *resourcefilename, char *resourcename, int *filesize)
{
//Try to open the resource file in question
int fd = open(resourcefilename, O_RDONLY);
if (fd < 0)
{
perror("Error opening resource file");
exit(1);
}

//Make sure we're at the beginning of the file
lseek(fd, 0, SEEK_SET);

//Read the first INT, which will tell us how many files are in this resource
int numfiles;
read(fd, &numfiles, sizeof(int));
std::cout << "Number of files: " << numfiles << std::endl;

//Get the pointers to the stored files
int *filestart = (int *) malloc(sizeof(int) * numfiles);
read(fd, filestart, sizeof(int) * numfiles);
std::cout << "File starts at: " << *filestart << std::endl;

//Loop through the files, looking for the file in question
int filenamesize;
char *buffer;
int i;
for(i=0;i<numfiles;i++)
{
char *filename;
//Seek to the location
lseek(fd, filestart[i], SEEK_SET);
//Get the filesize value
read(fd, filesize, sizeof(int));
//Get the size of the filename string
read(fd, &filenamesize, sizeof(int));
//Size the buffer and read the filename
filename = (char *) malloc(filenamesize + 1);
read(fd, filename, filenamesize);
//Remember to terminate the string properly!
filename[filenamesize] = '\0';
//Compare to the string we're looking for
std::cout << "Comparing " << resourcename << " to " << filename << std::endl;
if (strcmp(filename, resourcename) == 0)
{
//Get the contents of the file
std::cout << resourcename << " is equal to " << filename << std::endl;
buffer = (char *) malloc(*filesize);
read(fd, buffer, *filesize);
free(filename);
break;
}
//Free the filename buffer
free(filename);
}

//Release memory
free(filestart);

//Close the resource file!
close(fd);

//Did we find the file within the resource that we were looking for?
if (buffer == NULL)
{
printf("Unable to find '%s' in the resource file!\n", resourcename);
exit(1);
}

//Return the buffer
return buffer;
}

15
Graphics / [SOLVED] Little bit of trouble with loading from memory.
« on: December 09, 2009, 11:30:53 pm »
It's definitely corrupting the image.

This is the code that packs the .dat file.

Code: [Select]

void packfile(char *filename, int fd) {
 
int totalsize = 0; //This integer will be used to track the total number of bytes written to file
 
//Handy little output
printf("PACKING: '%s' SIZE: %i\n", filename, getfilesize(filename));
 
//In the 'header' area of the resource, write the location of the file about to be added
lseek(fd, currentfile * sizeof(int), SEEK_SET);
write(fd, &currentloc, sizeof(int));
 
//Seek to the location where we'll be storing this new file info
lseek(fd, currentloc, SEEK_SET);
 
//Write the size of the file
int filesize = getfilesize(filename);
write(fd, &filesize, sizeof(filesize));
totalsize += sizeof(int);
 
//Write the LENGTH of the NAME of the file
int filenamelen = strlen(filename);
write(fd, &filenamelen, sizeof(int));
totalsize += sizeof(int);
 
//Write the name of the file
write(fd, filename, strlen(filename));
totalsize += strlen(filename);
 
//Write the file contents
int fd_read = open(filename, O_RDONLY); //Open the file
char *buffer = (char *) malloc(filesize); //Create a buffer for its contents
read(fd_read, buffer, filesize); //Read the contents into the buffer
write(fd, buffer, filesize); //Write the buffer to the resource file
close(fd_read); //Close the file
free(buffer); //Free the buffer
totalsize += filesize; //Add the file size to the total number of bytes written
 
//Increment the currentloc and current file values
currentfile++;
currentloc += totalsize;
}


Is there something wrong with this code?

Pages: [1] 2
anything