From: Andy Belle-Isle Date: Sun, 13 Nov 2022 19:55:26 +0000 (-0600) Subject: Merge remote-tracking branch 'origin/lib-cleanup' into world X-Git-Url: https://code.bitgloo.com/?a=commitdiff_plain;h=38e2036d031bdeaea76ef4b6c3c2af5247ed93ec;p=clyne%2Fgamedev2.git Merge remote-tracking branch 'origin/lib-cleanup' into world --- 38e2036d031bdeaea76ef4b6c3c2af5247ed93ec diff --cc Makefile index f79435c,a14fb2b..c590bab --- a/Makefile +++ b/Makefile @@@ -82,7 -88,18 +88,20 @@@ $(OUTDIR)/%.$(OBJEXT): $(SRCDIR)/%.$(SR @sed -e 's/.*://' -e 's/\\$$//' < $(OUTDIR)/$*.$(DEPEXT).tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $(OUTDIR)/$*.$(DEPEXT) @rm -f $(OUTDIR)/$*.$(DEPEXT).tmp +mem: $(EXEC) + valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes ./$(EXEC) + - .PHONY: all remake clean cleaner resources mem + lib/libentityx.a: + @cmake -S lib/entityx -B lib/entityx -DENTITYX_BUILD_SHARED=FALSE + @make -Clib/entityx -j4 entityx + @cp lib/entityx/libentityx.a lib/libentityx.a + + lib/libluajit.a: + @make -Clib/luajit -j4 + @cp lib/luajit/src/libluajit.a lib/libluajit.a + + lib/libsoil.a: + @make -Clib/soil -j4 + @cp lib/soil/libsoil.a lib/libsoil.a + -.PHONY: all remake clean cleaner cleanall resources - ++.PHONY: all remake clean cleaner cleanall resources mem diff --cc Scripts/init.lua index 80fee32,66fbcb1..60f21c6 --- a/Scripts/init.lua +++ b/Scripts/init.lua @@@ -38,24 -36,16 +39,29 @@@ player = x = 0.0, y = 0.0 }, - Physics = 0, + Physics = { + hitbox = { + ll = {x = -0.5, y = -0.8}, + lr = {x = 0.5, y = -0.8}, + ul = {x = -0.5, y = 0.8}, + ur = {x = 0.5, y = 0.8}, + } + }, Name = "bord", + Audio = { + file = "Assets/jump.wav" + }, + hellotrue = true, + hellofalse = false, Render = { texture = "Assets/player.png", - visible = true + visible = true, + offset = { + ll = {x = -0.5, y = -0.8}, + lr = {x = 0.5, y = -0.8}, + ul = {x = -0.5, y = 0.8}, + ur = {x = 0.5, y = 0.8}, + } }, Light = { r = 1.0, diff --cc Scripts/world.lua index 1fb74d2,bb6c61e..ec43025 --- a/Scripts/world.lua +++ b/Scripts/world.lua @@@ -1,30 -1,110 +1,30 @@@ - newWorld = { -world = { - Seed = 5345345, - Layers = 2, - - -- This is run when the world is registered and not after, - -- although it is possible to register materials later ++local newWorld = { Register = function(self) - - -- TODO make world have global textures to speed up rendering - - self:registerMaterial("grass", { - -- TODO combine both of these into 1 - texture = { - file = "Assets/world.png", - offset = { x = 0, y = 0 }, - size = { x = 64, y = 64 } - }, - normal = { - file = "Assets/world_normal.png", - offset = { x = 0, y = 0 }, - size = { x = 64, y = 64 } - } + self.unitSize = 8; + self:createLayer(0, { + texture = { file = "Assets/world/world1/layers/0/texture.png" }, + normal = { file = "Assets/world/world1/layers/0/normal.png" }, + hitbox = "Assets/world/world1/layers/0/hitbox.png" }); - self:registerMaterial("dirt", { - texture = { - file = "Assets/world.png", - offset = { x = 64, y = 0 }, - size = { x = 64, y = 64 } - }, - normal = { - file = "Assets/world_normal.png", - offset = { x = 64, y = 0 }, - size = { x = 64, y = 64 } - } + self:createLayer(1, { + texture = { file = "Assets/world/world1/layers/1/texture.png" }, + normal = { file = "Assets/world/world1/layers/1/normal.png" }, + hitbox = "Assets/world/world1/layers/1/hitbox.png" }); - self:registerMaterial("stone", { - texture = { - file = "Assets/world.png", - offset = { x = 128, y = 0 }, - size = { x = 64, y = 64 } - }, - normal = { - file = "Assets/world_normal.png", - offset = { x = 128, y = 0 }, - size = { x = 64, y = 64 } - } + self:createDecoLayer(7, { + texture = { file = "Assets/world/world1/layers/deco/forestTileBack.png" }, + normal = { file = "Assets/world/world1/layers/deco/normal.png" }, }); - self:registerMaterial("flower", { - texture = { - file = "Assets/world.png", - offset = { x = 192, y = 0 }, - size = { x = 64, y = 64 } - }, - normal = { - file = "Assets/world_normal.png", - offset = { x = 192, y = 0 }, - size = { x = 64, y = 64 } - }, - passable = true + self:createDecoLayer(5.5, { + texture = { file = "Assets/world/world1/layers/deco/forestTileMid.png" }, + normal = { file = "Assets/world/world1/layers/deco/normal.png" }, }); - self:registerMaterial("trunk", { - texture = { - file = "Assets/world.png", - offset = { x = 256, y = 0 }, - size = { x = 64, y = 64 } - }, - normal = { - file = "Assets/world_normal.png", - offset = { x = 256, y = 0 }, - size = { x = 64, y = 64 } - } + self:createDecoLayer(4, { + texture = { file = "Assets/world/world1/layers/deco/forestTileFront.png" }, + normal = { file = "Assets/world/world1/layers/deco/normal.png" }, }); end, - Generate = function(self) - math.randomseed(self.Seed) - xsize, ysize, zsize = self:setSize(250, 128, 3) - for Z = 0,zsize-1 do - for X = 0,xsize-1 do - if Z == 0 then - YGen = math.floor(6*math.sin(X/20)) + 64 - elseif Z == 1 then - YGen = math.floor(9*math.sin(X/20)) + 64 - else - YGen = math.floor(15*math.sin(X/20)) + 64 - end - YDepth = math.random(3,5) - for Y = 0,ysize-1 do - if Y == YGen then - self:setData(X, Y, Z, "grass"); - elseif Y < YGen and Y > (YGen - YDepth) then - self:setData(X, Y, Z, "dirt"); - elseif Y < YGen then - self:setData(X, Y, Z, "stone"); - elseif Y == YGen + 1 then - if math.random(0, 100) == 53 then - self:setData(X, Y, Z, "flower"); - elseif math.random(0, 100) == 45 then - self:setData(X, Y, Z, "trunk"); - end - end - --print(X..","..Y..","..Z); - end - end - end - --self:setData(1000, 1345, 5, "grass"); -- Test error checking - print("Done with world gen"); end } diff --cc lib/entityx index 0000000,e04b856..3989cf4 mode 000000,160000..160000 --- a/lib/entityx +++ b/lib/entityx @@@ -1,0 -1,1 +1,1 @@@ -Subproject commit e04b856006cfe6b7e8ba5d6c1434331351cc791a ++Subproject commit 3989cf4cf81da1077a501a1d53e6114f55b812f9 diff --cc lib/sol2 index 0000000,4de99c5..50b62c9 mode 000000,160000..160000 --- a/lib/sol2 +++ b/lib/sol2 @@@ -1,0 -1,1 +1,1 @@@ -Subproject commit 4de99c5b41b64b7e654bf8e48b177e8414a756b7 ++Subproject commit 50b62c9346750b7c2c406c9e4c546f96b0bf021d diff --cc src/script.cpp index 4fda543,9fae1c9..b1d82e9 --- a/src/script.cpp +++ b/src/script.cpp @@@ -120,9 -120,12 +121,13 @@@ void ScriptSystem::scriptExport(void lua.new_usertype("Physics", sol::constructors(), - "standing", &Physics::standing); + "standing", &Physics::standing, + "gravity", &Physics::gravity); + lua.new_usertype