Having a weird problem... Just moving some code into new classes & methods.
Originally, I created a new instance of "Game" (my form), and it created a
new DX Device using:
_device = new Device(0, DeviceType.Hardware, _form,
CreateFlags.SoftwareVertexProcessing, _presParams);
This works correctly.
I've changed that line to now be:
_engine = new GameEngine(this);
and the constructo for GameEngine looks like this:
IntPtr _form;
public GameEngine(IntPtr form)
{
_form = form;
_device = new Device(0, DeviceType.Hardware, _form,
CreateFlags.SoftwareVertexProcessing, _presParams);
}
And now I get an error about converting Game to System.IntPtr (Game, being
my form).
Have I got to do something special to pass "this" from my forms into my own
classes? :-\
--
Daisy The Cow
Now playing: Darude Vs Robert Miles - Sandstorm Children 4 7536
"codymanix" <do*********************@gmx.de> wrote in message
news:%2***************@tk2msftngp13.phx.gbl... maybe a simple cast will help?
Nope, just gives the error on the line with the cast:
Cannot convert Game3d.Game to System.IntPtr :(
--
Daisy The Cow
Now playing: Nothing
Daisy,
An IntPtr is not a Form, a Form is not an IntPtr, how do you expect to pass
one to the other???
Are you thinking you want to pass the handle to the Form to your GameEngine?
You would need to pass Form.Handle (inherited from Control) in that case,
however I would pass Form as Form, then in the constructor save off
Form.Handle.
Hope this helps
Jay
"Daisy" <da***@nospam.oops> wrote in message
news:f6*****************@newsfep4-glfd.server.ntli.net... Having a weird problem... Just moving some code into new classes &
methods. Originally, I created a new instance of "Game" (my form), and it created a new DX Device using:
_device = new Device(0, DeviceType.Hardware, _form, CreateFlags.SoftwareVertexProcessing, _presParams);
This works correctly.
I've changed that line to now be:
_engine = new GameEngine(this);
and the constructo for GameEngine looks like this:
IntPtr _form; public GameEngine(IntPtr form) { _form = form; _device = new Device(0, DeviceType.Hardware, _form, CreateFlags.SoftwareVertexProcessing, _presParams); }
And now I get an error about converting Game to System.IntPtr (Game, being my form).
Have I got to do something special to pass "this" from my forms into my
own classes? :-\ -- Daisy The Cow Now playing: Darude Vs Robert Miles - Sandstorm Children
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:Of**************@TK2MSFTNGP12.phx.gbl... An IntPtr is not a Form, a Form is not an IntPtr, how do you expect to
pass one to the other???
Are you thinking you want to pass the handle to the Form to your
GameEngine? You would need to pass Form.Handle (inherited from Control) in that case, however I would pass Form as Form, then in the constructor save off Form.Handle.
Hope this helps Jay
Sorted it now :)
The method was overloaded, and excepts a Form or an IntPtr, and the debugger
had chosen that the incorrect parameter I originally had was closer to an
IntPtr than a Form :-)
--
Daisy The Cow
Now playing: Nothing This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jón Sveinsson |
last post by:
Hello everyone
I have been trying to read and write struct to binary
files, I'm using
to functions to convert the struct to bytes and bytes to
struct, I
always receive the following error
...
|
by: MJB |
last post by:
I'm getting an IStream back from function xmlHttp.responsestream. I would
like to convert this to a System.IO.Stream in order to work with it in my
application. Has anyone encountered this and...
|
by: Chad A. Beckner |
last post by:
Hey all,
I know this has been done using C++ (I have one with source code), but I
don't know C++ that well. Does anyone know of a C++ to C# converter? -
OR - does anyone know to to retrieve a...
|
by: Yifan |
last post by:
Hi
Does anybody know how to convert System::String* to char*? I searched the System::String class members and did not find any. Thanks
Yifan
|
by: Mad Scientist Jr |
last post by:
hi
can someone possibly convert this to vb.net ?
it is c# code that lets the pocket pc access the voice recorder...
many thanks...
source: wapboy...
|
by: Sakharam Phapale |
last post by:
Hi All,
I am using Microsoft Speech DLL "sapi.dll".
I want to use following method of "SpeechLib.SpStream" object
(following is a signature which I copied from Quick Info feature of .NET
code...
|
by: Me |
last post by:
Hi all
I am getting a really bizzare error on when I convert a string into a
datetime:
The code is :
DateTime dt1 = Convert.ToDateTime("10 Sep 2005");
Console.WriteLine(dt1.Year);
|
by: Serge BRIC |
last post by:
My application, written in .NET VB, tries to get a communication port handle
from a TAPI object with this code:
Dim vFileHandle As Byte() = appel.GetIDAsVariant("comm/datamodem")
The...
|
by: =?Utf-8?B?RGF2ZQ==?= |
last post by:
I am unable to execute the following statement in my current project. The
class PosExplorer is in a dll file (created by Microsoft).
PosExplorer explorer = new PosExplorer()
but now I get this...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |