X-Git-Url: https://ecere.com/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=samples%2FguiAndGfx%2Fopenrider%2Fform1.ec;h=8429c70ba84de69a8e6d8900035d50334abbb987;hb=8ee80ec2b5c2317d48ff1ac4b3a886a5d1bed7aa;hp=318c354cbf21b8b8159a5e2f3a966145ce736de0;hpb=6bad27e666389fc889502c26e7474a361f0ed80c;p=sdk diff --git a/samples/guiAndGfx/openrider/form1.ec b/samples/guiAndGfx/openrider/form1.ec index 318c354..8429c70 100644 --- a/samples/guiAndGfx/openrider/form1.ec +++ b/samples/guiAndGfx/openrider/form1.ec @@ -178,13 +178,13 @@ class Form1 : Window running_b = value; goItem.checked = value; wheelSpinner.started = value; - + centerItem.disabled = value; nudgeLeftItem.disabled = value; nudgeRightItem.disabled = value; nudgeUpItem.disabled = value; nudgeDownItem.disabled = value; - + if (!value) Update(null); } @@ -196,13 +196,13 @@ class Form1 : Window Timer wheelSpinner {this, 0.015, started=false; bool DelayExpired() { double t = GetTime(); - + this.modifiedDocument = true; - + //game.FrameMulti(LOGICAL_FPS/DRAWN_FPS*2); game.FrameMulti((uint)((t-lastFrameTime)*LOGICAL_FPS)); lastFrameTime = t; - + //let's center the camera on the ball { Coord2D p = game.vehicles[0].location; @@ -244,7 +244,7 @@ class Form1 : Window bool NotifySelect(MenuItem selection, Modifiers mods) { - if (MessageBox {master=this, text = "OpenRider", + if (MessageBox {master=this, text = "OpenRider", contents="Are you sure you want to clear the current track and start a new one?", type=yesNo}.Modal() != yes) return true; @@ -278,7 +278,7 @@ class Form1 : Window MenuItem fileSaveAsItem { fileMenu, "Save As...", a, Key {a, ctrl = true}, NotifySelect=MenuFileSaveAs } MenuDivider {fileMenu}; MenuItem exitItem {fileMenu, "Exit", x, altF4, NotifySelect = MenuFileExit }; - + Menu viewMenu {menu, "View", v}; MenuItem centerItem {viewMenu, "Center on ball", c, tab; bool NotifySelect(MenuItem selection, Modifiers mods) { @@ -308,14 +308,14 @@ class Form1 : Window MenuItem nudgeRightItem {viewMenu, "Right", r, right, NotifySelect = NudgeCallback, id=1} MenuItem nudgeUpItem {viewMenu, "Up", u, up, NotifySelect = NudgeCallback, id=2} MenuItem nudgeDownItem {viewMenu, "Down", d, down, NotifySelect = NudgeCallback, id=3} - + bool NudgeCallback(MenuItem selection, Modifiers mods) { Camera2D *c = camera; double nudgeAmount = 20.0 / c->zoom; - + if (running) return true; - + if (selection.id == 0) c->x -= nudgeAmount; else if (selection.id == 1) @@ -324,12 +324,12 @@ class Form1 : Window c->y -= nudgeAmount; else c->y += nudgeAmount; - + Update(null); - + return true; } - + Menu toolMenu {menu, "Tool", t}; MenuItem browseItem {toolMenu, "Browse", b, b, checked=false, isRadio=true, NotifySelect = MyCustomMenu}; MenuItem pencilItem {toolMenu, "Draw", d, d, checked=true, isRadio=true, NotifySelect = MyCustomMenu}; @@ -340,7 +340,7 @@ class Form1 : Window MenuItem speedItem {toolMenu, "Right accelerator", r, r, checked=false, isRadio=true, NotifySelect = MyCustomMenu}; MenuItem slowItem {toolMenu, "Left accelerator", f, f, checked=false, isRadio=true, NotifySelect = MyCustomMenu}; MenuItem decorItem {toolMenu, "Decoration", c, c, checked=false, isRadio=true, NotifySelect = MyCustomMenu}; - + Menu controlMenu {menu, "Control", c}; MenuItem goItem {controlMenu, "Go", g, Key {g, ctrl=true}, checked=false, checkable=true; bool NotifySelect(MenuItem selection, Modifiers mods) @@ -369,7 +369,7 @@ class Form1 : Window drawingTool = line; else if (eraserItem.checked) drawingTool = eraser; - + if (normalItem.checked) gameLineType = regular; else if (speedItem.checked) @@ -429,7 +429,7 @@ class Form1 : Window f.Read(vn, 1, 16); vn[15] = 0; f.Get(mv); - + if (mv > max_version_code_supported) { const char *vnp = *vn ? vn : "www.thedailywtf.com"; const char *message_format = "This track was created by a newer version of OpenRider (version %s). Continue opening it?"; @@ -474,7 +474,7 @@ class Form1 : Window for (i=0; i>1))/c->zoom+c->x; fy = (double)(y-(clientSize.h>>1))/c->zoom+c->y; @@ -635,7 +635,7 @@ class Form1 : Window needUpdate = true; } } - + if (navigating || (drawing && drawingTool==browse)) { double ox = nx-(double)x; double oy = ny-(double)y; @@ -645,7 +645,7 @@ class Form1 : Window c->y = cstarty + oy; needUpdate = true; } - + if (needUpdate) Update(null); return true; @@ -659,7 +659,7 @@ class Form1 : Window int y= (int)((ball.location.y-c->y)*c->zoom)+(clientSize.h>>1); int rwidth = (int)(ball.radius*2*c->zoom); Bitmap w = wheel[angle2index(ball.angle)]; - + if (w) { x -= rwidth>>1; y -= rwidth>>1; @@ -668,7 +668,7 @@ class Form1 : Window else surface.Filter(w, x,y, 0,0, rwidth,rwidth, w.width,w.height); } - + #if 0 if (!running && fabs(camera.zoom-1.0)>0.01) { double newradius = ball.radius*camera.zoom; @@ -727,7 +727,7 @@ class Form1 : Window surface.SetForeground(red); break; } - + DrawThickLine(x0, y0, x1, y1); } };