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

Pages: 1 [2]
16
General / White window error (RESOLVED
« on: December 31, 2015, 01:54:34 pm »
Edit: I fixed it already, no need to help anymore.


Okay... I'm trying to use a .txt (Already am using a .cpp file to prevent errors) file to load a map into a game. But wen I run my code, I get blank white screen (SFML window) with which I can do nothing. I get no errors, although I did get RAM reading errors before.
#include <SFML\Graphics.hpp>
#include <SFML\System.hpp>
#include <fstream>
#include <iostream>

sf::Sprite Sprite[2];
sf::Texture grass;
sf::Texture brick;
char textChar[2];
int numCharacters = 0;
int i = 0;

sf::RenderWindow window(sf::VideoMode(512, 384), "Map testing");


int main() {   
        std::ifstream myfile("Map test.cpp");
        //Specific to my images, I know bad names...
        brick.loadFromFile("New Piskel.png");
        grass.loadFromFile("Grass_double.jpg");
        while (window.isOpen())
        {
               
                window.clear();
                if (myfile.is_open())
                {
                        while (!myfile.eof())
                        {
                                myfile >> myArray[i];
                                i++;
                                num_characters++;
                        }

                        for (i = 0; i <= num_characters;)
                        {
                                if (myArray[i] == '1') {
                                        Sprite[i].setTexture(brick);
                                        window.draw(Sprite[i]);
                                        i++;
                                }
                                if (myArray[i] == '2') {
                                        Sprite[i].setTexture(grass);
                                        Sprite[i].setPosition(64, 0); //For testing purposes
                                        window.draw(Sprite[i]);
                                        i++;
                                }
                        }
                                sf::Event event;
                                while (window.pollEvent(event))
                                {
                                        if (event.type == sf::Event::Closed)
                                                window.close();
                                }
                                window.display();
                        }
                }
        }

(Please do not comment on the lack of comments, I am aware of that)

Can someone please help me with this? The .cpp contains the text "12" and the images are 64 by 64. I really have no idea what's going wrong.

Edit: I'm using an Amd processor and Windows 10 x64.


17
Graphics / Re: Creating a partially see-through sprite
« on: November 08, 2015, 09:20:24 am »
Thanks for the help! I created a mask and that worked out fine.

18
Graphics / Creating a partially see-through sprite
« on: November 07, 2015, 04:31:04 pm »
Hi!
I'm trying to create a sprite where certain areas in the sprite are see-through. Is this possible? I can't find any other forum posts about it...
(Sorry if it's really obvious...  Newbie to SFML  :P)
Please help!

Pages: 1 [2]