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
16
Graphics / Re: texture with VertexArray
« on: June 05, 2017, 11:08:45 pm »
Hapax,
 Thanks, I fixed my earlier post.

 Not sure what you mean by "it only represents a single colour from that
 texture".   Does it only applies 1 color to 1 Point?

 My array of Points is declared as sf::VertexArray edges; but I don't see
 any way to assign texture coordinates to "edges".

jerryd

17
Graphics / Re: texture with VertexArray
« on: June 05, 2017, 08:11:07 pm »
eXpl0it3r,
 I'm relatively new to SFML so I first wrote the same program using "quad"
 and the texture worked.

 Next I wanted to find out if it would also work with Points so I could
 texture any irregular shape.

 If texture won't work with Points it seems like there should have been
 some compile or run time "error" message.

 Is there any way to do it?

Thanks,
jerryd

18
Graphics / Re: texture with VertexArray
« on: June 05, 2017, 07:06:59 pm »
SFML forum,

 Windows 7 Professional 64 bit,   SFML Version 10.0.4,   mingw-w64


 Here's my code and any texture file should work for testing since
 I know mine works because I've used it with other programs.

#include <SFML/Graphics.hpp>
#include <iostream>
#define XSIZE 600
#define YSIZE 600

class BOX
{
public:
    BOX(unsigned int count) :
    edges(sf::Points, count){}
    ~BOX() {}
   
    sf::VertexArray edges;
    int l, cx, cy;
   
    void load_edges()
    {
        int i; int x = cx-l; int y = cy-l;
        for(i = 0; i<l*2;  i++)
        {edges[i].position = sf::Vector2f(x++,y);}

        for(; i<l*4;  i++)
        {edges[i].position = sf::Vector2f(x,y++);}

        for(; i<l*6;  i++)
        {edges[i].position = sf::Vector2f(x--,y);}

        for(; i<l*8;  i++)
        {edges[i].position = sf::Vector2f(x,y--);}
    }

    void assign_variables(int x, int y, int z)
    {cx = x; cy = y; l  = z;}
   
};


int main()
{
    BOX box(400);
    box.assign_variables(XSIZE/2, YSIZE/2, 50);

    sf::Texture texture;
    if (!texture.loadFromFile("C:/users/Jerry/Desktop/sprites/concrete.jpg"))
    {std::cout << " Error loading concrete texture" << std::endl; system("pause");}
   
    sf::RenderWindow window(sf::VideoMode(XSIZE, YSIZE), "BOX");
    box.load_edges();
    sf::Event event;  
    while(window.isOpen())
    {
        while (window.pollEvent(event))
        { if(event.type == sf::Event::Closed) {window.close();} }

        window.draw(box.edges, &texture);
        window.display();
        window.clear();
    }
        return 0;
}
 

jerryd

19
Graphics / Re: texture with VertexArray
« on: June 05, 2017, 06:27:40 pm »
eXplOit3r,
 Thanks for the reply.

 I have created a "Minimal, Complete, and Verifiable" example.
 Is there a place I can upload it or is there a way to I attach it
 or do I just put all the code in the post?

 Also to run it you would need the texture file.

jerryd

20
Graphics / [SOLVED] texture with VertexArray
« on: June 04, 2017, 06:59:52 am »
SFML forum,
 
 window.draw(edges, &texture);
 Program compiles and runs but the texture is never applied to the VertexArray "edges".

 I have successfully used this texture before on a quad.  The only difference is this quad is made with Points.

 I didn't know how to attach the program.

Any suggestions?
jerryd

21
General / Linking Problem with SFML/Visual Studio
« on: May 24, 2017, 04:47:10 am »
SFML forum,

 SFML 2.4.2   Visual Studio 2017

 I'm trying to link SFML to Visual Studio. I have followed all the
 steps in https://www.sfml-dev.org/tutorials/2.4/start-vc.php.
 Everything links and compiles until I put this line in my program:

 sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");

 Then I get errors like:

 Error LNK2019 unresolved external symbol "public: __thiscall
 sf::String::String(char const *,class std::locale const &)"
 (??0String@sf@@QAE@PBDABVlocale@std@@@Z) referenced in function _main
 unresolved external symbol "public:_thiscall sf::VideoMode::VideoMode(
 unsigned int,unsigned)

 Note that the line #include <SFML/Graphics.hpp> causes no errors.

 Must be a linking error but I have double checked everything and
 SFML_STATIC is assigned.

Any suggestions?
jerryd



22
General / Re: Missing libraries
« on: May 08, 2017, 01:34:30 am »
Hapax,
 Thanks for the reply.

 I am not familiar with CMAKE so I read all about it and I still
 don't understand what it will do for my problem.  It isn't a
 compiler so will it make the files I'm missing?

 I don't have the full MS Visual Studio just MS Visual C++ 2010.

 Any suggestions?

Jerryd

23
General / Missing libraries
« on: May 06, 2017, 11:32:28 pm »
SFML forum,
 I have been using SFML-2.4.0 with CodeLite and Code::Blocks for some
 time and am now trying to set up MS Visual C++ to use it.  The problem
 is MSVC wants me to include "sfml-graphics.lib" and other similar
 libraries but I don't have those.  Where or how do I get them?

Jerryd

24
Window / Re: Window won't stay open
« on: October 27, 2016, 08:54:29 pm »

 OK I'll reinstall everything.

 There are 2 choices at sfml-dev.org
 GCC 4.9.2 TDM(SJLJ) - 64-bit
 GCC 6.1.0 MinGW(SEH) - 64-bit

 Would either work or would you recommend a specific one?



25
Window / Re: Window won't stay open
« on: October 27, 2016, 06:44:52 pm »

 Pretty sure I copied all the correct .dll files to the Debug folder.
 The only difference is the tutorial suggested the libgcc_S_sjlj-1.dll
 with an upper case 'S"  but the actual one in the bin folder had a
 lower case 's' libgcc_s_sjlj-1.dll.

 How do I get the compiler versions to match?

 I don't really know how the compiler and the SFML relate to each other.

Jerry D.

26
Window / Re: Window won't stay open
« on: October 27, 2016, 05:54:42 pm »
eXpl0it3r,

 Ran your suggested command and it yielded "gcc version 5.1.0 (tdm64-1)"

Thanks,
Jerry D.

27
Window / Re: Window won't stay open
« on: October 27, 2016, 07:45:21 am »
dabbertorres,
 Thanks for the reply.

 Don's see a version for the compiler. The folder size is 348MB.

 I just downloaded pre-built SFML files.

Jerry D.

28
Window / Window won't stay open
« on: October 27, 2016, 06:11:51 am »
SFML forum,
 Windows 7,  CodeLite 9.2.5, TDM-GCC-64,  SFML-2.3.1

 As soon as a window opens my program exits with the message:
 "SFML-Demo has stopped working"

 No error messages from the compiler.
 Here's the code:

#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "My Window");
   
    while (window.isOpen())
    {
        sf::Event event;
       
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
            {
                window.close();
            }
        }
       
        window.display();
    }
}

 Any suggestions?

Jerry D.

29
General / Re: pollEvent problem
« on: May 28, 2013, 05:04:29 pm »
Kralo9,

 Thanks for the reply.

 I don't quite understand your suggestion yet.
 Here is the exact function I call from the main()

int getKey(sf::RenderWindow* screen)
{
   do {
      sf::Event event;
      if(screen->pollEvent(event)) {
         if(event.type == event.KeyPressed) {

            if (event.key.code == sf::Keyboard::Num1) {return 1;}
            if (event.key.code == sf::Keyboard::Num2) {return 2;}
            if (event.key.code == sf::Keyboard::Num3) {return 3;}
            if (event.key.code == sf::Keyboard::Num4) {return 4;}
         }
      }
   } while(1);

   return 0;
} // end int getKey(sf::RenderWindow* screen)

 I call this event many times.
 How should I change it?

 The other pollEvent function is very similar.

jerryd

30
General / pollEvent problem
« on: May 28, 2013, 04:25:06 am »
SFML forum,

 SFML 2.0  Visual c++ 2010

 I can take in keys pressed with a pollEvent in my main() successfully.

 But when I call a function that does another pollEvent to check keys pressed it always gets the last key typed from the pollEvent in the main().
  If I call the function without doing the pollEvent in main()  there is no key in the stdin buffer.

 I have read and tried all the methods for clearing the stdin buffer but none has worked.

 Any suggestions?

jerryd

Pages: 1 [2] 3 4
anything