VB6 to C++.net porting questions.

ghost2

Newcomer
Joined
Oct 5, 2006
Messages
1
For the last year or so I've been working on and off on a small side project. It is supposed to be a game based on 'Asteroids', except that there is a 2d physics system, and the user can also create custom asteroid templates, as well as a myriad of other changes. Currently this project is a vb6 app, and as the title of this post suggests, I'm trying to port it to c++.net (note that the vb6 source and compiled versions can be found at http://www.ghost2.cafe150.com).

I am self taught in vb6, and am very experienced with its use (the code at the aforementioned site was done from scratch), and I have taken 2 courses on plain c++, so I'm familiar with the syntax, as well as a few algorithms etc..

This brings me to the questions themselves:
1. Dynamic Arrays
The VB6 version of the program relies extensively on Dynamic arrays. At start up, the array is empty. By using redim statements, I can set the number of elements to any reasonable number, and it works; however, I do not know how to do this with c++. I vaguely remember something about the new statement, and it might have something to do with 'malloc' but thats all I remember. Ideally, I should be able to change the length of the array any time at runtime, while still preserving the contents of the array. If you are familiar with VB6 you should understand what I mean. If not, google "Redim Preserve".

2. Graphics
In my app, most of the game objects are drawn onto a picturebox using the 'Polygon' API function. This was the main bottleneck in performance, and one of the main reasons for porting. I need a way to take an array of 2d coordinates and draw them as a polygon onto some sort of drawing surface, preferably using any arbitrary color, and in a way that allows a background image. The polygon function won't work here, because it is for activex controls, and requires a hWnd value. This technique should be fast, and may use DirectX etc.

3. Menu arrays
How do you create an array of Menu bar buttons? E.g. if you are using explorer, go to View>Text Size and you will see a list of sizes. Only one can be selected at a time, and they all link to the same function, whick responds based on the received 'index' value. I can do this in vb6 fine, but I don't know how to do this in c++.

This is all I can think of for now. I know that going from VB6 to a C++ environment is a huge jump in complexity, but I know I can manage it. Thanks.
 
Back
Top