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

Pages: [1]
1
General / Re: Stack around the variable was corrupted
« on: February 17, 2013, 06:34:13 pm »
Why do you create a new local sf::RectangleShape named player in the Movement contructor that you never use? You probably wanted to use the member variable named player, since it's the one you want to draw.

Ok thanks, i'm pretty bad at this stuff lol

2
General / Re: Stack around the variable was corrupted
« on: February 17, 2013, 04:24:55 pm »
O_o
This is going to be my entire program then...

Movement.h
#include <SFML/Graphics.hpp>
#include <iostream>
#include <SFML/Audio.hpp>

#pragma once
class Movement
{
public:
        Movement(void);
        sf::RectangleShape player;
        ~Movement(void);
       
private:
        float gravity;
};
 

Movement.cpp
#include "Movement.h"
#include <SFML/Graphics.hpp>
#include <iostream>
#include <SFML/Audio.hpp>

Movement::Movement()
{
        sf::RectangleShape player(sf::Vector2f(40.f, 40.f));
        player.setOrigin(20.f, 20.f);
        player.setPosition(400.f, 40.f);
        player.setFillColor(sf::Color(10, 30, 180));

        float gravity = 980;
}
 

main.cpp
#include "Movement.h"
#include <SFML/Graphics.hpp>
#include <iostream>
#include <SFML/Audio.hpp>

int main()
{
        Movement MovementObj;
        //Movement *MovementObj2 = new Movement;

        sf::RenderWindow window(sf::VideoMode(800,600,32),"Winston the Fancy Dinosaur");

    // Limit frame-rate
    window.setFramerateLimit(60);

    // Keep track of the frametime
    sf::Clock frametime;

    // Big floor
    sf::RectangleShape floor(sf::Vector2f(800.f, 40.f));
    floor.setPosition(0.f, 560.f);
    floor.setFillColor(sf::Color(10, 180, 30));

    // Small box
    sf::RectangleShape box(sf::Vector2f(40.f, 40.f));
    box.setPosition(500.f, 480.f);
    box.setFillColor(sf::Color(10, 180, 30));

    while(window.isOpen())
    {
        // Get delta time for frame-rate depended movement
        float dt = frametime.restart().asSeconds();

        // Event handling
        sf::Event event;
        while(window.pollEvent(event))
        {
            if(event.type == sf::Event::Closed)
                        {
                window.close();
                }
                }

        // Render
        window.clear();
                //window.draw(MovementObj.player);
        window.draw(box);
        window.draw(floor);
        window.display();
    }
}
 

That is all my program is now, still get the error

3
General / Re: Stack around the variable was corrupted
« on: February 17, 2013, 03:58:46 pm »
Ok this is the movement constructor

#include "Globals.h"
#include "EnemiesPlayer.h"
#include "Levels.h"
#include "LevelObjects.h"
#include "Movement.h"
#include <SFML/Graphics.hpp>
#include <iostream>
#include <SFML/Audio.hpp>

Movement::Movement()
{
        sf::RectangleShape player(sf::Vector2f(40.f, 40.f));
        player.setOrigin(20.f, 20.f);
    player.setPosition(400.f, 40.f);
    player.setFillColor(sf::Color(10, 30, 180));

        float gravity = 980;
}
 


And this is main
#include "Globals.h"
#include "EnemiesPlayer.h"
#include "Levels.h"
#include "LevelObjects.h"
#include "Movement.h"
#include <SFML/Graphics.hpp>
#include <iostream>
#include <SFML/Audio.hpp>

int main()
{
        Movement MovementObj;
        //Movement *MovementObj2 = new Movement;

        sf::RenderWindow window(sf::VideoMode(800,600,32),"Winston the Fancy Dinosaur");

    // Limit frame-rate
    window.setFramerateLimit(60);

    // Keep track of the frametime
    sf::Clock frametime;

    // Big floor
    sf::RectangleShape floor(sf::Vector2f(800.f, 40.f));
    floor.setPosition(0.f, 560.f);
    floor.setFillColor(sf::Color(10, 180, 30));

    // Small box
    sf::RectangleShape box(sf::Vector2f(40.f, 40.f));
    box.setPosition(500.f, 480.f);
    box.setFillColor(sf::Color(10, 180, 30));

    while(window.isOpen())
    {
        float dt = frametime.restart().asSeconds();

        // Event handling
        sf::Event event;
        while(window.pollEvent(event))
        {
            if(event.type == sf::Event::Closed)
                        {
                window.close();
                }
                }

        // Render
        window.clear();
        //window.draw(MovementObj.player);
        window.draw(box);
        window.draw(floor);
        window.display();
    }
}
 

4
General / Stack around the variable was corrupted
« on: February 17, 2013, 03:40:53 pm »
I can't get rid of this error I'm having so I was hoping someone could help. The error is "Stack around the variable 'player' is corrupted". This is the player variable that I created in Movement's constructor:

    sf::RectangleShape player(sf::Vector2f(40.f, 40.f));
    player.setOrigin(20.f, 20.f);
    player.setPosition(400.f, 40.f);
    player.setFillColor(sf::Color(10, 30, 180));

That does not cause the error, the error comes up when I make the movement object in main, like this:

Movement MovementObj1;

So can anyone help?

5
I installed VS2010, and gave my VS2012 project a desperation run, and it worked. Thanks

6
Ok, so do I need to use Visual Studio 2010, or what do you mean by recompiling SFML?

7
I got SFML 2.0 from the website, and I'm fairly sure everything is correct in the project properties, because my laptop has the exact same project configuration and runs SFML fine.

8
So I have been trying to get this to work for ages. I have Windows 8 and Visual Studio 2012 Ultimate. I get this error: 

The program can't start because msvcp100d.dll is missing from your computer

This error occurs whenever I run a program with SFML code inside of it. If I have a program setup to link to SFML, but I don't use SFML code in the program, it runs fine. If I used ANY code related to SFML (like #include <SFML/Graphics.hpp>), I get the error. I have a laptop with windows 7 and Visual Studio 2012 Ultimate , and with the same project properties it runs fine with SFML.

I really am stumped on this :(

9
Window / Help with mouse clicks?
« on: January 12, 2013, 11:52:33 pm »
So I want to have a window that has three buttons that can be pressed, using the mouse, and depending on which button is pressed, the window changes. I have no idea how to do this,  could someone please help? Here is an example:

#include "stdafx.h"
#include <SFML/Graphics.hpp>
#include <iostream>
#include <SFML/Audio.hpp>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>

sf::Texture mainMenu;
mainMenu.loadFromFile("menu1.jpg");
sf::Sprite menu1(mainMenu);                 //This loads an image with three buttons to be pressed
sf::RenderWindow window(sf::VideoMode(800,600,64),"Help me D:");
sf::Event event1;
window.clear();
window.draw(menu1);
window.display();

int _tmain(int argc, _TCHAR* argv[])
{
      while(window.isOpen())
      {
      while(window.pollEvent(event1))
      {
         if (event1.type == sf::Event::Closed)
         {
            window.close();
         }
                        if(//mouse is pressed at a certain spot) //THIS IS WHERE IM CONFUSED
                        {
                                  // Do some stuff................
                        }
               }
     }
}

Thanks for any help

Pages: [1]
anything