Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Mar 4, 2013 5:54:01 GMT 1
I downloaded Gtk3 for Windows and it looks like a much better implementation and can be compiled with MinGW or MS VC. DOWNLOADIs there any interest on this forum to try to get a version of BaCon for Windows that can be compiled with MinGW32 and using Gtk3/HUG? A few screen shots from my XP VirtualBox. Can someone refresh my memory of the known issues porting BaCon to Windows?
|
|
|
Post by Pjot on Mar 4, 2013 9:16:43 GMT 1
Good morning jrs, Well, I definitely am not interested, for a starters Thing is, I started this project just because there was not decent BASIC-to-C converter for a Unix environment. In a way, BaCon is a walking advertisement for Unix. So if people want to use BaCon, then they should install Linux, instead of having the hopes to see a port of BaCon to Windows... ;D The compromise is to use Cygwin together with BaCon. The EXEC$ function uses the Unix fork API, which is not available on Windows. Furthermore, BaCon has the ERROR variable which is a reserved token in the Windows API. Probably there are more issues... BR, Peter
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Mar 4, 2013 9:40:05 GMT 1
On that note as cross platform BaCon users line up for the plunge over the cliff. Vala for Gtk looks pretty interesting and runs on both Windows and Linux. The Gtk binding is actually pretty slick. using Gtk;
int main (string[] args) { Gtk.init (ref args);
var window = new Window (); window.title = "First GTK+ Program"; window.border_width = 10; window.window_position = WindowPosition.CENTER; window.set_default_size (350, 70); window.destroy.connect (Gtk.main_quit);
var button = new Button.with_label ("Click me!"); button.clicked.connect (() => { button.label = "Thank you"; });
window.add (button); window.show_all ();
Gtk.main (); return 0; }
Attachments:
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Mar 4, 2013 9:53:51 GMT 1
Attached is the complete FirstGtk project (source and executable) Attachments:
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Mar 4, 2013 21:02:19 GMT 1
I got Vala working with Gtk3 under Windows and compiled the same Linux FirstGtk.vala source on XP. (33.2 KB .exe) Vala Tutorial
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Mar 5, 2013 6:12:40 GMT 1
This will be my last Vala/Gtk post. It could be another fun language to learn. Ubuntu 64 Egg Clock binary & source using Gtk;
namespace Egg {
public class ClockFace : DrawingArea {
private Time time; private int minute_offset; private bool dragging;
public signal void time_changed (int hour, int minute);
public ClockFace () { add_events (Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK | Gdk.EventMask.POINTER_MOTION_MASK); update ();
// update the clock once a second Timeout.add (1000, update); }
public override bool draw (Cairo.Context cr) { var x = get_allocated_width () / 2; var y = get_allocated_height () / 2; var radius = double.min (get_allocated_width () / 2, get_allocated_height () / 2) - 5;
// clock back cr.arc (x, y, radius, 0, 2 * Math.PI); cr.set_source_rgb (1, 1, 1); cr.fill_preserve (); cr.set_source_rgb (0, 0, 0); cr.stroke ();
// clock ticks for (int i = 0; i < 12; i++) { int inset;
cr.save (); // stack pen-size
if (i % 3 == 0) { inset = (int) (0.2 * radius); } else { inset = (int) (0.1 * radius); cr.set_line_width (0.5 * cr.get_line_width ()); }
cr.move_to (x + (radius - inset) * Math.cos (i * Math.PI / 6), y + (radius - inset) * Math.sin (i * Math.PI / 6)); cr.line_to (x + radius * Math.cos (i * Math.PI / 6), y + radius * Math.sin (i * Math.PI / 6)); cr.stroke (); cr.restore (); // stack pen-size }
// clock hands
var hours = this.time.hour; var minutes = this.time.minute + this.minute_offset; var seconds = this.time.second; // hour hand: // the hour hand is rotated 30 degrees (pi/6 r) per hour + // 1/2 a degree (pi/360 r) per minute cr.save (); cr.set_line_width (2.5 * cr.get_line_width ()); cr.move_to (x, y); cr.line_to (x + radius / 2 * Math.sin (Math.PI / 6 * hours + Math.PI / 360 * minutes), y + radius / 2 * -Math.cos (Math.PI / 6 * hours + Math.PI / 360 * minutes)); cr.stroke (); cr.restore ();
// minute hand: // the minute hand is rotated 6 degrees (pi/30 r) per minute cr.move_to (x, y); cr.line_to (x + radius * 0.75 * Math.sin (Math.PI / 30 * minutes), y + radius * 0.75 * -Math.cos (Math.PI / 30 * minutes)); cr.stroke (); // seconds hand: // operates identically to the minute hand cr.save (); cr.set_source_rgb (1, 0, 0); // red cr.move_to (x, y); cr.line_to (x + radius * 0.7 * Math.sin (Math.PI / 30 * seconds), y + radius * 0.7 * -Math.cos (Math.PI / 30 * seconds)); cr.stroke (); cr.restore ();
return false; }
public override bool button_press_event (Gdk.EventButton event) { var minutes = this.time.minute + this.minute_offset;
// From // http://mathworld.wolfram.com/Point-LineDistance2-Dimensional.html var px = event.x - get_allocated_width () / 2; var py = get_allocated_height () / 2 - event.y; var lx = Math.sin (Math.PI / 30 * minutes); var ly = Math.cos (Math.PI / 30 * minutes); var u = lx * px + ly * py;
// on opposite side of origin if (u < 0) { return false; }
var d2 = Math.pow (px - u * lx, 2) + Math.pow (py - u * ly, 2);
if (d2 < 25) { // 5 pixels away from the line this.dragging = true; print ("got minute hand\n"); }
return false; }
public override bool button_release_event (Gdk.EventButton event) { if (this.dragging) { this.dragging = false; emit_time_changed_signal ((int) event.x, (int) event.y); } return false; }
public override bool motion_notify_event (Gdk.EventMotion event) { if (this.dragging) { emit_time_changed_signal ((int) event.x, (int) event.y); } return false; }
private void emit_time_changed_signal (int x, int y) { // decode the minute hand // normalise the coordinates around the origin x -= get_allocated_width () / 2; y -= get_allocated_height () / 2;
// phi is a bearing from north clockwise, use the same geometry as // we did to position the minute hand originally var phi = Math.atan2 (x, -y); if (phi < 0) { phi += Math.PI * 2; }
var hour = this.time.hour; var minute = (int) (phi * 30 / Math.PI); // update the offset this.minute_offset = minute - this.time.minute; redraw_canvas ();
time_changed (hour, minute); }
private bool update () { // update the time this.time = Time.local (time_t ()); redraw_canvas (); return true; // keep running this event }
private void redraw_canvas () { var window = get_window (); if (null == window) { return; }
var region = window.get_clip_region (); // redraw the cairo canvas completely by exposing it window.invalidate_region (region, true); window.process_updates (true); } } }
int main (string[] args) { Gtk.init (ref args); var window = new Window (); var clock = new Egg.ClockFace (); window.add (clock); window.destroy.connect (Gtk.main_quit); window.show_all (); Gtk.main (); return 0; }
Here is the EggClock example in C/Gtk.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Mar 5, 2013 19:38:48 GMT 1
In an attempt to bring this thread back full circle, what about rewriting BaCon using Vala or GObject? That would be a good reason for a 2.0 target.
|
|
|
Post by alexfish on Mar 5, 2013 20:50:20 GMT 1
Hi JRS Not wanting to sound unkind about the title of this thread, But do not see any Bacon Code , I downloaded some of the bits , hoping it to be BaCon related or bacon code in them. Appears not to be the case. Slightly Miffed. + BR Alex
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Mar 5, 2013 21:29:27 GMT 1
Me too!
Are you saying you are willing to help port BaCon to Windows or are you just whining?
|
|
|
Post by alexfish on Mar 5, 2013 21:50:48 GMT 1
Me too! Are you saying you are willing to help port BaCon to Windows or are you just whining? Me take someone else's code and port it , fear to dread about the consequences from loyal users, apart from the time involved , is Bacon using glib , perhaps the best option as regards a Basic to C converter would be to use BCX , no porting required. I have no more interest in Windows than trying to resolve the big bang theory. ;D Whining and Dining , BR Alex
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Mar 5, 2013 22:02:49 GMT 1
This thread was created on the proper board and it about finding other BaCon user interested in a more portable version of the language. BaCon is an open source project and wouldn't be where it is today if it wasn't for the feedback and prodding to make it better.
You started this same trend with the IUP thread and highjacked it until it was closed. PLEASE don't do the same with this project. Start your own bitch thread if you have issues with something in another topic you have no interest in.
|
|
mobeus
Junior Member
Posts: 86
|
Post by mobeus on Mar 6, 2013 2:22:51 GMT 1
Peter,
Back in 2009 you wrote dict.bac (http://www.basic-converter.org/ in the BaCon language extensions section) and provided a Win32 screenshot of it.
Did you compile that on Windows with Bacon? If so, do you remember the Windows environment used to compile it?
Best regards, Mobeus
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Mar 6, 2013 3:26:39 GMT 1
I would guess that is ScriptBasic with GTK-Server.
|
|
|
Post by Pjot on Mar 6, 2013 9:47:41 GMT 1
Hi jrs, This is a screenshot of the BaCon version of the dictionary program, running in a Cygwin/X environment. BaCon works perfect when using Cygwin, including graphical stuff like GTK, HUG, and OpenGL. BR, Peter
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Mar 6, 2013 17:40:32 GMT 1
It seems like more of a PITA to port BaCon to Windows than its worth. As you have stated in this thread and many times before, BaCon was created for *nix with no interest in Windows as a platform. (or you would have taken steps early on to be cross platform compliant) BaCon works great on Android native Linux so I guess that will have to do to satisfy my porting habit.
|
|