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

Pages: [1]
1
Network / ftp connect works on some machines but not others
« on: July 31, 2014, 07:58:17 am »
Hi I'm a newbie to ftp and I'm having trouble connecting to an ftp server using sf::Ftp. I can access the ftp server through an internet browser and other ftp applications. 

I did get it working on one machine when I removed the initial "ftp://" from the URL as shown in the example below.    Curiously, connect does not timeout but returns almost instantly.  The response code is 1001 (connection failed).   Note, I have also tried to use the TCP IP address (IpAddress(xx,xx,xx,xx)) but it also fails, so I think it has something to do with the ftp server properties but I'm not sure what? Any ideas?

sf::Ftp ftp;
sf::Ftp::Response response = ftp.connect("ftp://ftp.a-tune.org");
unsigned int status = response.getStatus();
 

BTW, I'm using SFML 2.1, Visual Studio C++ 2010, Windows XP and 7


2
Window / Cant get TGUI to adjust mouse coords when using a Viewport
« on: April 05, 2014, 03:15:16 am »
Hi
I'm having a problem with TGUI not adjusting mouse coordinates (responding to button events) when using sf::setViewport, but only on certain machines (windows 7 1366x768).  Note, I have looked at  Topic: Incorrect window mouse coords generated after window resize event but did not find it helpful as it relates to an older version of TGUI )I'm using TGUI-0.6.2). 
I'm trying to display a 1280x1024 picture widget with a button on a 1366x768 sized screen.  Using sf::setView I can get the picture to display correctly (i.e., resized to 1024x768 and positioned in the center of the screen, see newW and displace in minimum code below), but mouse coords are not converted (i.e., pressing the button does not trigger any events, but when I move the mouse pointer to actual screen corrds corresponding to non-resized button coords, I can press the button). 

Below is the minimum code. It works fine when simulating different screen sizes, or different view sizes, on some machines?  Is this a bug or do I have to tell tgui to use resized (viewport) coords?


#include <SFML/Graphics.hpp>
#include <TGUI/TGUI.hpp>
#include <windows.h>

int WINAPI WinMain(HINSTANCE instance, HINSTANCE, LPSTR, INT)
{
   // Initialise SFML Render Window
   int   SWidth, SHeight;

   SWidth = GetSystemMetrics(SM_CXSCREEN);      // Problem machine has SWidth = 1366
   SHeight = GetSystemMetrics(SM_CYSCREEN);   //               and SHeight = 768

   // Create Render Window
   sf::RenderWindow window(sf::VideoMode(SWidth,SHeight), "Test", sf::Style::Fullscreen);

   // Determine Viewport size for View = 1280x1024
   float newW = (float)((SHeight*SWidth)/1024);   // For SWidth = 1366, newW = 1024
   float displace = (float)((SWidth-newW)/2);      

   sf::View      SView;  
   // Set view = 1280x1024
   SView.reset(sf::FloatRect(0, 0, 1280, 1024));  
   // Set viewport
   SView.setViewport(sf::FloatRect(displace/SWidth, 0, newW/SWidth, 1.0f));
   window.setView(SView);

   // Create GUI
   tgui::Gui gui(window);

   if (gui.setGlobalFont("../../Fonts/DejaVuSans.ttf") == false)
      return(false);

   // Load an 1280x1024 size form and button
   if (!gui.loadWidgetsFromFile("form.txt"))
      return(false);

   while (window.isOpen())
   {
        sf::Event event;

        while (window.pollEvent(event))
      {
            if (event.type == sf::Event::Closed)
         {
                window.close();
            }
         else if (event.type == sf::Event::KeyPressed)
         {
            switch (event.key.code)
            {
               case sf::Keyboard::Escape:
                  window.close();
                  break;
            }
         }

         gui.handleEvent(event);
        }

     tgui::Callback callback;
     while (gui.pollCallback(callback))
     {
           // Do event handler for gui here
     }
                   
      window.clear();
      gui.draw(false);
      window.display();
   
    }
   return(0);
}

Pages: [1]
anything