Skip to content

Commit f3392e9

Browse files
committed
melhorias e correções de bug = release
1 parent fa2628d commit f3392e9

File tree

16 files changed

+305
-29
lines changed

16 files changed

+305
-29
lines changed

docs/api.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,6 +1796,12 @@ function engine.audio.resume(id = number) end
17961796
function engine.audio.restart(id = number) end
17971797
```
17981798

1799+
## Stop Audio
1800+
1801+
```lua
1802+
function engine.audio.stop(id = number) end
1803+
```
1804+
17991805
## Check if audio has finished playing
18001806

18011807
```lua
@@ -2067,6 +2073,38 @@ Return a vec4 that is the multiplication between a mat4 and vec4
20672073
function engine.math.multiply(mat4, vec4)
20682074
```
20692075

2076+
## Magnitude Vec2
2077+
2078+
Return the magnitude of a vec2
2079+
2080+
```lua
2081+
function engine.math.mag_vec2(vec2)
2082+
```
2083+
2084+
## Magnitude Vec3
2085+
2086+
Return the magnitude of a vec3
2087+
2088+
```lua
2089+
function engine.math.mag_vec3(vec3)
2090+
```
2091+
2092+
## Normalize Vec2
2093+
2094+
Return the normalized vec2
2095+
2096+
```lua
2097+
function engine.math.normalize_vec2(vec2)
2098+
```
2099+
2100+
## Normalize Vec3
2101+
2102+
Return the normalized vec3
2103+
2104+
```lua
2105+
function engine.math.normalize_vec3(vec3)
2106+
```
2107+
20702108
# Object Module
20712109

20722110
## Open 3D Model

release1.0.1/BoxEngine.exe

4.5 KB
Binary file not shown.

release1.0.1/docs/api.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,6 +1796,12 @@ function engine.audio.resume(id = number) end
17961796
function engine.audio.restart(id = number) end
17971797
```
17981798

1799+
## Stop Audio
1800+
1801+
```lua
1802+
function engine.audio.stop(id = number) end
1803+
```
1804+
17991805
## Check if audio has finished playing
18001806

18011807
```lua
@@ -2067,6 +2073,38 @@ Return a vec4 that is the multiplication between a mat4 and vec4
20672073
function engine.math.multiply(mat4, vec4)
20682074
```
20692075

2076+
## Magnitude Vec2
2077+
2078+
Return the magnitude of a vec2
2079+
2080+
```lua
2081+
function engine.math.mag_vec2(vec2)
2082+
```
2083+
2084+
## Magnitude Vec3
2085+
2086+
Return the magnitude of a vec3
2087+
2088+
```lua
2089+
function engine.math.mag_vec3(vec3)
2090+
```
2091+
2092+
## Normalize Vec2
2093+
2094+
Return the normalized vec2
2095+
2096+
```lua
2097+
function engine.math.normalize_vec2(vec2)
2098+
```
2099+
2100+
## Normalize Vec3
2101+
2102+
Return the normalized vec3
2103+
2104+
```lua
2105+
function engine.math.normalize_vec3(vec3)
2106+
```
2107+
20702108
# Object Module
20712109

20722110
## Open 3D Model

release1.0.1/res/scripts/engine.lua

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,10 @@ function engine.audio.restart(id)
791791
return _audio_.restart(id)
792792
end
793793

794+
function engine.audio.stop(id)
795+
return _audio_.stop(id)
796+
end
797+
794798
function engine.audio.is_finished(id)
795799
return _audio_.is_finished(id)
796800
end
@@ -871,8 +875,8 @@ function engine.audio.get_volume(id)
871875
return _audio_.get_volume(id)
872876
end
873877

874-
function engine.audio.stop_all_audios(id)
875-
return _audio_.stop_all_audios(id)
878+
function engine.audio.stop_all_audios()
879+
return _audio_.stop_all_audios()
876880
end
877881

878882
function engine.audio.set_listener_position(vec3)
@@ -955,6 +959,22 @@ function engine.math.multiply(mat4, vec4)
955959
return _math_.multiply(mat4, vec4)
956960
end
957961

962+
function engine.math.mag_vec2(vec2)
963+
return _math_.mag_vec2(vec2)
964+
end
965+
966+
function engine.math.normalize_vec2(vec2)
967+
return _math_.normalize_vec2(vec2)
968+
end
969+
970+
function engine.math.mag_vec3(vec3)
971+
return _math_.mag_vec3(vec3)
972+
end
973+
974+
function engine.math.normalize_vec3(vec3)
975+
return _math_.normalize_vec3(vec3)
976+
end
977+
958978
function engine.object.open(path)
959979
return _object_.open(path)
960980
end

res/scripts/engine.lua

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,10 @@ function engine.audio.restart(id)
791791
return _audio_.restart(id)
792792
end
793793

794+
function engine.audio.stop(id)
795+
return _audio_.stop(id)
796+
end
797+
794798
function engine.audio.is_finished(id)
795799
return _audio_.is_finished(id)
796800
end
@@ -871,8 +875,8 @@ function engine.audio.get_volume(id)
871875
return _audio_.get_volume(id)
872876
end
873877

874-
function engine.audio.stop_all_audios(id)
875-
return _audio_.stop_all_audios(id)
878+
function engine.audio.stop_all_audios()
879+
return _audio_.stop_all_audios()
876880
end
877881

878882
function engine.audio.set_listener_position(vec3)
@@ -955,6 +959,22 @@ function engine.math.multiply(mat4, vec4)
955959
return _math_.multiply(mat4, vec4)
956960
end
957961

962+
function engine.math.mag_vec2(vec2)
963+
return _math_.mag_vec2(vec2)
964+
end
965+
966+
function engine.math.normalize_vec2(vec2)
967+
return _math_.normalize_vec2(vec2)
968+
end
969+
970+
function engine.math.mag_vec3(vec3)
971+
return _math_.mag_vec3(vec3)
972+
end
973+
974+
function engine.math.normalize_vec3(vec3)
975+
return _math_.normalize_vec3(vec3)
976+
end
977+
958978
function engine.object.open(path)
959979
return _object_.open(path)
960980
end

src/Editor/Screens/Inspector/Inspector.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,9 +457,9 @@ namespace Editor {
457457
if (go == nullptr)
458458
return;
459459

460+
project->UpdateScriptData(go);
460461
for (const auto& script : go->GetScripts())
461462
{
462-
script->SetUpdateScriptData(true);
463463
std::string scriptName = script->GetName();
464464

465465
bool isOpen = GUI::Header(this->guid + "header" + scriptName);

src/Engine/Project/Connections/Audio/AudioConnection.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ namespace Connection {
2424
LuaUtils::RegTable(this->state, "resume", Resume);
2525
LuaUtils::RegTable(this->state, "pause", Pause);
2626
LuaUtils::RegTable(this->state, "restart", Restart);
27+
LuaUtils::RegTable(this->state, "stop", Stop);
2728

2829
LuaUtils::RegTable(this->state, "is_finished", IsFinished);
2930

@@ -57,6 +58,7 @@ namespace Connection {
5758
LuaUtils::RegTable(this->state, "get_volume", GetVolume);
5859

5960
LuaUtils::RegTable(this->state, "set_listener_position", SetListenerPosition);
61+
LuaUtils::RegTable(this->state, "stop_all", StopAllAudios);
6062

6163
lua_setglobal(this->state, "_audio_");
6264
}
@@ -236,6 +238,29 @@ namespace Connection {
236238
return 1;
237239
}
238240

241+
int AudioConnection::Stop(lua_State* L)
242+
{
243+
auto top = lua_gettop(L);
244+
245+
if (top != 1)
246+
return luaL_error(L, "expecting 1 arguments in function call");
247+
248+
int id = 0;
249+
if (lua_isnumber(L, 1))
250+
id = lua_tonumber(L, 1);
251+
else return luaL_error(L, "argument 1 is expected to be a number");
252+
253+
auto instance = AudioConnection::Get();
254+
auto audio = instance->audios[id];
255+
256+
if (audio != nullptr)
257+
audio->Stop();
258+
259+
lua_pushboolean(L, audio != nullptr);
260+
261+
return 1;
262+
}
263+
239264
int AudioConnection::IsFinished(lua_State* L)
240265
{
241266
auto top = lua_gettop(L);

src/Engine/Project/Connections/Audio/AudioConnection.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ namespace Connection {
5454
static int Pause(lua_State* L);
5555
static int Resume(lua_State* L);
5656
static int Restart(lua_State* L);
57+
static int Stop(lua_State* L);
5758

5859
static int IsFinished(lua_State* L);
5960

0 commit comments

Comments
 (0)