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

Pages: [1]
1
General / Re: How to use ANativeActivity* activity ?
« on: April 16, 2020, 05:54:20 pm »
To use it for what?

There is a built project for Android. I need to understand how to manage different OnPause state methods. I think they can only be called via Nativeactivity* activity.  ???

2
General / How to use ANativeActivity* activity ?
« on: April 16, 2020, 04:46:48 pm »
Is there any example of how to use it?  :)
Thanks.

3
Graphics / click on a sprite that is hidden
« on: March 31, 2020, 09:34:50 pm »
The problem is that the sprite is hidden, but if you click on it with the mouse , you can interact with it.How do I remove it and why is this happening? Thanks.

sf::RenderWindow window(sf::VideoMode(720, 1820), "Clock");
   Clock clock;
   Pendulum_clock clock_v1;
   sf::Time time = sf::seconds(0.01f);   
   sf::Clock simple_timer;
   int current_screen(0);

   while (window.isOpen())
   {
      sf::Event event;
      time = simple_timer.getElapsedTime();   
      
      clock_v1.pendulum_swing();

      if ((int)time.asSeconds() == 1)
      {         
         switch (current_screen)
         {
         case 0:clock.arrow_rotation();
            break;
         case 1:clock_v1.arrow_rotation();
            break;
         }
         simple_timer.restart();
      }      
      while (window.pollEvent(event))
      {                  
         if (event.type == sf::Event::MouseButtonPressed)
         {
            if (event.key.code == sf::Mouse::Left)
            {               
               sf::Vector2i get_pixel = sf::Mouse::getPosition(window);
               sf::Vector2f position = window.mapPixelToCoords(get_pixel);

               if (clock.s_clock.getGlobalBounds().contains(position))  // here
               {
                  ++current_screen;
                  if (current_screen > 1){ current_screen = 0; }
                   
                  switch (current_screen)
                  {
                  case 0:clock.initialization_by_the_system_clock(); break;
                  case 1:clock_v1.initialization_by_the_system_clock(); break;
                  }
               } 

            if (clock_v1.s_pendulum.getGlobalBounds().contains(position)) // and here
               {
                  std::cout << "click\n";
               }
            }

         }

         if (event.type == sf::Event::Closed)
            window.close();


      }
      window.clear();
      
      switch (current_screen)
      {
      case 0:window.draw(clock); break;
      case 1:window.draw(clock_v1); break;
      }
      window.display();
   }
   return 0;
}

Pages: [1]