Add basic 2d stuff, and also update TODO
This commit is contained in:
48
src/Hello.hx
48
src/Hello.hx
@ -24,8 +24,7 @@ class Hello extends hxd.App {
|
||||
// assign whatever the active instance is.
|
||||
Hello.activeApp = this;
|
||||
|
||||
// Setup default game state.
|
||||
|
||||
/// Setup default game state.
|
||||
// make a cube (all of this is pretty specific to built-in prims and not 3d objects in general)
|
||||
var cubeprim = new h3d.prim.Cube();
|
||||
// the cube prim usually translates/rotates around its corner, instead move it to translate around center.
|
||||
@ -48,8 +47,6 @@ class Hello extends hxd.App {
|
||||
light.setPosition(s3d.camera.pos.x, s3d.camera.pos.y, s3d.camera.pos.z);
|
||||
light.enableSpecular = true;
|
||||
|
||||
trace(s3d.camera.pos);
|
||||
|
||||
light = new h3d.scene.fwd.PointLight(s3d);
|
||||
light.setPosition(2, -3, -4);
|
||||
light.enableSpecular = true;
|
||||
@ -58,11 +55,50 @@ class Hello extends hxd.App {
|
||||
light.setPosition(0, -10, -10);
|
||||
light.enableSpecular = true;
|
||||
|
||||
// show a little 2d stuff
|
||||
/// 2d stuff
|
||||
//
|
||||
// make the 2d scene scale with window size (with a 16:9 ratio)
|
||||
s2d.scaleMode = h2d.ScaleMode.LetterBox(1920, 1080);
|
||||
|
||||
// draw some pretty GUI decorations with the Graphics object. We can assume a
|
||||
// 1920 x 1080 canvas that will be scaled to the window.
|
||||
var guigfx = new h2d.Graphics(s2d);
|
||||
guigfx.lineStyle(2, 0xFFFFFF);
|
||||
guigfx.moveTo(20, 100);
|
||||
guigfx.lineTo(20, 20);
|
||||
guigfx.lineTo(100, 20);
|
||||
|
||||
guigfx.moveTo(1920 - 20, 100);
|
||||
guigfx.lineTo(1920 - 20, 20);
|
||||
guigfx.lineTo(1920 - 100, 20);
|
||||
|
||||
guigfx.moveTo(1920 - 20, 1080 - 100);
|
||||
guigfx.lineTo(1920 - 20, 1080 - 20);
|
||||
guigfx.lineTo(1920 - 100, 1080 - 20);
|
||||
|
||||
guigfx.moveTo(20, 1080 - 100);
|
||||
guigfx.lineTo(20, 1080 - 20);
|
||||
guigfx.lineTo(100, 1080 - 20);
|
||||
|
||||
// load a font from the resources
|
||||
var font = hxd.Res.fonts.inter38.toFont();
|
||||
// add a text object to the gui
|
||||
var text = new h2d.Text(font);
|
||||
s2d.addChild(text);
|
||||
text.x = 120;
|
||||
text.y = 5;
|
||||
text.text = "Hello, Heaps!";
|
||||
|
||||
// write some text on screen
|
||||
/// Setup keyboard handling
|
||||
//
|
||||
// ...
|
||||
|
||||
// Setup window;
|
||||
var w = hxd.Window.getInstance();
|
||||
//w.addEventTarget(this.topEventHandler);
|
||||
w.title = Hello.APP_NAME + " " + Hello.APP_VERSION;
|
||||
// w.displayMode = hxd.Window.DisplayMode.Borderless;
|
||||
w.resize(1280, 720);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user