Jump to content

Yue

Members
  • Posts

    2,291
  • Joined

  • Last visited

Everything posted by Yue

  1. I don't understand the visual studio c++ compiler tells me that there is no such garbage collection function.
  2. o.O?? 1>------ Operación Compilar iniciada: proyecto: AstrocucoX, configuración: Release Win32 ------ 1>cl : Línea de comandos warning D9035: La opción 'Gm' está desusada y se quitará en próximas versiones 1>cl : Línea de comandos warning D9030: '/Gm' es incompatible con el multiprocesamiento; se omitirá el modificador /MP 1>CGUI.cpp 1>f:\leadwerks\projects\astrocucox\source\cgui.cpp(51): error C3861: 'collectgarbage': no se encontró el identificador 1>Generando código... 1>Compilando... 1>CInput.cpp 1>Generando código... 1>Omitiendo... (no se detectaron cambios relevantes) 1>main.cpp 1>CWorld.cpp 1>CWindow.cpp 1>CRover.cpp 1>CPlayer.cpp 1>Compilación del proyecto "AstrocucoX.vcxproj" terminada -- ERROR. ========== Compilar: 0 correctos, 1 incorrectos, 0 actualizados, 0 omitidos ==========
  3. void CGUI::Update() { //HideMenuStart(); << Solved temporal. if (show) { ShowMenuStart(); Time::Pause(); } else { HideMenuStart(); Time::Resume(); } if (input.GetKeyHit(Key::Escape)) { show = 1 - show; } } This partially solves the problem. When I uncomment that line of code it no longer uploads the memory when the game is paused. What happens now is that it goes up a little, for each time I make visible the start menu of the three buttons, the memory usage in C++ and in Script goes up. If someone has any idea why this happens I would appreciate it, or if it is something normal.
  4. I only have a terrain, a directional light, the character and the vehicle. The code is structured in the Input object, Player object, Rover object, Windows object. But the strange thing is that it only happens when I pause the game and show the menu. Time::Pause(). //Code Main. #include "App.h" using namespace Leadwerks; int main() { CWindow window("App Title", 1280, 720); CWorld menu; menu.LoadMap("Menu.map"); CInput input; CRover rover(input); CGUI gui(input); CPlayer player(input,rover,gui); // Bucle principal. while (!window.GetClosed()) { if (input.GetKeyDown(Key::H)) { return 0; } Time::Update(); gui.Update(); menu.Update(); menu.Render(); player.Update(); rover.Update(); window.ShowDebugInfo(); player.DrawHand(window.GetContext()); window.Update(false); } return 0; } GUI Show HIde Menu. #include "CGUI.h" using namespace Leadwerks; // Constructor. CGUI::CGUI(CInput& input) :input(input) { window = Window::GetCurrent(); context = Context::GetCurrent(); gui = GUI::Create(context); base = gui->GetBase(); StartHUD(); StartMenu(); show = 0; } void CGUI::StartHUD() { Widget* pnlHud = Widget::Panel(window->GetWidth() - 230, 10, 200, 100, base); } void CGUI::StartMenu() { pnlMenu = Widget::Panel(window->GetWidth()/2-250, window->GetHeight()-150, 500, 75, base); // Butons. btnStart = Widget::Button("START", 10, 15, 150, 50, pnlMenu); btnOptions = Widget::Button("OPTIONS", pnlMenu->GetSize(true).x/2-75,15,150,50,pnlMenu); btnExit = Widget::Button("EXIT", pnlMenu->GetSize(true).x -160, 15, 150, 50, pnlMenu); } void CGUI::HideMenuStart() { pnlMenu->Hide(); } void CGUI::ShowMenuStart() { pnlMenu->Show(); } void CGUI::Update() { HideMenuStart(); if (show) { ShowMenuStart(); Time::Pause(); } else { HideMenuStart(); Time::Resume(); } if (input.GetKeyHit(Key::Escape)) { show = 1 - show; } } bool CGUI::GetShow() { return(show); }
  5. Someone help me, is this a memory leak?
  6. I think something happened, and I'm sure I responded to this. Well the thing is, is this a memory leak?
  7. Memory remains where it was last time. For example, if the game is paused, it goes up in value, but when you continue the game, it stays at the last value. If it was for example in 100, it goes up continuously until I continue the game, and it remains in for example in 500, if I pause it again it continues going up.
  8. When I set Time::Pause(); it starts to increase the memory usage drastically, both in script and in c++, is that a normal memory leak?
  9. Why does the C++ script memory go up?
  10. GetKeyValue("name");
  11. What is the origin of the lightning?, a mesh? Edit: pickInfo.entity:Hide() --<<< Test.
  12. Yue

    Terrain Painting

    Customized brushes for ground sculpting?
  13. It's amazing that when I see things like this, I am reminded that the Leadwerks engine is very complete and that I am the bad programmer. I'm still learning.
  14. Yue

    pfx_pow.png

    Awwwww, the third image, my obsetion with mars, is great.
  15. Well, dabbling in C++, the results delight me in terms of performance, and focused on optimizing my code, I have to say I thought I would never do things in c++, and in relation to Lua, I feel like I'm a real programmer. xD Sure, the process is slower, the compile times a bit longer, it's just habit, but the performance is encouraging. Besides learning new concepts of classes, constructors, destructors, pointers, all this in coordination with ChatGPT is going slowly but with good results.
  16. It is my coding, lua script is not oriented to the object programming paradigm (Poo), however it can be used without any problem to organize the code. Ç In other words win is a custom object, and instead of using KeyDown, the identifier encapsulates this with a GetKeyDown. But internally it is KeyHit, the most readable would be to call it Input.
  17. I hope this gives you an idea. CMove={ -- Constructor. Create = function(self,player,camera) local this={} setmetatable(this,self) self.__index = self function this:Init() self.camera = camera self.player = player self.vel = 0 self.angle = 0 end function this:Update(startEngine) self.vel = 0 if startEngine == false then self.player:SetPhysicsMode(Entity.CharacterPhysics) self.player:SetCollisionType(Collision.Character) self.player:SetMass(200) if win:GetKeyDown(Key.Shift) == false then if win:GetKeyDown(Key.W) then self.vel = -1.2 self.angle = self.camera:GetRotation(true).y - 180 elseif win:GetKeyDown(Key.S) then self.vel = -1.2 self.angle = self.camera:GetRotation(true).y end else if win:GetKeyDown(Key.W) then self.vel = -3.0 self.angle = self.camera:GetRotation(true).y - 180 elseif win:GetKeyDown(Key.S) then self.vel = -3.0 self.angle = self.camera:GetRotation(true).y end end self.rotCamera = self.camera:GetRotation(true).y self.player:SetInput(self.angle, self.vel, 0, 0,false) else self.player:SetPhysicsMode(Entity.RigidBodyPhysics) self.player:SetMass(0) self.player:SetCollisionType(Collision.None) self.player:StopAnimation() end end this:Init() return(this) end }
  18. Fix Camera distance 0.01 1000 Ok. Error Camera distance 0.001 1000 Fail.
  19. if (World::GetCurrent()->Pick(0, 0, 0, 0, 0, 0, pickinfo, true)) { } The pick for the world is not working. Any suggestions, in c++ it underlines something in red and I don't understand.
  20. Yue

    C++ vs Lua

    You're absolutely right, I think for me it's a breakthrough, I'm taking a leap that initially I never thought to do it, moving to C++ is a milestone. And everything I have learned in lua, is not in the trash can. The weird thing in C++ is the compile times, but this is more because in Lua this was flying. On the other hand, it is necessary to go slower in the coding, in my case, because I am learning things like -> or to put a semicolon if not everything does not compile. But it's really fun.
  21. Yue

    C++ vs Lua

    This is encouraging, the performance if I am looking at it. In this scene in Lua the performance was down to 150 frames per second. It is a character controller, and I have to assume because I manage it from C++ code and not from the map editor and lua script.
×
×
  • Create New...