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

Pages: [1]
1
Graphics / Trying to load glitched JPG file causes access violation
« on: April 09, 2015, 01:00:03 am »
Yo,

So basically I was messing around with some JPEG-glitching. I changed some bytes between the end of the JPEG header and EOF and tried to display the new image, but encountered access violations. Sometimes the image loading would work, sometimes it would not, and I can't figure out when and why. :(

This is a glitched image that makes the application throw an exception:


Here is a minimal example:

#include <SFML\Graphics.hpp>

int main() {

        sf::RenderWindow window(sf::VideoMode(800, 600), "G-Glitch", sf::Style::Close);
        sf::Texture tex; tex.loadFromFile("newpic.jpg");

        sf::Sprite spr(tex);

        sf::Event event;
        while(window.isOpen()) {
                while(window.pollEvent(event)) {
                        switch(event.type) {
                        case sf::Event::Closed:
                                window.close();
                                break;
                        }
                }

                window.clear();
                window.draw(spr);
                window.display();
        }

        return 0;
}
 

The weird thing is that the image displays just fine in my browser and native image viewer.. Can someone please explain this phenomenon?

I'm not linking debug code with release libraries or vice versa. I've been using SFML for a couple of years now. ;^)

~BZep

EDIT!:
Here is the original picture to actually prove that the other particular picture is causing misfits:


2
SFML projects / [LD48 #31] Owl'd Hurricrash
« on: December 19, 2014, 10:25:16 pm »
Late forum submission but what the hell. ;)

Found the time to compete in the Ludum Dare 31, so I conjured up a game with SFML:





I highly recommend playing the PostJam version
The goal of the game is to stay alive for as long as possible. Your energy is displayed on the orange bar and can be replenished by eating fish (in the water). Score is accumulated when you return to your nest.


The game is written in C++ with Visual Studio 2013 (C++11) and SFML 2.1. Lots of elements from the SFML Game Development Book are included, like the State Machine, Resource Loading and Sound Player. I've also built the game on top of my SFML extension: bzsf.


Links:
- Owl'd Hurricrash on LD
- bzsf on GitHub
- PostJam source

3
Graphics / Why is sf::Drawable::draw() private?
« on: December 18, 2014, 01:56:54 pm »
I'm trying to extend the sf::Sprite class with some magic functionality before the derived sf:: Sprite::draw() call, while still allowing the window.draw(drawable) type of call, but it seems almost impossible due to the access modifier on draw() being private and not protected. Of course I could  contain an instance of sf::Sprite within my custom class, but I don't want to forward all calls to this instance.

Generally I've been told that making virtual functions protected and not private is a good code style, as having to call the original function within the derived is often a desired functionality. What is the reasoning behind not doing it here?

~BZep

Pages: [1]