Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Pointer error [Fixed] by : Hapax  (Read 1521 times)

0 Members and 1 Guest are viewing this topic.

terrifiedobama

  • Newbie
  • *
  • Posts: 13
  • Hi, i am eager to learn SFML.
    • AOL Instant Messenger - Skype+:+live:mohasmedec
    • View Profile
    • https://www.google.bg/search?ei=fSI7XdixF6PuxgOC64iwCA&q=Chicken+fight&oq=Chicken+fight&gs_l=psy-ab.3..0l10.2406.2677..2783...0.0..0.92.181.2......0....1..gws-wiz.......0i71.bzIU-zC-Thw&ved=0ahUKEwiY5JaY-dLjAhUjt3EKHYI1AoYQ4dUDCAo&uact
    • Email
Pointer error [Fixed] by : Hapax
« on: June 26, 2019, 10:15:52 pm »
i need help, i've been stuggling since 1 day figure this out
◘◘◘◘Halp plox, i've been Stuggling for (3) {days} trying to figure this out◘◘◘◘

whenever i try to write 
for (int t = 0;t <= 5;t++) {
      PlayerSprite.move(sf::Vector2f(0,0.1));
      if (PlayerSprite.getGlobalBounds().intersects(Tile001Sprite.getGlobalBounds)) {
         std::cout << "tes" << std::endl;
      }

   }
the following error is : Severity   Code   Description   Project   File   Line   Suppression State
Error   C3867    'sf::Sprite::getGlobalBounds': non-standard syntax; use '&' to create a pointer to member   


ive been stuggling alot if someone can help me i will apriciate it alot  :-[


i cant write the PlayerSprite i dont understand what does this pointer & mean like where should i put it like i dont understand im mega confused im really confused.
« Last Edit: June 27, 2019, 08:55:30 pm by terrifiedobama »
Guys my name's Boris. I'm 22 year old and I want to tell you that I'm happy to join your community. I hope we can learn together , or learn each other.
If you want to get to know me or help me or help you contact me, the following below is the INFORMATION..
@@@@@@@@
Skype : live:mohasmedec
@@@@@@@@

fallahn

  • Sr. Member
  • ****
  • Posts: 476
  • Buns.
    • View Profile
    • Trederia
Is that the only place you use getGlobalBounds() ? I can't see the line numbers in the image to see if you're looking at the line mentioned in the error. This error usually means you forgot to put the () at the end of a function call (and confuses it with a malformed function pointer).

Arcade

  • Full Member
  • ***
  • Posts: 230
    • View Profile
Quote
if (PlayerSprite.getGlobalBounds().intersects(Tile001Sprite.getGlobalBounds)) {

terrifiedobama

  • Newbie
  • *
  • Posts: 13
  • Hi, i am eager to learn SFML.
    • AOL Instant Messenger - Skype+:+live:mohasmedec
    • View Profile
    • https://www.google.bg/search?ei=fSI7XdixF6PuxgOC64iwCA&q=Chicken+fight&oq=Chicken+fight&gs_l=psy-ab.3..0l10.2406.2677..2783...0.0..0.92.181.2......0....1..gws-wiz.......0i71.bzIU-zC-Thw&ved=0ahUKEwiY5JaY-dLjAhUjt3EKHYI1AoYQ4dUDCAo&uact
    • Email
this is the full code...........
----------------------------------


#include <SFML/Graphics.hpp>
#include <iostream>
int main()
{
   sf::RenderWindow Window(sf::VideoMode(800, 600), "My window" , sf::Style::Close);
   
   Window.setTitle("NULL Title");
   sf::Vector2u size = Window.getSize();
   unsigned int Width = size.x;
   unsigned int Height = size.y;
   Window.setSize(sf::Vector2u(999,777));
   Window.setPosition(sf::Vector2i(300,20));
   sf::WindowHandle handle = Window.getSystemHandle();
   Window.setVerticalSyncEnabled(true);
   //window.setFramerateLimit(60);
   sf::Event event;
   
   sf::Texture textureone;
   sf::Sprite spriteone;

   sf::Texture texturetwo;
   sf::Sprite spritetwo;

   
   while (Window.isOpen()) {
      sf::Event event;
      if (Window.pollEvent(event))
      {
         if (event.type == sf::Event::Closed || event.key.code == sf::Keyboard::Escape)
            Window.close();

      
      }

      Window.display();


      if (!textureone.loadFromFile("hs.png", sf::IntRect(111,111,111,111))) {
         std::cout << "nope" << std::endl;
      }
      //else
         //(std::cout << "yes" << std::endl);
      spriteone.setTexture(textureone);
      if (!texturetwo.loadFromFile("hs2.png", sf::IntRect(111, 111, 111, 111))) {
         std::cout << "nope2" << std::endl;
      }
      spritetwo.setTexture(texturetwo);

      //spritetwo.setPosition(sf::Vector2f(333,333));


      if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right)) {
         spritetwo.move(3,0);
      }
      if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left)) {
         spritetwo.move(-3, 0);
      }
      if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down)) {
         spritetwo.move(0, 3);
      }
      if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up)) {
         spritetwo.move(0, -3);
      }



      if (spriteone.getLocalBounds().intersects(spritetwo.getGlobalBounds)) {

      }


      Window.clear(sf::Color::White);

      Window.draw(spriteone);
      Window.draw(spritetwo);


      
   }
   
   

   return 0;
}
Guys my name's Boris. I'm 22 year old and I want to tell you that I'm happy to join your community. I hope we can learn together , or learn each other.
If you want to get to know me or help me or help you contact me, the following below is the INFORMATION..
@@@@@@@@
Skype : live:mohasmedec
@@@@@@@@

terrifiedobama

  • Newbie
  • *
  • Posts: 13
  • Hi, i am eager to learn SFML.
    • AOL Instant Messenger - Skype+:+live:mohasmedec
    • View Profile
    • https://www.google.bg/search?ei=fSI7XdixF6PuxgOC64iwCA&q=Chicken+fight&oq=Chicken+fight&gs_l=psy-ab.3..0l10.2406.2677..2783...0.0..0.92.181.2......0....1..gws-wiz.......0i71.bzIU-zC-Thw&ved=0ahUKEwiY5JaY-dLjAhUjt3EKHYI1AoYQ4dUDCAo&uact
    • Email
i still get that pointer error :@ :(
Guys my name's Boris. I'm 22 year old and I want to tell you that I'm happy to join your community. I hope we can learn together , or learn each other.
If you want to get to know me or help me or help you contact me, the following below is the INFORMATION..
@@@@@@@@
Skype : live:mohasmedec
@@@@@@@@

Hapax

  • Hero Member
  • *****
  • Posts: 3075
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
getGlobalBounds should be getGlobalBounds()

getGlobalBounds() is the method call. getGlobalBounds is the address of that method.
« Last Edit: June 27, 2019, 08:29:47 pm by Hapax »
Selba Ward - SFML drawables
Kairos - Timing Library
Rectangular Boundary Collision - Rectangular SAT Collision

Hapaxia Links

terrifiedobama

  • Newbie
  • *
  • Posts: 13
  • Hi, i am eager to learn SFML.
    • AOL Instant Messenger - Skype+:+live:mohasmedec
    • View Profile
    • https://www.google.bg/search?ei=fSI7XdixF6PuxgOC64iwCA&q=Chicken+fight&oq=Chicken+fight&gs_l=psy-ab.3..0l10.2406.2677..2783...0.0..0.92.181.2......0....1..gws-wiz.......0i71.bzIU-zC-Thw&ved=0ahUKEwiY5JaY-dLjAhUjt3EKHYI1AoYQ4dUDCAo&uact
    • Email
Tnx bro im new to coding
im very stupid sorry
big tnx bro
Guys my name's Boris. I'm 22 year old and I want to tell you that I'm happy to join your community. I hope we can learn together , or learn each other.
If you want to get to know me or help me or help you contact me, the following below is the INFORMATION..
@@@@@@@@
Skype : live:mohasmedec
@@@@@@@@

Hapax

  • Hero Member
  • *****
  • Posts: 3075
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Pointer error [Fixed] by : Hapax
« Reply #7 on: June 27, 2019, 10:13:28 pm »
No worries. I still get this error a lot  ;D
Selba Ward - SFML drawables
Kairos - Timing Library
Rectangular Boundary Collision - Rectangular SAT Collision

Hapaxia Links

 

anything