Initial checkin with 3d part complete
This commit is contained in:
56
.gitignore
vendored
Normal file
56
.gitignore
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
# soundwell3
|
||||
#
|
||||
#
|
||||
|
||||
out/
|
||||
|
||||
|
||||
### Emacs ###
|
||||
# -*- mode: gitignore; -*-
|
||||
*~
|
||||
\#*\#
|
||||
/.emacs.desktop
|
||||
/.emacs.desktop.lock
|
||||
*.elc
|
||||
auto-save-list
|
||||
tramp
|
||||
.\#*
|
||||
|
||||
# Org-mode
|
||||
.org-id-locations
|
||||
*_archive
|
||||
|
||||
# flymake-mode
|
||||
*_flymake.*
|
||||
|
||||
# eshell files
|
||||
/eshell/history
|
||||
/eshell/lastdir
|
||||
|
||||
# elpa packages
|
||||
/elpa/
|
||||
|
||||
# reftex files
|
||||
*.rel
|
||||
|
||||
# AUCTeX auto folder
|
||||
/auto/
|
||||
|
||||
# cask packages
|
||||
.cask/
|
||||
dist/
|
||||
|
||||
# Flycheck
|
||||
flycheck_*.el
|
||||
|
||||
# server auth directory
|
||||
/server/
|
||||
|
||||
# projectiles files
|
||||
.projectile
|
||||
|
||||
# directory configuration
|
||||
.dir-locals.el
|
||||
|
||||
# network security
|
||||
/network-security.data
|
97
Makefile
Normal file
97
Makefile
Normal file
@ -0,0 +1,97 @@
|
||||
VERSION=0.0.1
|
||||
|
||||
HAXE=/usr/bin/haxe
|
||||
SRC=src/Hello.hx
|
||||
|
||||
JSLIBS=-L heaps
|
||||
LIBS=$(JSLIBS) -L hlsdl -L hlopenal
|
||||
|
||||
CC=clang
|
||||
CFLAGS=-O2 -I. -std=c11
|
||||
CLIBS=-lm -luv -lhl
|
||||
|
||||
all: run
|
||||
all-build: build build-native
|
||||
|
||||
build: out/hello.hl out/res
|
||||
cp /usr/local/lib/*.hdll out/
|
||||
touch out/.stamp
|
||||
|
||||
build-native: build build/stamp out/linux/res out/linux/hello-linux64-native
|
||||
cp linux-libs/* out/linux
|
||||
|
||||
build-windows: build/stamp build/hello.c out/windows/res
|
||||
cp windows-libs/* out/windows/
|
||||
echo "Now build the exe in windows."
|
||||
|
||||
build-web: build out/hello.js
|
||||
build-web-dist: out/hello-demo.zip
|
||||
|
||||
build/stamp: src/Hello.hx
|
||||
mkdir -p build
|
||||
grep 'final APP_VERSION' src/Hello.hx | tr -d '";' |cut -d'=' -f2 | tr -d ' ' > build/stamp
|
||||
|
||||
out/hello-demo.zip: build-web out/res
|
||||
(cd out; rm hello-demo.zip; zip -r hello-demo.zip index.html res/ hello.js)
|
||||
|
||||
out/res:
|
||||
rm -fr out/res/
|
||||
mkdir -p out/res/
|
||||
cp -R res/ out/
|
||||
|
||||
out/linux/res: out/res
|
||||
rm -fr out/linux/res
|
||||
mkdir -p out/linux
|
||||
cp -R out/res out/linux/res
|
||||
|
||||
out/windows/res: out/res
|
||||
rm -fr out/windows/res
|
||||
mkdir -p out/windows
|
||||
cp -R out/res out/windows/res
|
||||
|
||||
build/hello.c: build/stamp $(SRC)
|
||||
$(HAXE) -D no-traces -cp src $(LIBS) --hl build/hello.c --main Hello
|
||||
|
||||
out/hello.hl: $(SRC)
|
||||
$(HAXE) -cp src $(LIBS) --hl $@ --main Hello --debug
|
||||
|
||||
build/hello.o: build/hello.c
|
||||
(cd build; $(CC) $(CFLAGS) -c -o hello.o hello.c)
|
||||
|
||||
# fixme move to a docker build image so we can control the GLIBC version. and we can target a bunch of specific linuces
|
||||
out/linux/hello-linux64-native: out/linux/res build/hello.o
|
||||
cp linux-libs/* build/
|
||||
(cd build; $(CC) $(CFLAGS) hello.o $(CLIBS) *.hdll -o hello)
|
||||
cp build/hello out/linux/hello-linux64-native
|
||||
cp linux-manifest/* out/linux
|
||||
cp linux-libs/* out/linux
|
||||
|
||||
out/index.html: index.html
|
||||
cp index.html out/
|
||||
|
||||
out/hello.js: out/res out/index.html
|
||||
$(HAXE) -cp src $(JSLIBS) -js $@ -main Hello
|
||||
|
||||
package: out/linux/hello-linux64-native out/windows/hello.exe
|
||||
cp -R windows-manifest/* out/windows
|
||||
cp -R linux-manifest/* out/linux
|
||||
mkdir -p dist
|
||||
rm -f dist/hello-linux-$(VERSION).zip
|
||||
rm -f dist/hello-windows-$(VERSION).zip
|
||||
(cd out/linux; zip -r ../../dist/hello-linux-$(VERSION).zip .)
|
||||
(cd out/windows; zip -r ../../dist/hello-windows-$(VERSION).zip .)
|
||||
|
||||
clean:
|
||||
rm -fr out/
|
||||
rm -f src/*~
|
||||
rm -f *~
|
||||
rm -fr build/
|
||||
|
||||
reqs:
|
||||
haxelib install heaps
|
||||
haxelib install hashlink
|
||||
|
||||
run: out/hello.hl out/res
|
||||
(cd out; hl hello.hl)
|
||||
|
||||
.PHONY: build clean reqs run build-native build-web-dist build-web package
|
7
README.md
Normal file
7
README.md
Normal file
@ -0,0 +1,7 @@
|
||||
# Hello Heaps!
|
||||
|
||||
This is a little template project which is similar to what we use when bootstrapping a Heaps project.
|
||||
|
||||
It contains the bulid framework and some useful build utility stuff. It is a little opinionated, but hopefully useful!
|
||||
|
||||
Soon it will have a lot of the common functionality we use to build our projects.
|
9
TODO
Normal file
9
TODO
Normal file
@ -0,0 +1,9 @@
|
||||
* Add 2d stuff
|
||||
* Add sound stuff
|
||||
* Maybe switch to PBR, or show both
|
||||
* Add keyboard handling framework(s) and keybindings
|
||||
* Add simple GUI library we use for SoundWell
|
||||
* Add all of the stuff we use from Rubralib (our common functionality library)
|
||||
* Add utilities to rebuild HDLLs on both platforms
|
||||
* Work out static compiling on linux, or at least platform-package or Flatpak builds
|
||||
* More documentation about the various tips, tricks and discoveries that went into this.
|
39
build-windows.sh
Executable file
39
build-windows.sh
Executable file
@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
#FIXME we may be able to do this with a Makefile
|
||||
VCC="/cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe"
|
||||
RC="/cygdrive/c/Program Files (x86)/Windows Kits/10/bin/10.0.22621.0/x64/rc.exe"
|
||||
|
||||
# H: is a mount of home directory
|
||||
SRC=/cygdrive/h/aldercone/soundwell/soundwell3
|
||||
HL=/cygdrive/h/software/hashlink-1.14.0-win/
|
||||
BUILD=/cygdrive/c/Users/Alder/build/sw3-build
|
||||
|
||||
VER=$(cat $SRC/build/stamp)
|
||||
IVER=$(echo $VER | tr '.' ',')",0"
|
||||
|
||||
echo "Building SoundWell3 $VER ($IVER)"
|
||||
|
||||
# copy generated source and hashlink api
|
||||
rm -r "$BUILD"-old || /bin/true
|
||||
mv "$BUILD" "$BUILD"-old || /bin/true
|
||||
cp -R "$SRC/build/" "$BUILD"
|
||||
cp "$SRC/windows-build/"* "$BUILD"
|
||||
cp -R "$HL" "$BUILD/hashlink"
|
||||
|
||||
# build using VCC
|
||||
. /cygdrive/h/aldercone/WINDOWS-CMD-ENVIRONMENT-x64.sh
|
||||
|
||||
pushd "$BUILD"
|
||||
|
||||
sed -e "s;%IVER%;$IVER;g" -e "s;%VER%;$VER;g" <soundwell3.rc>soundwell-done.rc
|
||||
|
||||
"$RC" soundwell-icon.rc
|
||||
"$RC" soundwell-done.rc
|
||||
|
||||
|
||||
"$VCC" -I. '-Ihashlink\include' soundwell3.c 'hashlink\*.lib' /link /subsystem:windows soundwell-icon.res soundwell-done.res
|
||||
mkdir -p "$SRC/out/windows" || /bin/true
|
||||
cp soundwell3.exe "$SRC/out/windows"
|
||||
popd
|
BIN
linux-libs/fmt.hdll
Executable file
BIN
linux-libs/fmt.hdll
Executable file
Binary file not shown.
BIN
linux-libs/mysql.hdll
Executable file
BIN
linux-libs/mysql.hdll
Executable file
Binary file not shown.
BIN
linux-libs/openal.hdll
Executable file
BIN
linux-libs/openal.hdll
Executable file
Binary file not shown.
BIN
linux-libs/sdl.hdll
Executable file
BIN
linux-libs/sdl.hdll
Executable file
Binary file not shown.
BIN
linux-libs/sqlite.hdll
Executable file
BIN
linux-libs/sqlite.hdll
Executable file
Binary file not shown.
BIN
linux-libs/ssl.hdll
Executable file
BIN
linux-libs/ssl.hdll
Executable file
Binary file not shown.
BIN
linux-libs/ui.hdll
Executable file
BIN
linux-libs/ui.hdll
Executable file
Binary file not shown.
BIN
linux-libs/uv.hdll
Executable file
BIN
linux-libs/uv.hdll
Executable file
Binary file not shown.
0
linux-manifest/.manifest
Normal file
0
linux-manifest/.manifest
Normal file
BIN
res/images/aldercone.png
Normal file
BIN
res/images/aldercone.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 47 KiB |
87
src/Hello.hx
Normal file
87
src/Hello.hx
Normal file
@ -0,0 +1,87 @@
|
||||
|
||||
/// A hello-world Heaps project with both 2d and 3d rendering.
|
||||
class Hello extends hxd.App {
|
||||
// This is a static var so we can locate the active app instance from other objects easily.
|
||||
public static var activeApp: Hello;
|
||||
|
||||
// This is metadata we can extract for use elsewhere, or in messages or whatever.
|
||||
static public final APP_NAME = "Aldercone Hello Heaps";
|
||||
static public final APP_VERSION = "0.0.1";
|
||||
static public final APP_AUTHOR = "Aldercone Studio Collective";
|
||||
static public final APP_COPYRIGHT = "©Copyright 2025";
|
||||
|
||||
// other static/final stuff can be here, like templates, constants, and whatever.
|
||||
public final ROTATION_SPEED=0.8; // radians / s
|
||||
|
||||
// gamestate variables and stuff can go here
|
||||
public var cube: h3d.scene.Mesh;
|
||||
|
||||
/// This sets up the game state, creates any objects that are there by default, etc. For multiple-state
|
||||
// games consider having functions which setup those states, and then calling the 'default' from here.
|
||||
// (eg. a state for main menu with an entirely different scene, a state for gameplay or whatever)
|
||||
override function init() {
|
||||
super.init();
|
||||
// assign whatever the active instance is.
|
||||
Hello.activeApp = this;
|
||||
|
||||
// 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.
|
||||
cubeprim.translate(-0.5, -0.5, -0.5);
|
||||
cubeprim.unindex(); // idk, the demo does this
|
||||
cubeprim.addNormals(); // create normals for the faces
|
||||
cubeprim.addUVs(); // create UV (texture) coordinates for the faces
|
||||
|
||||
// load a texture from the res/ folder or the resources
|
||||
var texture = hxd.Res.images.aldercone.toTexture(); // this is the semi-magical way to do this, you can also specify
|
||||
// a filename
|
||||
var material = h3d.mat.Material.create(texture); // this creates a material, with other properties like emissivity, glossyness etc.
|
||||
|
||||
// Actually create the scenegraph object, which is a mesh
|
||||
this.cube = new h3d.scene.Mesh(cubeprim, material, s3d); // Note: s3d is a global variable pointing at the top level
|
||||
// 3d scene which contains the 3d objects in the scenegraph
|
||||
|
||||
// add some point lights to the scene (note the lighting model in the 'forward' renderer is weird) FIXME we should switch to PBR since the results are more predictable and less weird looking in Heaps 2 and above
|
||||
var light = new h3d.scene.fwd.PointLight(s3d);
|
||||
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;
|
||||
|
||||
light = new h3d.scene.fwd.PointLight(s3d);
|
||||
light.setPosition(0, -10, -10);
|
||||
light.enableSpecular = true;
|
||||
|
||||
// show a little 2d stuff
|
||||
// load a font from the resources
|
||||
|
||||
// write some text on screen
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// This function is called each frame with a number of seconds passed since last call.
|
||||
override public function update(dt: Float) {
|
||||
super.update(dt);
|
||||
|
||||
// rotate the cube
|
||||
cube.rotate(dt * -1 * ROTATION_SPEED, dt * ROTATION_SPEED, dt * ROTATION_SPEED);
|
||||
}
|
||||
|
||||
// This overrides the main function, and sets up the resource loader prior to creating the main object.
|
||||
static function main(): Void {
|
||||
#if js
|
||||
hxd.Res.initEmbed();
|
||||
#else
|
||||
hxd.Res.initLocal();
|
||||
#end
|
||||
new Hello();
|
||||
}
|
||||
|
||||
}
|
16
web-manifest/index.html
Normal file
16
web-manifest/index.html
Normal file
@ -0,0 +1,16 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Hello Heaps Aldercone Studio Collective</title>
|
||||
<style>
|
||||
body { margin:0;padding:0;background-color:black; }
|
||||
canvas#webgl { width:90%;height:90%; border: 1px solid white; margin-left: 5%; margin-right: 5%;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="webgl"></canvas>
|
||||
<script src="hello.js"></script>
|
||||
</body>
|
||||
</html>
|
BIN
windows-libs/OpenAL32.dll
Normal file
BIN
windows-libs/OpenAL32.dll
Normal file
Binary file not shown.
BIN
windows-libs/SDL2.dll
Normal file
BIN
windows-libs/SDL2.dll
Normal file
Binary file not shown.
BIN
windows-libs/directx.hdll
Normal file
BIN
windows-libs/directx.hdll
Normal file
Binary file not shown.
BIN
windows-libs/dx12.hdll
Normal file
BIN
windows-libs/dx12.hdll
Normal file
Binary file not shown.
BIN
windows-libs/fmt.hdll
Normal file
BIN
windows-libs/fmt.hdll
Normal file
Binary file not shown.
BIN
windows-libs/libhl.dll
Normal file
BIN
windows-libs/libhl.dll
Normal file
Binary file not shown.
BIN
windows-libs/mysql.hdll
Normal file
BIN
windows-libs/mysql.hdll
Normal file
Binary file not shown.
BIN
windows-libs/openal.hdll
Normal file
BIN
windows-libs/openal.hdll
Normal file
Binary file not shown.
BIN
windows-libs/sdl.hdll
Normal file
BIN
windows-libs/sdl.hdll
Normal file
Binary file not shown.
BIN
windows-libs/sqlite.hdll
Normal file
BIN
windows-libs/sqlite.hdll
Normal file
Binary file not shown.
BIN
windows-libs/ssl.hdll
Normal file
BIN
windows-libs/ssl.hdll
Normal file
Binary file not shown.
BIN
windows-libs/ui.hdll
Normal file
BIN
windows-libs/ui.hdll
Normal file
Binary file not shown.
BIN
windows-libs/uv.hdll
Normal file
BIN
windows-libs/uv.hdll
Normal file
Binary file not shown.
BIN
windows-libs/vcruntime140.dll
Normal file
BIN
windows-libs/vcruntime140.dll
Normal file
Binary file not shown.
0
windows-manifest/.manifest
Normal file
0
windows-manifest/.manifest
Normal file
Reference in New Issue
Block a user