Ruby rocks! HELP converting Ruby to C++?

T

Todd Gardner

Hello Ruby experts,

I spent a week doing http://rubyforge.org/projects/wxryplot/ in Ruby.
Granted, it is not much but the Ruby code works. I have spent a month
trying to do this same thing in C++ and I AM STUCK, help!.

I need to use legacy C++ code in a C++ environment on a Windows 2000
machine. I would like to request your expertise converting this simple Ruby
program to C++. In am using wxWidgets in C++. It may be easier to embed
this Ruby code into C++ however, it seems unnecessary to embed an entire
language (namely Ruby into C++) for such a simple program.

The following Ruby code is a whittled down version of
http://rubyforge.org/frs/?group_id=287. This code was written using Ruby
version 1.8.1-13 the accompanying wxRuby on a Windows 2000 machine.

[Begin Ruby code]
require 'wxruby'

class MyDrawingFrame < Wx::Frame
def initialize(*args)
super(*args)
evt_paint {on_paint}
end
def on_paint
paint do |dc|
dc.clear
dc.draw_line(10, 20, 100, 200) #draw single line
end
end
end

class MyApp < Wx::App
def on_init()
frame = MyDrawingFrame.new(nil, -1, 'MyFrame')
frame.show()
end
end

MyApp.new().main_loop()
[end Ruby code]

Any assistance or pointers would be greatly appreciated. So far, I have
tried but had little assistance from (e-mail address removed).

Thank you,

Todd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top