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

Pages: [1] 2 3 4
1
Window / sf::RenderWindow returns NULL pointer
« on: October 04, 2020, 05:04:40 am »
SFML forum,
 Windows 7

 I'm using SFML-2.5.1 with Visual Studio 2017.
 My program builds without any errors but I get an exception thrown because
 sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
 returns a NULL pointer.  Here's the entire program:

#include <SFML\Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
   window.close();
   return 0;
}

 I must be missing something.

jerryd

2
Window / Re: Passing sheetRect to a function
« on: August 11, 2020, 08:20:06 pm »
Raynobrak,
 Definitely have the sheetRect sizes set.

 I discovered I was passing the sprite wrong.

 Didn't see a way to mark this as "Solved".

 Thanks for the reply.
jerryd

3
Window / Passing sheetRect to a function
« on: August 10, 2020, 09:15:34 pm »
SFML forum,
 I think this would related to a window problem.

 I'm using the sheetRect command successfully in the main flow of my program
 but when I pass it to a function it is grayed out and doesn't work.  The
 compiler doesn't complain and everything runs Ok.

here's the function declaration:
void drawToWindow(sf::RenderWindow &window, sf::IntRect &sheetRect);

here's the function call:
  drawToWindow(window, sheetRect);

here's the function:
void drawToWindow(sf::RenderWindow &window, sf::IntRect &sheetRect)
{
   sheetRect.top = 0;
   sheetRect.left = 0;
   suits.setTextureRect(sheetRect);
   suits.setPosition(50,1);

   window.clear(sf::Color::Green);
   window.draw(suits);
   window.draw(text);
   window.display();
}

The window commands work but not the sheetRects are grayed out?
As I stated this all works outside of the function.

jerryd

4
Graphics / rectSourceSprite out of scope
« on: August 09, 2020, 01:26:09 am »
SFML forum,

 I'm doing some sprite displaying in a function.
 I can do:
 sprite.setPosition(x,y);
 window.draw(sprite);

 but the compiler doesn't like:
 rectSourceSprite.left = 213;

 I have used all this command successfully outside of the function
 but the error message seems to indicate it's out of scope.

 I tried:
 sf::rectSourceSprite.left = 213;
 sprite.rectSourceSprite.left = 213;
 but they don't satisfy the compiler.

Any suggestions?
Jerry D


5
Window / RenderWindow Screen
« on: August 07, 2020, 07:09:18 pm »
sfml forum,
 I know there is a RenderWindow Screen command but I can't find any
 documentation about it.

 Anyone know if it's still valid and where I can read about it.

Jerry D

6
Graphics / Pixel Color
« on: July 04, 2017, 04:01:45 am »
SFML forum,

 How can I read the color of a specific pixel on the screen?

jerryd

7
 As Laurent said we need more information.

8
General / Re: [SOLVED]can't open sfml-window-d-2.dll
« on: July 04, 2017, 03:17:08 am »

 I finally got this to work.

 I did add sfml-window-d-2.dll to the project folder but I had to
 add all the dlls from SFML\bin.

jerryd

9
General / Re: can't open sfml-window-d-2.dll
« on: July 03, 2017, 05:38:54 am »
Gleade,
 Thanks for the reply but it didn't work.

jerryd

10
General / [SOLVED]can't open sfml-window-d-2.dll
« on: July 03, 2017, 04:51:37 am »
SFML forum,

 SFML 2.4.2   Visual Studio 2017

 I have one project working and have started new one.

 I can build the new project with no errors but when I try to
 run it I get the error message: "The program can't start because
 sfml-window-d-2-dll is missing".

 This dll exists in C:\SFML-2.4.0\bin and I have checked the
 properties and they are all identical to my working project.

 What am I missing?

jerryd

11
Graphics / [SOLVED]One sprite for all my objects
« on: June 24, 2017, 05:17:49 am »
SFML forum,
 
 I'm using SFML but this might be a C++ OOP question.

 I want to use a sprite from a class in all my objects:



class Sprite
{
public:
    Sprite() {};

    sf::Texture MySprite;
    sf::Sprite sprite;

    void Load_Sprite()
    {
        if(!MySprite.loadFromFile("C:/sprites/MySprite.png"))
        { cout << " Texture Loading Error" << endl; system("pause"); }
        sprite.setTexture(MySprite);
    }
};
 

 But I have go use one of the objects to load the sprite so now it
 belongs to that object.  I would like to make the sprite static so
 I only need one and use it in every object.

 Any suggestions on how to do that?
Jerryd

12
General / Re: How to load a png file for View
« on: June 15, 2017, 07:11:50 am »
eXpl0it3r,

 Thanks for the reply.

 I loaded my background as a Texture and made it a sprite

 The window size is 600,600 so I used the command:
 sf::View view(sf::Vector2f(600, 600), sf::Vector2f(300, 300));

 At one point in my program I used the command:
 view.move(100, 0);
 but nothing happened.

 How do I tie the sprite to the view?  Or do I have this all wrong?


13
General / How to load a png file for View
« on: June 15, 2017, 03:59:19 am »
SFML forum,
 I'm trying to figure out how to use View.

 I have read most of the documentation but I don't see
 how to load a png file that will be the View.  I tried to load
 it as I would a Texture but just got a compile error.

 sf::View view;
 if (!view.loadFromFile("C:/sprites/buildings.png"))
 { cout << " view Loading Error" << endl; system("pause"); }

 How do I do this?

jerryd

14
Graphics / Re: Shape Functions not working in classes.
« on: June 11, 2017, 05:38:59 am »
Bonediggerninja,

 I don't know exactly what you are trying to do but initializing the
 shapes should be done with the object not inside the class.
 
 This will compile:

#include <SFML/Graphics.hpp>
#include <SFML\System.hpp>
#include <SFML\Window.hpp>

class player {
public:
        int the = 5; //Works
        sf::Font font; //Works
        sf::RectangleShape shape;
        sf::CircleShape circle;
};
int main()
{
    player player1;
    player1.circle.setRadius(50);
    player1.shape.setSize(sf::Vector2f(50, 50));
       
}
 


15
Graphics / Re: texture with VertexArray
« on: June 06, 2017, 07:26:31 am »
Hapax,

 Thanks I get it.

 My intention is to do it at the lowest possible level(Points).

 I now plot every pixel(Point) in the box and I am able to match
 every Point in the box with the corresponding point in the texture.
 The texture is large enough that I can expand and shrink the box
 over the full size of the window.  Amazingly it seems just as fast
 as when I was just drawing the edges.

 I looked all around this page but couldn't figure out how to make this as SOLVED.

jerryd

Pages: [1] 2 3 4
anything