Skip to content

Commit 3f928ab

Browse files
committed
rollup sample: update for latest plugin and rollup versions
1 parent 2e834c7 commit 3f928ab

File tree

5 files changed

+16
-63
lines changed

5 files changed

+16
-63
lines changed

samples/rollup/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "vite-plugin-openfl-rollup-sample",
3-
"version": "1.0.0",
3+
"version": "2.0.0",
44
"description": "Sample that demonstrates how to use vite-plugin-openfl with Rollup",
55
"repository": "https://github.com/feathersui/vite-plugin-openfl.git",
66
"devDependencies": {
7-
"rollup": "^2.79.0",
8-
"rollup-plugin-copy": "^3.4.0",
9-
"vite-plugin-openfl": "^1.0.0"
7+
"rollup": "^4.40.0",
8+
"rollup-plugin-copy": "^3.5.0",
9+
"vite-plugin-openfl": "^2.0.0"
1010
},
1111
"scripts": {
1212
"build": "rollup -c"

samples/rollup/project.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,4 @@
1717
<source path="src"/>
1818

1919
<haxelib name="openfl"/>
20-
<haxelib name="genes"/>
2120
</project>
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import openfl from "vite-plugin-openfl";
22
import copy from "rollup-plugin-copy";
3+
import { defineConfig } from "rollup";
34

4-
export default {
5+
export default defineConfig({
56
context: "window",
67
input: "project.xml",
78
output: {
@@ -15,4 +16,4 @@ export default {
1516
targets: [{ src: "public/**/*", dest: "dist" }],
1617
}),
1718
],
18-
};
19+
});

samples/rollup/src/Main.hx

Lines changed: 9 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,16 @@
1-
import com.example.MyModule;
2-
import genes.Genes;
1+
import openfl.display.Shape;
32
import openfl.display.Sprite;
4-
import openfl.events.MouseEvent;
5-
import openfl.text.TextField;
6-
import openfl.text.TextFormat;
73

84
class Main extends Sprite {
9-
private var button:Sprite;
10-
115
public function new() {
126
super();
13-
14-
button = new Sprite();
15-
button.buttonMode = true;
16-
button.mouseChildren = false;
17-
button.graphics.beginFill(0xff0000);
18-
button.graphics.drawRoundRect(0.0, 0.0, 150.0, 50.0, 10.0);
19-
button.graphics.endFill();
20-
var buttonText = new TextField();
21-
buttonText.defaultTextFormat = new TextFormat("_sans", 20, 0xffffff);
22-
buttonText.autoSize = LEFT;
23-
buttonText.text = "Click Me";
24-
buttonText.x = (button.width - buttonText.width) / 2.0;
25-
buttonText.y = (button.height - buttonText.height) / 2.0;
26-
button.x = 10.0;
27-
button.y = 10.0;
28-
button.addChild(buttonText);
29-
addChild(button);
30-
31-
button.addEventListener(MouseEvent.CLICK, onButtonClick);
32-
}
33-
34-
private function onButtonClick(event:MouseEvent):Void {
35-
button.mouseEnabled = false;
36-
button.alpha = 0.5;
37-
38-
// load the module on demand
39-
Genes.dynamicImport(MyModule -> new MyModule()).then((module) -> {
40-
module.x = 10.0;
41-
module.y = 70.0;
42-
addChild(module);
43-
});
7+
var shape = new Shape();
8+
shape.graphics.beginFill(0x0000ff);
9+
shape.graphics.drawRect(0.0, 0.0, 250.0, 150.0);
10+
shape.graphics.endFill();
11+
shape.x = 50.0;
12+
shape.y = 50.0;
13+
addChild(shape);
14+
trace("Hello World");
4415
}
4516
}

samples/rollup/src/com/example/MyModule.hx

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)