0xc3 1 hónapja
szülő
commit
29b910eec0

+ 18 - 7
src/saura/cmd/sandbox/sandbox.cpp

@@ -269,23 +269,34 @@ struct SandboxApp : AppBase {
             }
           }
 
-          // ФИО
           this->mem_arena_temp->begin(this->def_mem_arena.get());
-          uint64_t full_name_size = 65;
-          uint8_t *full_name = this->mem_arena_temp->push(full_name_size);
+
+          // ФИО
+          {
+            uint64_t default_size = 65;
+
+            uint8_t *full_name = this->mem_arena_temp->push(default_size);
+            ImGui::InputText("ФИО", (char *)full_name, default_size);
+            tmp_client.full_name = (char *)full_name;
+          }
+
+          // Телефон
           {
+            uint64_t default_size = 65;
 
-            ImGui::InputText("ФИО", (char *)full_name, full_name_size);
+            uint8_t *email = this->mem_arena_temp->push(default_size);
+            ImGui::InputText("Эл. почта", (char *)email, default_size);
+            tmp_client.email = (char*)email;
           }
 
           if (ImGui::Button("Close", ImVec2(120, 0))) {
-            tmp_client.full_name = (char *)full_name;
-            spdlog::info("ФИО: {}", tmp_client.full_name.c_str());
-            this->mem_arena_temp->pop_zero();
+            spdlog::info("{}, {}", tmp_client.full_name, tmp_client.email);
+            this->mem_arena_temp->pop_zero_all();
             ImGui::CloseCurrentPopup();
           }
 
           this->mem_arena_temp->end();
+
           ImGui::EndPopup();
         }
 

+ 5 - 1
src/saura/core/memory/arena.cpp

@@ -65,7 +65,7 @@ uint8_t *MemoryArena::pop_zero(uint64_t size) {
   return pos;
 }
 
-void MemoryArena::clear() { this->offset = 0; }
+void MemoryArena::reset() { this->offset = 0; }
 
 uint64_t MemoryArena::get_offset() { return this->offset; }
 
@@ -92,4 +92,8 @@ uint8_t *MemoryArenaTemp::pop_zero() {
   return this->arena->pop_zero(this->arena->offset - this->offset);
 }
 
+uint8_t *MemoryArenaTemp::pop_zero_all() {
+  return this->arena->pop_zero(this->arena->offset);
+}
+
 } // namespace saura

+ 2 - 1
src/saura/core/memory/arena.hpp

@@ -28,7 +28,7 @@ public:
   uint8_t *push_zero(uint64_t size);
   uint8_t *pop(uint64_t size);
   uint8_t *pop_zero(uint64_t size);
-  void clear();
+  void reset();
   uint64_t get_offset();
 };
 
@@ -45,6 +45,7 @@ public:
   uint8_t *push_zero(uint64_t size);
   uint8_t *pop();
   uint8_t *pop_zero();
+  uint8_t *pop_zero_all();
 };
 } // namespace saura