summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Okay <okay@toyful.space>2021-02-09 11:00:40 -0600
committerColin Okay <okay@toyful.space>2021-02-09 11:00:40 -0600
commitb26d00daa7fc76895ead11d08cb47b662575a378 (patch)
tree18c0ae2bddc9e5a17b9ef3a3487a45365c78a4be
initial commit
-rw-r--r--Assets/.gitignore0
-rw-r--r--Source/Main.hx142
-rw-r--r--Source/Main.hx~11
-rw-r--r--WiggleWorldApp.hxproj48
-rw-r--r--project.xml16
5 files changed, 217 insertions, 0 deletions
diff --git a/Assets/.gitignore b/Assets/.gitignore
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Assets/.gitignore
diff --git a/Source/Main.hx b/Source/Main.hx
new file mode 100644
index 0000000..6a34ee8
--- /dev/null
+++ b/Source/Main.hx
@@ -0,0 +1,142 @@
+package;
+
+import openfl.display.Sprite;
+import openfl.geom.Point;
+import openfl.events.MouseEvent;
+import openfl.events.KeyboardEvent;
+import openfl.events.Event;
+import openfl.events.TimerEvent;
+import openfl.ui.Keyboard;
+import openfl.utils.Timer;
+import openfl.display.SimpleButton;
+import openfl.text.TextField;
+import openfl.text.TextFormat;
+
+import haxe.ds.Option;
+
+using Lambda;
+
+typedef PointType = { x:Float, y:Float};
+typedef HasVelocity = {velocity: PointType};
+typedef Circle = PointType & {radius:Float};
+typedef HasColor = {color: Int};
+
+typedef MovingColoredCircle = Circle & HasVelocity & HasColor;
+
+typedef BoxConfig =
+ {
+ width:Float,
+ height:Float,
+ bgColor:Int,
+ borderColor:Int,
+ borderThickness:Float,
+ borderRadius:Float, // if set, roundRect
+ };
+
+class Button extends SimpleButton
+{
+ static var upColor:Int = 0xdddddd;
+ static var downAndOverColor:Int = 0xeeeeee;
+
+ static function textBox
+ (text:String,
+ bgColor:Int = 0xFFFFFF,
+ ?textFormat:TextFormat,
+ ?borderRadius:Float = 0.0,
+ ?padding:Float = 40.0,
+ ?borderThickness:Float = 0.0,
+ ?borderColor:Int = 0
+ ):Sprite
+ {
+ var tf = new TextField();
+ tf.multiline = false;
+ tf.autoSize = openfl.text.TextFieldAutoSize.CENTER;
+ tf.selectable = false;
+ tf.text = text;
+
+ if (textFormat != null)
+ tf.setTextFormat( textFormat );
+
+ var s = new Sprite();
+ s.graphics.beginFill( bgColor );
+
+ if (borderThickness > 0)
+ s.graphics.lineStyle( borderThickness, borderColor);
+
+ s.graphics.drawRoundRect(0, 0,
+ tf.textWidth + padding,
+ tf.textHeight + padding,
+ borderRadius,
+ borderRadius );
+ s.graphics.endFill();
+
+ tf.x = (s.width - tf.textWidth) / 2;
+ tf.y = (s.height - tf.textHeight) / 2;
+
+ s.addChild( tf );
+ return s;
+ }
+
+ public function new (text:String)
+ {
+ var textFormat = new TextFormat(null, 25);
+
+ var over = textBox(text, downAndOverColor, textFormat, 10.0, 50, 2 );
+ var up = textBox(text, upColor, textFormat, 10.0, 50, 2 );
+
+ super( up , over, over, over);
+ this.enabled = true;
+ }
+
+}
+
+class Wiggler extends Sprite
+{
+ var path:Array<Point> = [];
+ var circles:Array<MovingColoredCircle> = [];
+
+ public function new (path:Array<Point>)
+ {
+ super();
+ this.path = path;
+ }
+
+}
+
+
+class DrawingScreen extends Sprite
+{
+
+ /* the prupose of which is to produce a path of a closed polygon
+ suitable for passing in as the "skin" of a wiggler. */
+
+ var path: Array<Point> = [];
+
+
+ public function new ()
+ {
+ super();
+ }
+
+ /* Event Handling */
+
+ function onMouseDown (e) {}
+ function onMouseUp (e) {}
+ function onMouseOut (e) {}
+ function onMouseMove (e) {}
+
+}
+
+
+class Main extends Sprite
+{
+ public function new()
+ {
+ super();
+ var b = new Button("hey");
+ b.x = 100; b.y = 100;
+ addChild(b);
+ }
+
+
+}
diff --git a/Source/Main.hx~ b/Source/Main.hx~
new file mode 100644
index 0000000..11ea683
--- /dev/null
+++ b/Source/Main.hx~
@@ -0,0 +1,11 @@
+package;
+
+import openfl.display.Sprite;
+
+class Main extends Sprite
+{
+ public function new()
+ {
+ super();
+ }
+}
diff --git a/WiggleWorldApp.hxproj b/WiggleWorldApp.hxproj
new file mode 100644
index 0000000..650df96
--- /dev/null
+++ b/WiggleWorldApp.hxproj
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project version="2">
+ <!-- Output SWF options -->
+ <output>
+ <movie outputType="CustomBuild" />
+ <movie input="" />
+ <movie path="project.xml" />
+ <movie fps="30" />
+ <movie width="800" />
+ <movie height="600" />
+ <movie version="1" />
+ <movie minorVersion="0" />
+ <movie platform="Lime" />
+ <movie background="#FFFFFF" />
+ <movie preferredSDK=";3;" />
+ </output>
+ <!-- Other classes to be compiled into your SWF -->
+ <classpaths>
+ <class path="Source" />
+ </classpaths>
+ <!-- Build options -->
+ <build>
+ </build>
+ <!-- haxelib libraries -->
+ <haxelib>
+ <!-- example: <library name="..." /> -->
+ </haxelib>
+ <!-- Class files to compile (other referenced classes will automatically be included) -->
+ <compileTargets>
+ <!-- example: <compile path="..." /> -->
+ </compileTargets>
+ <!-- Paths to exclude from the Project Explorer tree -->
+ <hiddenPaths>
+ <hidden path="obj" />
+ </hiddenPaths>
+ <!-- Executed before build -->
+ <preBuildCommand>"$(CompilerPath)/haxelib" run lime build "$(OutputFile)" $(TargetBuild) -$(BuildConfig) -Dfdb</preBuildCommand>
+ <!-- Executed after build -->
+ <postBuildCommand alwaysRun="False" />
+ <!-- Other project options -->
+ <options>
+ <option showHiddenPaths="False" />
+ <option testMovie="Custom" />
+ <option testMovieCommand="" />
+ </options>
+ <!-- Plugin storage -->
+ <storage />
+</project> \ No newline at end of file
diff --git a/project.xml b/project.xml
new file mode 100644
index 0000000..4b92330
--- /dev/null
+++ b/project.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project>
+ <meta title="WiggleWorldApp"
+ package="space.toyful.wiggleworld"
+ version="1.0.0"
+ company="Toyful Space" />
+
+ <app main="Main" path="Export" file="WiggleWorldApp" />
+
+ <source path="Source" />
+
+ <haxelib name="openfl" />
+
+ <assets path="Assets" rename="assets" />
+
+</project>