1
Window / Re: Beakpoint in visual studio
« on: August 22, 2015, 07:08:40 pm »
Yes it stopped at a breakpoint. I trying remove breakpoint first but it's not working
My Ball class
and Rectangle class
It's really so bad? I trying share it to more classes , but i had problems with it, now at least working.
First i want fix problem with random_balls function, but i waiting for any suggestion. I should not using global variables and namespaces ? And what is wrong with vector but i dont undestand ?
My Ball class
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include "BallShape.h"
using namespace sf;
class Ball
{
public:
Ball(RenderWindow&);
Ball();
void set_Position(float, float);
void set_OutlineColor(Color);
void draw_Ball();
void set_Color(Color, Color);
void set_Thickness();
void set_Radius(float);
void Move(float, float);
const sf::Vector2f& Ball::get_Position() const;
float get_Radius();
void set_String(String);
void set_CharacterSize(int);
void set_Font(Font &);
void set_Scale(float, float);
void set_CharacterPosition(float, float);
private:
CircleShape Circley;
RenderWindow& Render;
Text txt;
};
Ball::Ball(sf::RenderWindow& app) : Render(app)
{
}
void Ball::set_Position(float x, float y )
{
Circley.setPosition(x, y);
}
void Ball::set_OutlineColor(Color color)
{
Circley.setOutlineColor(color);
}
void Ball::set_Thickness()
{
Circley.setOutlineThickness(5);
}
void Ball::set_Color(Color ball, Color text)
{
Circley.setFillColor(ball);
txt.setColor(text);
}
void Ball::draw_Ball(){
Render.draw(Circley);
Render.draw(txt);
}
void Ball::set_Radius(float radius)
{
Circley.setRadius(radius);
}
void Ball::set_Scale(float x, float y)
{
Circley.setScale(x, y);
}
void Ball::Move(float x, float y)
{
Circley.move(x, y);
txt.move(x, y);
}
const sf::Vector2f& Ball::get_Position() const
{
return Circley.getPosition();
}
float Ball::get_Radius()
{
return Circley.getRadius();
}
void Ball::set_String(String number)
{
txt.setString(number);
}
void Ball::set_CharacterSize(int size)
{
txt.setCharacterSize(size);
}
void Ball::set_Font(Font &fon)
{
txt.setFont(fon);
}
void Ball::set_CharacterPosition(float x, float y)
{
txt.setPosition(x, y);
}
#include <SFML/Window.hpp>
#include "BallShape.h"
using namespace sf;
class Ball
{
public:
Ball(RenderWindow&);
Ball();
void set_Position(float, float);
void set_OutlineColor(Color);
void draw_Ball();
void set_Color(Color, Color);
void set_Thickness();
void set_Radius(float);
void Move(float, float);
const sf::Vector2f& Ball::get_Position() const;
float get_Radius();
void set_String(String);
void set_CharacterSize(int);
void set_Font(Font &);
void set_Scale(float, float);
void set_CharacterPosition(float, float);
private:
CircleShape Circley;
RenderWindow& Render;
Text txt;
};
Ball::Ball(sf::RenderWindow& app) : Render(app)
{
}
void Ball::set_Position(float x, float y )
{
Circley.setPosition(x, y);
}
void Ball::set_OutlineColor(Color color)
{
Circley.setOutlineColor(color);
}
void Ball::set_Thickness()
{
Circley.setOutlineThickness(5);
}
void Ball::set_Color(Color ball, Color text)
{
Circley.setFillColor(ball);
txt.setColor(text);
}
void Ball::draw_Ball(){
Render.draw(Circley);
Render.draw(txt);
}
void Ball::set_Radius(float radius)
{
Circley.setRadius(radius);
}
void Ball::set_Scale(float x, float y)
{
Circley.setScale(x, y);
}
void Ball::Move(float x, float y)
{
Circley.move(x, y);
txt.move(x, y);
}
const sf::Vector2f& Ball::get_Position() const
{
return Circley.getPosition();
}
float Ball::get_Radius()
{
return Circley.getRadius();
}
void Ball::set_String(String number)
{
txt.setString(number);
}
void Ball::set_CharacterSize(int size)
{
txt.setCharacterSize(size);
}
void Ball::set_Font(Font &fon)
{
txt.setFont(fon);
}
void Ball::set_CharacterPosition(float x, float y)
{
txt.setPosition(x, y);
}
and Rectangle class
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <iostream>
using namespace std;
using namespace sf;
class Rectangle
{
public: Rectangle(RenderWindow& );
void set_Position(int, int);
void draw_Rectangle();
void set_Thickness(float);
void set_Size(float, float);
private:
RectangleShape rectangle;
RenderWindow& Render;
};
Rectangle::Rectangle(sf::RenderWindow& app) : Render(app)
{
rectangle.setOutlineColor(Color::Red);
rectangle.setOutlineThickness(2);
}
void Rectangle::set_Position(int x, int y)
{
rectangle.setPosition(x, y);
}
void Rectangle::set_Thickness(float thic)
{
rectangle.setOutlineColor(Color::Red);
rectangle.setOutlineThickness(thic);
}
void Rectangle::set_Size(float length, float height)
{
rectangle.setSize(Vector2f(length, height));
}
void Rectangle::draw_Rectangle(){
Render.draw(rectangle);
}
#include <SFML/Window.hpp>
#include <iostream>
using namespace std;
using namespace sf;
class Rectangle
{
public: Rectangle(RenderWindow& );
void set_Position(int, int);
void draw_Rectangle();
void set_Thickness(float);
void set_Size(float, float);
private:
RectangleShape rectangle;
RenderWindow& Render;
};
Rectangle::Rectangle(sf::RenderWindow& app) : Render(app)
{
rectangle.setOutlineColor(Color::Red);
rectangle.setOutlineThickness(2);
}
void Rectangle::set_Position(int x, int y)
{
rectangle.setPosition(x, y);
}
void Rectangle::set_Thickness(float thic)
{
rectangle.setOutlineColor(Color::Red);
rectangle.setOutlineThickness(thic);
}
void Rectangle::set_Size(float length, float height)
{
rectangle.setSize(Vector2f(length, height));
}
void Rectangle::draw_Rectangle(){
Render.draw(rectangle);
}
It's really so bad? I trying share it to more classes , but i had problems with it, now at least working.
First i want fix problem with random_balls function, but i waiting for any suggestion. I should not using global variables and namespaces ? And what is wrong with vector but i dont undestand ?