mirror of
https://github.com/PoetryInCode/simple-rigid-sim.git
synced 2025-04-24 03:47:15 -04:00
porting to wasm/emscripten
still in progress, not yet functional
This commit is contained in:
parent
7f1713c2d7
commit
358b29379b
28
Makefile
28
Makefile
@ -1,29 +1,31 @@
|
||||
CC = clang
|
||||
LINK = -lstdc++ -lSDL2 -lm -ldl #-lSDL_gfx
|
||||
DBG = -Wall -g -gmodules -O0
|
||||
CC = em++
|
||||
LINK = -s USE_SDL=2#-lstdc++ -lSDL2 -lm -ldl #-lSDL_gfx
|
||||
DBG = -g -s LLD_REPORT_UNDEFINED#-Wall -g -gmodules -O0
|
||||
CC += $(DBG)
|
||||
|
||||
all: build ;
|
||||
|
||||
goals = bin/main.o bin/Color.o bin/Quad.o bin/Vector.o bin/phys_obj.o bin/BoundingBox.o bin/Circle.o
|
||||
#goals = bin/main.o bin/Color.o bin/Quad.o bin/Vector.o bin/phys_obj.o bin/BoundingBox.o bin/Circle.o
|
||||
|
||||
goals = bin/main.wasm bin/Color.wasm bin/Quad.wasm bin/Vector.wasm bin/phys_obj.wasm bin/BoundingBox.wasm bin/Circle.wasm
|
||||
|
||||
define pro =
|
||||
$(CC) -c $^ -o $@
|
||||
$(CC) $^ -o $@
|
||||
endef
|
||||
|
||||
bin/main.o: src/main.cpp
|
||||
bin/main.wasm: src/main.cpp
|
||||
$(pro)
|
||||
bin/BoundingBox.o: src/BoundingBox.cpp
|
||||
bin/BoundingBox.wasm: src/BoundingBox.cpp
|
||||
$(pro)
|
||||
bin/Color.o: src/Color.cpp
|
||||
bin/Color.wasm: src/Color.cpp
|
||||
$(pro)
|
||||
bin/Quad.o: src/Quad.cpp
|
||||
bin/Quad.wasm: src/Quad.cpp
|
||||
$(pro)
|
||||
bin/Vector.o: src/Vector.cpp
|
||||
bin/Vector.wasm: src/Vector.cpp
|
||||
$(pro)
|
||||
bin/phys_obj.o: src/phys_obj.cpp
|
||||
bin/phys_obj.wasm: src/phys_obj.cpp
|
||||
$(pro)
|
||||
bin/Circle.o: src/Circle.cpp
|
||||
bin/Circle.wasm: src/Circle.cpp
|
||||
$(pro)
|
||||
|
||||
#targets = $(patsubst bin/%.o,src/%.cpp,$(goals))
|
||||
@ -34,7 +36,7 @@ bin/Circle.o: src/Circle.cpp
|
||||
# ))
|
||||
|
||||
build: $(goals) ;
|
||||
$(CC) $(goals) -o ./bin/simulator $(LINK)
|
||||
$(CC) $(goals) -o ./bin/simulator.html $(LINK)
|
||||
|
||||
#bin/%.o : src/%.cpp ;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef CIRCLE
|
||||
#define CIRCLE
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL.h>
|
||||
#include <cmath>
|
||||
#include "Vector.h"
|
||||
#include "Color.h"
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef QUAD
|
||||
#define QUAD
|
||||
#include <vector>
|
||||
#include "SDL2/SDL.h"
|
||||
//#include "SDL2/SDL.h"
|
||||
#include "Vector.h"
|
||||
#include "Color.h"
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <iostream>
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL2/SDL_timer.h>
|
||||
#include <SDL2/SDL2_gfxPrimitives.h>
|
||||
#include <SDL.h>
|
||||
#include <SDL_timer.h>
|
||||
//#include <SDL2_gfxPrimitives.h>
|
||||
#include "phys_obj.h"
|
||||
#include "Circle.h"
|
||||
#include <time.h>
|
||||
@ -191,7 +191,7 @@ int main() {
|
||||
}
|
||||
}
|
||||
int floor_dis;
|
||||
for(uint i=0; i<objs.size(); i++) {
|
||||
for(int i=0; i<objs.size(); i++) {
|
||||
floor_dis = objs[i].obj.center.distanceTo(Vector(objs[i].obj.center.x,h));
|
||||
objs[i].calculate_vectors(&objs,Vector(w,h));
|
||||
if(floor_dis >= objs[i].obj.radius) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user