473,387 Members | 1,420 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Converting C++ to C# (hopefully quite easy)

I have got the starting bits of a game that I am trying to
write. I did start to write it in VC++6, but found the
basic windows GDI to be of general poor performance for
animation. So I decided to switch to GDI+, and as far as
I've found on my operating system (WinXP, VS6 and VS.NET
2002) C# is the only language that seems to be capable of
using GDI+, as it does so intrinsically (C++ coughs up
about 100 errors from the <gdiplus.h> so that's out of the
question, whether I do it managed or unmanaged), so I've
decided to convert it to C#, and now i think about it I'm
happier with that, as long as C# can work in the way that
I want, which it seems to be able to.
My question though, is that would the following
architecture sound OK? In C++, I have got two animator
classes which run in separate threads, one which draws to
the buffer, and one which copies the buffer to the screen.
These classes are started by having a Start method, this
kicks off a new thread starting at a static member
function with a 'this' pointer, the thread then repeatedly
calls a non-static member function belonging to 'this'
pointer. In C++, each of these classes get an HDC passed
to them on construction (the copier class has two, one for
the screen aswell) but I would expect in C# they would
create a graphics during the non-static frame function
from the Form that they are passed.

2 questions:
Does it sound faesible to convert this architecture to C#,
and does it have any limitations that I need to watch out
for

Does C# have any powerful features that I would probably
want to take advantage of? It seems to be a very powerful
language from what I've seen.

I've read a bit up on how to create a thread in C#. But
how would I pass a reference (pointer?) to the Form as a
parameter to the thread start function, and how would I
ensure that it's a pointer rather than a copy of the Form
object?
Nov 15 '05 #1
2 1203
Bonj,

While I have no doubt that this can be done in C#, I think that for what
you are trying to do, the DirectX framework might be more appropriate. It
has everything you need for high-perf rendering, leaving you to do more game
coding, and less engine coding. Also, there is a managed wrapper for the
latest version of DirectX, version 9.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Bonj" <an*******@discussions.microsoft.com> wrote in message
news:0b****************************@phx.gbl...
I have got the starting bits of a game that I am trying to
write. I did start to write it in VC++6, but found the
basic windows GDI to be of general poor performance for
animation. So I decided to switch to GDI+, and as far as
I've found on my operating system (WinXP, VS6 and VS.NET
2002) C# is the only language that seems to be capable of
using GDI+, as it does so intrinsically (C++ coughs up
about 100 errors from the <gdiplus.h> so that's out of the
question, whether I do it managed or unmanaged), so I've
decided to convert it to C#, and now i think about it I'm
happier with that, as long as C# can work in the way that
I want, which it seems to be able to.
My question though, is that would the following
architecture sound OK? In C++, I have got two animator
classes which run in separate threads, one which draws to
the buffer, and one which copies the buffer to the screen.
These classes are started by having a Start method, this
kicks off a new thread starting at a static member
function with a 'this' pointer, the thread then repeatedly
calls a non-static member function belonging to 'this'
pointer. In C++, each of these classes get an HDC passed
to them on construction (the copier class has two, one for
the screen aswell) but I would expect in C# they would
create a graphics during the non-static frame function
from the Form that they are passed.

2 questions:
Does it sound faesible to convert this architecture to C#,
and does it have any limitations that I need to watch out
for

Does C# have any powerful features that I would probably
want to take advantage of? It seems to be a very powerful
language from what I've seen.

I've read a bit up on how to create a thread in C#. But
how would I pass a reference (pointer?) to the Form as a
parameter to the thread start function, and how would I
ensure that it's a pointer rather than a copy of the Form
object?

Nov 15 '05 #2
Sorry I think i should have said I am getting some books
on directx but they haven't come yet. So I want to do this
as a preliminary, 'basic' project.

-----Original Message-----
Bonj,

While I have no doubt that this can be done in C#, I think that for whatyou are trying to do, the DirectX framework might be more appropriate. Ithas everything you need for high-perf rendering, leaving you to do more gamecoding, and less engine coding. Also, there is a managed wrapper for thelatest version of DirectX, version 9.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Bonj" <an*******@discussions.microsoft.com> wrote in messagenews:0b****************************@phx.gbl...
I have got the starting bits of a game that I am trying to write. I did start to write it in VC++6, but found the
basic windows GDI to be of general poor performance for
animation. So I decided to switch to GDI+, and as far as
I've found on my operating system (WinXP, VS6 and VS.NET
2002) C# is the only language that seems to be capable of using GDI+, as it does so intrinsically (C++ coughs up
about 100 errors from the <gdiplus.h> so that's out of the question, whether I do it managed or unmanaged), so I've
decided to convert it to C#, and now i think about it I'm happier with that, as long as C# can work in the way that I want, which it seems to be able to.
My question though, is that would the following
architecture sound OK? In C++, I have got two animator
classes which run in separate threads, one which draws to the buffer, and one which copies the buffer to the screen. These classes are started by having a Start method, this
kicks off a new thread starting at a static member
function with a 'this' pointer, the thread then repeatedly calls a non-static member function belonging to 'this'
pointer. In C++, each of these classes get an HDC passed
to them on construction (the copier class has two, one for the screen aswell) but I would expect in C# they would
create a graphics during the non-static frame function
from the Form that they are passed.

2 questions:
Does it sound faesible to convert this architecture to C#, and does it have any limitations that I need to watch out for

Does C# have any powerful features that I would probably
want to take advantage of? It seems to be a very powerful language from what I've seen.

I've read a bit up on how to create a thread in C#. But
how would I pass a reference (pointer?) to the Form as a
parameter to the thread start function, and how would I
ensure that it's a pointer rather than a copy of the Form object?

.

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: adamc | last post by:
hi, I'm currently debugging a crash occurring in the Python interpreter. I've got a Dictionary object in the form of a (PyObject *) I can cast it to (dictobject *) in the debugger watch...
2
by: Jonas Prismesen | last post by:
Hi! I have string like this: string expr = "123/(12*3)"; And I want to actually calculate the mathematical expression in the string. Is there an easy way do it? Or do I have to extract all...
3
by: Ciar?n | last post by:
I have a table with over a million rows and one of the fields contains amounts of money in text format. What is the most efficient way of converting this field to a number format that I can sum...
14
by: D | last post by:
Hey guys- not sure where this post fits in, so I cc'd a few other groups as well- hope you dont mind... I have someone creating a database for me in Access 2000 (or is it called XP?). When it's...
4
by: lwzmovie | last post by:
Hi - if I have created a PHP web application in 5 months (850 workign hours) and now I want to convert it to ASP.NET, then how many hours do I need to invest in to make this happen? Anybody has...
8
by: Adam Sandler | last post by:
Hello, After exploring the links found at http://allmyfaqs.net/faq.pl?CSS_FAQs for a couple of months, I'm finally weaning myself off of the <frameset> and <table> nipples. I'm just having...
6
by: clusardi2k | last post by:
Hello, What book and/or books can teach me how to do deployment with a step by step detail, hopefully! The question that I am looking to answer is: Before I start any programming, what will I...
3
by: dean.elwood | last post by:
Hi guys, My first post here and I'm a pascal coder doing his best to move to C/C++ so please go easy on me ;) I'm using the MySQL C API to pull some values from a DB. One of the fields is a...
116
by: Dilip | last post by:
Recently in our code, I ran into a situation where were stuffing a float inside a double. The precision was extended automatically because of that. To make a long story short, this caused...
4
by: --CELKO-- | last post by:
I need to convert a bunch of DB2 triggers to Oracle. Is there any kind of tools for this?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.