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

Pages: [1] 2
1
General discussions / iPhone Port (in progress)
« on: January 28, 2010, 01:18:01 am »
Is this still being worked on? No posts in months...

2
Graphics / Integrating with wxWidgets issues
« on: March 08, 2009, 09:48:54 pm »
i'm attempting to compile a _slightly_ modified wxwidgets-SFML example, and it compiles, but the SFML canvas is invisible... I modified it to get the "quit" menu bar function working under OS X 10.5, but that's it. it was invisible before I modified it, as well, so that's not the issue.

main.cpp

Code: [Select]
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////

#include <SFML/Graphics.hpp>
#include <iostream>
#include <vector>
#include <cstdlib>
#include <string>
#include <sstream>
#include <cstring>
#include <stdio.h>
#include <unistd.h>
#include <fstream>
#include "wx/wx.h"
#include "wxSFMLCanvas.hpp"


////////////////////////////////////////////////////////////
/// Custom SFML canvas
////////////////////////////////////////////////////////////
class MyCanvas : public wxSFMLCanvas
{
public :

////////////////////////////////////////////////////////////
/// Construct the canvas
///
////////////////////////////////////////////////////////////
MyCanvas(wxWindow* Parent, wxWindowID Id, const wxPoint& Position, const wxSize& Size, long Style = 0) :
wxSFMLCanvas(Parent, Id, Position, Size, Style)
{
// Load an image and assign it to our sprite
myImage.LoadFromFile("grid.png");
mySprite.SetImage(myImage);
}

private :

////////////////////////////////////////////////////////////
/// /see wxSFMLCanvas::OnUpdate
///
////////////////////////////////////////////////////////////
virtual void OnUpdate()
{
Clear(sf::Color(255, 0, 0));
}

////////////////////////////////////////////////////////////
/// Member data
////////////////////////////////////////////////////////////
sf::Image  myImage;  ///< Some image to load...
sf::Sprite mySprite; ///< Something to draw...
};


////////////////////////////////////////////////////////////
/// Our main window
////////////////////////////////////////////////////////////
class MyFrame : public wxFrame
{
public :

void MyFrame::OnMenuFileQuit(wxCommandEvent &event);

void OnMenuFileOpen(wxCommandEvent &event);
void OnMenuFileSave(wxCommandEvent &event);

////////////////////////////////////////////////////////////
/// Default constructor : setup the window
///
////////////////////////////////////////////////////////////
MyFrame() :
wxFrame(NULL, wxNewId(), wxString::FromAscii("Yeah!Edit"), wxDefaultPosition, wxSize(800, 600))
{
ThisIsExitID = 4269;
// Let's create our SFML view

// status bar
CreateStatusBar(3);
SetStatusText(wxT("Ready"), 0);;

// menu bar
m_pMenuBar = new wxMenuBar();
// File Menu
m_pFileMenu = new wxMenu();
m_pFileMenu->Append(wxID_OPEN, _T("&Open"), _T("Opens an existing file"));
m_pFileMenu->Append(wxID_SAVE, _T("&Save"), _T("Save the content"));
m_pFileMenu->AppendSeparator();
m_pFileMenu->Append(ThisIsExitID, _T("&Quit"), _T("Quit the application"));
m_pMenuBar->Append(m_pFileMenu, _T("&File"));
// About menu
m_pHelpMenu = new wxMenu();
m_pHelpMenu->Append(wxID_ABOUT, _T("&About"), _T("Shows information about the application"));
m_pMenuBar->Append(m_pHelpMenu, _T("&Help"));

SetMenuBar(m_pMenuBar);

new MyCanvas(this, wxID_ANY, wxPoint(50, 50), wxSize(700, 500));

}

protected:

DECLARE_EVENT_TABLE()

private :
wxTextCtrl *m_pTextCtrl;
wxMenuBar *m_pMenuBar;
wxMenu *m_pFileMenu;
wxMenu *m_pHelpMenu;
int ThisIsExitID;
};

// If you're doing an application by inheriting from wxApp
// be sure to change wxFrame to wxApp (or whatever component
// you've inherited your class from).
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(wxID_OPEN, MyFrame::OnMenuFileOpen)
EVT_MENU(wxID_SAVE, MyFrame::OnMenuFileSave)
EVT_MENU(4269, MyFrame::OnMenuFileQuit)
END_EVENT_TABLE()

void MyFrame::OnMenuFileOpen(wxCommandEvent &event)
{
// ...
}

void MyFrame::OnMenuFileSave(wxCommandEvent &event)
{
// ...
}

void MyFrame::OnMenuFileQuit(wxCommandEvent &event)
{
Close(false);
}


////////////////////////////////////////////////////////////
/// Our application class
////////////////////////////////////////////////////////////
class MyApplication : public wxApp
{
private :

////////////////////////////////////////////////////////////
/// Initialize the application
///
////////////////////////////////////////////////////////////
virtual bool OnInit()
{
// Create the main window
MyFrame* MainFrame = new MyFrame;
MainFrame->Show();

return true;
}
};

IMPLEMENT_APP(MyApplication);


wxSFMLCanvas.hpp
Code: [Select]
#ifndef WXSFMLCANVAS_HPP
#define WXSFMLCANVAS_HPP

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Graphics.hpp>
#include <wx/wx.h>


////////////////////////////////////////////////////////////
/// wxSFMLCanvas allows to run SFML in a wxWidgets control
////////////////////////////////////////////////////////////
class wxSFMLCanvas : public wxControl, public sf::RenderWindow
{
public :

    ////////////////////////////////////////////////////////////
    /// Construct the wxSFMLCanvas
    ///
    /// \param Parent :   Parent of the control (NULL by default)
    /// \param Id :       Identifier of the control (-1 by default)
    /// \param Position : Position of the control (wxDefaultPosition by default)
    /// \param Size :     Size of the control (wxDefaultSize by default)
    /// \param Style :    Style of the control (0 by default)
    ///
    ////////////////////////////////////////////////////////////
    wxSFMLCanvas(wxWindow* Parent = NULL, wxWindowID Id = -1, const wxPoint& Position = wxDefaultPosition, const wxSize& Size = wxDefaultSize, long Style = 0);

    ////////////////////////////////////////////////////////////
    /// Destructor
    ///
    ////////////////////////////////////////////////////////////
    virtual ~wxSFMLCanvas();

private :

    DECLARE_EVENT_TABLE()

    ////////////////////////////////////////////////////////////
    /// Notification for the derived class that moment is good
    /// for doing its update and drawing stuff
    ///
    ////////////////////////////////////////////////////////////
    virtual void OnUpdate();

    ////////////////////////////////////////////////////////////
    /// Called when the window is idle - we can refresh our
    /// SFML window
    ///
    ////////////////////////////////////////////////////////////
    void OnIdle(wxIdleEvent&);

    ////////////////////////////////////////////////////////////
    /// Called when the window is repainted - we can display our
    /// SFML window
    ///
    ////////////////////////////////////////////////////////////
    void OnPaint(wxPaintEvent&);

    ////////////////////////////////////////////////////////////
    /// Called when the window needs to draw its background
    ///
    ////////////////////////////////////////////////////////////
    void OnEraseBackground(wxEraseEvent&);
};


#endif // WXSFMLCANVAS_HPP


wxSFMLCanvas.cpp
Code: [Select]
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include "wxSFMLCanvas.hpp"

// Platform-specific includes
#ifdef __WXGTK__
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#include <wx/gtk/win_gtk.h>
#endif


////////////////////////////////////////////////////////////
// Event table
////////////////////////////////////////////////////////////
BEGIN_EVENT_TABLE(wxSFMLCanvas, wxControl)
EVT_IDLE(wxSFMLCanvas::OnIdle)
EVT_PAINT(wxSFMLCanvas::OnPaint)
EVT_ERASE_BACKGROUND(wxSFMLCanvas::OnEraseBackground)
END_EVENT_TABLE()


////////////////////////////////////////////////////////////
/// Construct the wxSFMLCanvas
////////////////////////////////////////////////////////////
wxSFMLCanvas::wxSFMLCanvas(wxWindow* Parent, wxWindowID Id, const wxPoint& Position, const wxSize& Size, long Style) :
wxControl(Parent, Id, Position, Size, Style)
{
#ifdef __WXGTK__

// GTK implementation requires to go deeper to find the low-level X11 identifier of the widget
gtk_widget_realize(m_wxwindow);
gtk_widget_set_double_buffered(m_wxwindow, false);
GdkWindow* Win = GTK_PIZZA(m_wxwindow)->bin_window;
XFlush(GDK_WINDOW_XDISPLAY(Win));
sf::RenderWindow::Create(GDK_WINDOW_XWINDOW(Win));

#else

// Tested under Windows XP only (should work with X11 and other Windows versions - no idea about MacOS)
sf::RenderWindow::Create(GetHandle());
   
#endif
}


////////////////////////////////////////////////////////////
/// Destructor
////////////////////////////////////////////////////////////
wxSFMLCanvas::~wxSFMLCanvas()
{
    // Nothing to do...
}


////////////////////////////////////////////////////////////
/// Notification for the derived class that moment is good
/// for doing its update and drawing stuff
////////////////////////////////////////////////////////////
void wxSFMLCanvas::OnUpdate()
{
    // Nothing to do by default...
}


////////////////////////////////////////////////////////////
/// Called when the control is idle - we can refresh our
/// SFML window
////////////////////////////////////////////////////////////
void wxSFMLCanvas::OnIdle(wxIdleEvent&)
{
    // Send a paint message when the control is idle, to ensure maximum framerate
    Refresh();
}


////////////////////////////////////////////////////////////
/// Called when the control is repainted - we can display our
/// SFML window
////////////////////////////////////////////////////////////
void wxSFMLCanvas::OnPaint(wxPaintEvent&)
{
    // Make sure the control is able to be repainted
    wxPaintDC Dc(this);

    // Let the derived class do its specific stuff
    OnUpdate();

    // Display on screen
    Display();
}


////////////////////////////////////////////////////////////
/// Called when the control needs to draw its background
////////////////////////////////////////////////////////////
void wxSFMLCanvas::OnEraseBackground(wxEraseEvent&)
{
    // Don't do anything. We intercept this event in order to prevent the
    // parent class to draw the background before repainting the window,
    // which would cause some flickering
}

3
General discussions / downloadable tutorials
« on: January 22, 2009, 11:10:28 pm »
I will be away from the internet for a while - is there any way to download the whole tutorials section to your hard drive for offline viewing?

4
General / [C++/OSX] "sssssssssssssssssssssssssssssssssssss"
« on: January 05, 2009, 09:22:38 am »
Unfortunately, that didn't do anything. Good idea, though, but nope.

5
General / [C++/OSX] "sssssssssssssssssssssssssssssssssssss"
« on: January 05, 2009, 04:46:02 am »
um... what? program compiles fine. here's my debugger notes:

Code: [Select]
[Session started at 2009-01-04 22:36:32 -0500.]
Loading program into debugger…
GNU gdb 6.3.50-20050815 (Apple version gdb-962) (Sat Jul 26 08:14:40 UTC 2008)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-apple-darwin".Program loaded.
sharedlibrary apply-load-rules all
Attaching to program: `/Users/zhinchliffe/Projects/Yeah! I've Got The Times!/build/Debug/Yeah! I've Got The Times!.app/Contents/MacOS/Yeah! I've Got The Times!', process 24177.
warning: Unable to read symbols for "ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss" (file not found).
warning: Unable to read symbols from "ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss" (not yet mapped into memory).
warning: Unable to read symbols for "ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss" (file not found).
warning: Unable to read symbols from "ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss" (not yet mapped into memory).
gdb stack crawl at point of internal error:
[ 0 ] /Developer/usr/libexec/gdb/gdb-i386-apple-darwin (align_down+0x0) [0x122510]
[ 1 ] /Developer/usr/libexec/gdb/gdb-i386-apple-darwin (objfile_data+0x69) [0xa7a93]
[ 2 ] /Developer/usr/libexec/gdb/gdb-i386-apple-darwin (dwarf2_frame_find_fde+0x33) [0xe0565]
[ 3 ] /Developer/usr/libexec/gdb/gdb-i386-apple-darwin (dwarf2_frame_sniffer+0x2e) [0xe1015]
[ 4 ] /Developer/usr/libexec/gdb/gdb-i386-apple-darwin (frame_unwind_find_by_frame+0x3b) [0x129e5d]
[ 5 ] /Developer/usr/libexec/gdb/gdb-i386-apple-darwin (get_prev_frame+0x63) [0x129270]
[ 6 ] /Developer/usr/libexec/gdb/gdb-i386-apple-darwin (do_check_is_thread_unsafe+0x195) [0x3ed42]
[ 7 ] /Developer/usr/libexec/gdb/gdb-i386-apple-darwin (catch_errors+0x4d) [0x7ae0e]
[ 8 ] /Developer/usr/libexec/gdb/gdb-i386-apple-darwin (safe_check_is_thread_unsafe+0x69) [0x3edd2]
[ 9 ] /Developer/usr/libexec/gdb/gdb-i386-apple-darwin (iterate_over_threads+0x24) [0x78e7e]
[ 10 ] /Developer/usr/libexec/gdb/gdb-i386-apple-darwin (check_safe_call+0xe4) [0x3eecb]
[ 11 ] /Developer/usr/libexec/gdb/gdb-i386-apple-darwin (mi_cmd_stack_check_threads+0x292) [0x12873]
[ 12 ] /Developer/usr/libexec/gdb/gdb-i386-apple-darwin (captured_mi_execute_command+0x16d) [0x1766f]
/SourceCache/gdb/gdb-962/src/gdb/objfiles.c:2218: internal-error: objfile_data: Assertion `data->index < objfile->num_data' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.

The Debugger has exited with status 1.

6
General / [C++/OSX] libraries don't link properly
« on: January 04, 2009, 01:21:23 am »
hmm.... now it just hangs... even though I didn't change anything. argh!

EDIT: also, what's your MSN address?

7
General / [C++/OSX] libraries don't link properly
« on: January 04, 2009, 01:08:26 am »
Quote from: "Ceylo"
What's written in the Xcode's console ?


Code: [Select]
[Session started at 2009-01-03 19:08:10 -0500.]
Loading program into debugger…
GNU gdb 6.3.50-20050815 (Apple version gdb-962) (Sat Jul 26 08:14:40 UTC 2008)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-apple-darwin".Program loaded.
sharedlibrary apply-load-rules all
Attaching to program: `/Users/zhinchliffe/Desktop/Coobie and the Robots/build/Release/Coobie and the Robots.app/Contents/MacOS/Coobie and the Robots', process 5549.
(gdb)

8
General / [C++/OSX] libraries don't link properly
« on: January 03, 2009, 10:38:25 pm »
okay, now when I put the files in there, the application stalls for a bit and crashes.  :(

do you think we could talk about this on an instant messenger so I could get this problem figured out a bit faster? i've listed my contact details below:

AIM: zachhinchliffe
YAHOO: zachhinchliffe
MSN/WLM: zhinchliffe@isamedia.org
Google Talk: zhinchliffe@gmail.com
Skype: zachhinchliffe

9
General / [C++/OSX] libraries don't link properly
« on: January 03, 2009, 06:40:21 pm »
Quote from: "Ceylo"
Never has this been done automatically.
but when I compile the basic included SFML template, it DOES do it automatically.  :?

10
General / [C++/OSX] libraries don't link properly
« on: January 03, 2009, 01:59:40 am »
Quote from: "Ceylo"
The debugger asks for the frameworks to be copied in appname.app/Contents/Frameworks. Make sure this is where you put them.

Otherwise, for general development with SFML, the frameworks must be copied in /Library/Frameworks.
right, but usually the frameworks are automatically put in that folder, and now, for some reason, they are not.

11
General discussions / SFML 1.3 and OS X
« on: January 03, 2009, 12:17:18 am »
Well, I am having a bugger of a problem, so could you check this topic out?

12
General / [C++/OSX] libraries don't link properly
« on: January 03, 2009, 12:16:46 am »
I am attempting to build a friend's SFML game on the Mac OS X platform, and am having a bit of trouble. I start a new Xcode project from the Xcode templates included with the SFML download. It builds and runs fine. But then, when I change the main.cpp into the one for my friend's game, the built application will not fully launch. GDB tells me (see bottom of post) the application cannot load the SFML frameworks from the Frameworks directory of the app bundle, and sure enough, no Frameworks (or Resources) directories have been created, even though Xcode says it built properly. What would be the cause of this? I'm not positive if my friend wants me to share the source, but I'm just wondering if there's anything that can be put in main.cpp that'd disable the proper linking of the libraries?

And, furthermore, when I put the libraries manually into the Frameworks folder, it still doesn't load. What's up with that?

Code: [Select]
warning: Unable to read symbols for "@executable_path/../Frameworks/sfml-audio-d.framework/Versions/A/sfml-audio-d" (file not found).
warning: Unable to read symbols from "sfml-audio-d" (not yet mapped into memory).
warning: Unable to read symbols for "@executable_path/../Frameworks/sfml-graphics-d.framework/Versions/A/sfml-graphics-d" (file not found).
warning: Unable to read symbols from "sfml-graphics-d" (not yet mapped into memory).
warning: Unable to read symbols for "@executable_path/../Frameworks/sfml-system-d.framework/Versions/A/sfml-system-d" (file not found).
warning: Unable to read symbols from "sfml-system-d" (not yet mapped into memory).
warning: Unable to read symbols for "@executable_path/../Frameworks/sfml-window-d.framework/Versions/A/sfml-window-d" (file not found).
warning: Unable to read symbols from "sfml-window-d" (not yet mapped into memory).

13
General discussions / SFML 1.3 and OS X
« on: January 02, 2009, 10:33:22 pm »
hey, Ceylo, how do I compile the static libraries on OS X? when I build that Xcode project, all I get is the dynamic libraries. is there something extra i have to do?

14
Graphics / Failed to load image
« on: January 02, 2009, 02:00:12 am »
Quote from: "dorkfish"
use cocoa's bundle-handling code to load your images from the bundle's resource directory.
Alright, I'll need a bit more help than that, since I'm not a cocoa programmer. How exactly would I go about doing this?

15
Graphics / Failed to load image
« on: December 31, 2008, 11:22:22 pm »
just tried with absolute path, still no dice.

Pages: [1] 2
anything