Jump to content
  • Advertisement
Sign in to follow this  
3dmodelerguy

passing a name

This topic is 4975 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am try to devlop a class the make a wxFrame have wxGLCanvas through a class function and having to problems, 1 in wxWidgets and one in general. first problem: I need to pass a name for the GLCanvas this is how you normal defina a GLCanvas:
wxGLCanvas * MyGLCanvas = new wxGLCanvas(frame, -1, wxPoint(0,0), wxSize(200,200), wxSUNKEN_BORDER, _("some text"));


what i need to do is something so that in the parameter on of the functioin i can define what i will call the wxGLCanvas ( in this case MyGLCanvas), how would i do that? second problem: I am getting this error:
Deleting intermediate files and output files for project 'Stromgage 3D Game Engine - Win32 Debug'.
--------------------Configuration: Stromgage 3D Game Engine - Win32 Debug--------------------
Compiling...
PrecompiledHeaders.cpp
Compiling...
GameWindow.cpp
MainApp.cpp
GLCanvas.cpp
C:\Stromgage 3D Game Engine\Stromgage 3D Game Engine\GLCanvas.cpp(8) : error C2664: '__thiscall wxGLCanvas::wxGLCanvas(class wxWindow *,int,const class wxPoint &,const class wxSize &,long,const class wxString &,int *,const class wxPalette &)' : cann
ot convert parameter 1 from 'class wxWindow' to 'class wxWindow *'
        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
Generating Code...
Error executing cl.exe.

Stromgage 3D Game Engine.exe - 1 error(s), 0 warning(s)


with this code GLCanvas.h:
#ifndef GLCANVAS_H
#define GLCANVAS_H

#include "PrecompiledHeaders.h"
#include <wx/glcanvas.h>

class GLCanvas
{

	public: 
		
		GLCanvas( wxWindow &frame, int &var, wxPoint &point, wxSize &size, wxString &title );

};




#endif

GLCanvas.cpp:
#include "PrecompiledHeaders.h"
#include "GLCanvas.h"
#include <wx/glcanvas.h>

GLCanvas::GLCanvas( wxWindow &frame, int &var, wxPoint &point, wxSize &size, wxString &title, const char &canvasname )
{

	wxGLCanvas * canvasname = new wxGLCanvas( frame, var, point, size, title);

}


can anyone help me with this error?

Share this post


Link to post
Share on other sites
Advertisement
In the "GLCanvas.cpp", use:

wxGLCanvas * canvasname = new wxGLCanvas( &frame, var, point, size, title);

Instead. You need to pass in the address of, and you were not. That should work. If not let me know. Best of luck!

- Drew

Share this post


Link to post
Share on other sites
now i get this error:


Deleting intermediate files and output files for project 'Stromgage 3D Game Engine - Win32 Debug'.
--------------------Configuration: Stromgage 3D Game Engine - Win32 Debug--------------------
Compiling...
PrecompiledHeaders.cpp
Compiling...
GameWindow.cpp
GLCanvas.cpp
C:\Stromgage 3D Game Engine\Stromgage 3D Game Engine\GLCanvas.cpp(8) : error C2664: '__thiscall wxGLCanvas::wxGLCanvas(class wxWindow *,int,const class wxPoint &,const class wxSize &,long,const class wxString &,int *,const class wxPalette &)' : cann
ot convert parameter 5 from 'class wxString' to 'long'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
MainApp.cpp
Generating Code...
Error executing cl.exe.

Stromgage 3D Game Engine.exe - 1 error(s), 0 warning(s)


Share this post


Link to post
Share on other sites
Well you need to check the parameters you are sending -

You have:
wxGLCanvas * MyGLCanvas = new wxGLCanvas(frame, -1, wxPoint(0,0), wxSize(200,200), wxSUNKEN_BORDER, _("some text"));

Parameter 5 in this case is wxSUNKEN_BORDER and it is expecting a wxString per:

GLCanvas( wxWindow &frame, int &var, wxPoint &point, wxSize &size, wxString &title );

You will need to make the parameter lists match - such as

GLCanvas( wxWindow &frame, int &var, wxPoint &point, wxSize &size, DWORD &style, wxString &title );

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!