1"use strict";(self.webpackChunkf3d_website=self.webpackChunkf3d_website||[]).push([["2734"],{5858(n,t,i){i.r(t),i.d(t,{metadata:()=>e,default:()=>u,frontMatter:()=>s,contentTitle:()=>d,toc:()=>a,assets:()=>c});var e=JSON.parse('{"id":"api-libf3d/interactor_8h","title":"File interactor.h {/* #interactor_8h */}","description":"interactor_8h */}","source":"@site/docs/api-libf3d/interactor_8h.md","sourceDirName":"api-libf3d","slug":"/api-libf3d/interactor_8h","permalink":"/docs/next/api-libf3d/interactor_8h","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"libSidebar","previous":{"title":"image.h","permalink":"/docs/next/api-libf3d/image_8h"},"next":{"title":"log.h","permalink":"/docs/next/api-libf3d/log_8h"}}'),r=i(74848),o=i(28453);let s={},d="File interactor.h /* #interactor_8h */",c={},a=[{value:"Classes",id:"classes",level:2},{value:"Namespaces",id:"namespaces",level:2},{value:"Includes",id:"includes",level:2},{value:"Included by",id:"included-by",level:2},{value:"Source",id:"source",level:2}];function l(n){let t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",img:"img",li:"li",mermaid:"mermaid",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.R)(),...n.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.header,{children:(0,r.jsx)(t.h1,{id:"interactor_8h",children:"File interactor.h"})}),"\n",(0,r.jsx)(t.p,{children:(0,r.jsx)(t.img,{src:"https://img.shields.io/badge/language-C%2B%2B-blue",alt:"",title:"C++"})}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.strong,{children:"Location"}),": ",(0,r.jsx)(t.code,{children:"interactor.h"})]}),"\n",(0,r.jsx)(t.h2,{id:"classes",children:"Classes"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsx)(t.li,{children:(0,r.jsx)(t.a,{href:"/docs/next/api-libf3d/structf3d_1_1interaction__bind__t",children:"f3d::interaction_bind_t"})}),"\n",(0,r.jsx)(t.li,{children:(0,r.jsx)(t.a,{href:"/docs/next/api-libf3d/structf3d_1_1interactor__state__t",children:"f3d::interactor_state_t"})}),"\n",(0,r.jsx)(t.li,{children:(0,r.jsx)(t.a,{href:"/docs/next/api-libf3d/classf3d_1_1interactor",children:"f3d::interactor"})}),"\n",(0,r.jsx)(t.li,{children:(0,r.jsx)(t.a,{href:"/docs/next/api-libf3d/structf3d_1_1interactor_1_1already__exists__exception",children:"f3d::interactor::already_exists_exception"})}),"\n",(0,r.jsx)(t.li,{children:(0,r.jsx)(t.a,{href:"/docs/next/api-libf3d/structf3d_1_1interactor_1_1does__not__exists__exception",children:"f3d::interactor::does_not_exists_exception"})}),"\n",(0,r.jsx)(t.li,{children:(0,r.jsx)(t.a,{href:"/docs/next/api-libf3d/structf3d_1_1interactor_1_1command__runtime__exception",children:"f3d::interactor::command_runtime_exception"})}),"\n",(0,r.jsx)(t.li,{children:(0,r.jsx)(t.a,{href:"/docs/next/api-libf3d/structf3d_1_1interactor_1_1invalid__args__exception",children:"f3d::interactor::invalid_args_exception"})}),"\n"]}),"\n",(0,r.jsx)(t.h2,{id:"namespaces",children:"Namespaces"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsx)(t.li,{children:(0,r.jsx)(t.a,{href:"/docs/next/api-libf3d/namespacef3d",children:"f3d"})}),"\n"]}),"\n",(0,r.jsx)(t.h2,{id:"includes",children:"Includes"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsx)(t.li,{children:(0,r.jsx)(t.a,{href:"/docs/next/api-libf3d/exception_8h",children:"exception.h"})}),"\n",(0,r.jsx)(t.li,{children:"export.h"}),"\n",(0,r.jsx)(t.li,{children:(0,r.jsx)(t.a,{href:"/docs/next/api-libf3d/log_8h",children:"log.h"})}),"\n",(0,r.jsx)(t.li,{children:(0,r.jsx)(t.a,{href:"/docs/next/api-libf3d/options_8h",children:"options.h"})}),"\n",(0,r.jsx)(t.li,{children:(0,r.jsx)(t.a,{href:"/docs/next/api-libf3d/utils_8h",children:"utils.h"})}),"\n",(0,r.jsx)(t.li,{children:(0,r.jsx)(t.a,{href:"/docs/next/api-libf3d/window_8h",children:"window.h"})}),"\n"]}),"\n",(0,r.jsx)(t.mermaid,{value:'graph LR\n9["camera.h"]\nclick 9 "camera_8h_source.md#camera_8h_source"\n9 --\x3e 3\n9 --\x3e 6\n\n2["exception.h"]\nclick 2 "exception_8h_source.md#exception_8h_source"\n\n10["image.h"]\nclick 10 "image_8h_source.md#image_8h_source"\n10 --\x3e 2\n10 --\x3e 3\n\n1["interactor.h"]\nclick 1 "interactor_8h.md#interactor_8h"\n1 --\x3e 2\n1 --\x3e 3\n1 --\x3e 4\n1 --\x3e 5\n1 --\x3e 7\n1 --\x3e 8\n\n4["log.h"]\nclick 4 "log_8h_source.md#log_8h_source"\n4 --\x3e 3\n\n5["options.h"]\nclick 5 "options_8h_source.md#options_8h_source"\n5 --\x3e 2\n5 --\x3e 3\n5 --\x3e 6\n\n6["types.h"]\nclick 6 "types_8h_source.md#types_8h_source"\n6 --\x3e 2\n6 --\x3e 3\n\n7["utils.h"]\nclick 7 "utils_8h_source.md#utils_8h_source"\n7 --\x3e 2\n7 --\x3e 3\n\n11["video_frame.h"]\nclick 11 "video__frame_8h_source.md#video__frame_8h_source"\n11 --\x3e 2\n11 --\x3e 3\n\n8["window.h"]\nclick 8 "window_8h_source.md#window_8h_source"\n8 --\x3e 9\n8 --\x3e 3\n8 --\x3e 10\n8 --\x3e 11\n\n3["export.h"]\n'}),"\n",(0,r.jsx)(t.h2,{id:"included-by",children:"Included by"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsx)(t.li,{children:(0,r.jsx)(t.a,{href:"/docs/next/api-libf3d/engine_8h",children:"engine.h"})}),"\n"]}),"\n",(0,r.jsx)(t.mermaid,{value:'graph RL\n2["engine.h"]\nclick 2 "engine_8h_source.md#engine_8h_source"\n\n1["interactor.h"]\nclick 1 "interactor_8h.md#interactor_8h"\n2 --\x3e 1\n'}),"\n",(0,r.jsx)(t.h2,{id:"source",children:"Source"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-cpp",children:'#ifndef f3d_interactor_h\n#define f3d_interactor_h\n\n#include "exception.h"\n#include "export.h"\n#include "log.h"\n#include "options.h"\n#include "utils.h"\n#include "window.h"\n\n#include <functional>\n#include <string>\n#include <utility>\n#include <vector>\n\nnamespace f3d\n{\n\nstruct interaction_bind_t\n{\n enum class ModifierKeys : unsigned char\n {\n ANY = 0x80, // 10000000\n NONE = 0x0, // 00000000\n CTRL = 0x1, // 00000001\n SHIFT = 0x2, // 00000010\n CTRL_SHIFT = 0x3 // 00000011\n };\n\n ModifierKeys mod = ModifierKeys::NONE;\n std::string inter;\n\n [[nodiscard]] bool operator<(const interaction_bind_t& bind) const;\n\n [[nodiscard]] bool operator==(const interaction_bind_t& bind) const;\n\n [[nodiscard]] std::string format() const;\n\n [[nodiscard]] static interaction_bind_t parse(std::string_view str);\n};\n\nstruct interactor_state_t\n{\n double animationTime = 0.0;\n};\n\nclass F3D_EXPORT interactor\n{\npublic:\n using command_documentation_t = std::pair<std::string, std::string>;\n\n virtual interactor& initCommands() = 0;\n\n virtual interactor& addCommand(const std::string& action,\n std::function<void(const std::vector<std::string>&)> callback,\n std::optional<command_documentation_t> doc = std::nullopt,\n std::function<std::vector<std::string>(const std::vector<std::string>&)>
1 completionCallback =\n nullptr) = 0;\n\n virtual interactor& removeCommand(const std::string& action) = 0;\n\n [[nodiscard]] virtual std::vector<std::string> getCommandActions() const = 0;\n\n virtual bool triggerCommand(std::string_view command, bool keepComments = true) = 0;\n\n using documentation_callback_t = std::function<std::pair<std::string, std::string>()>;\n\n enum class BindingType : std::uint8_t\n {\n CYCLIC = 0,\n NUMERICAL = 1,\n TOGGLE = 2,\n OTHER = 3,\n };\n\n enum class AnimationDirection : std::uint8_t\n {\n FORWARD,\n BACKWARD\n };\n\n virtual interactor& initBindings() = 0;\n\n virtual interactor& addBinding(const interaction_bind_t& bind, std::vector<std::string> commands,\n std::string group = {}, documentation_callback_t documentationCallback = nullptr,\n BindingType type = BindingType::OTHER, bool notify = true, bool repeat = false) = 0;\n\n virtual interactor& addBinding(const interaction_bind_t& bind, std::string command,\n std::string group = {}, documentation_callback_t documentationCallback = nullptr,\n BindingType type = BindingType::OTHER, bool notify = true, bool repeat = false) = 0;\n\n interactor& addBinding(const interaction_bind_t& bind, std::initializer_list<std::string> list,\n std::string group = {}, documentation_callback_t documentationCallback = nullptr,\n BindingType type = BindingType::OTHER, bool notify = true, bool repeat = false)\n {\n return this->addBinding(bind, std::vector<std::string>(list), std::move(group),\n std::move(documentationCallback), type, notify, repeat);\n }\n\n virtual interactor& removeBinding(const interaction_bind_t& bind) = 0;\n\n [[nodiscard]] virtual std::vector<std::string> getBindGroups() const = 0;\n\n [[nodiscard]] virtual std::vector<interaction_bind_t> getBindsForGroup(\n std::string group) const = 0;\n\n [[nodiscard]] virtual std::vector<interaction_bind_t> getBinds() const = 0;\n\n [[nodiscard]] virtual std::pair<std::string, std::string> getBindingDocumentation(\n const interaction_bind_t& bind) const = 0;\n\n [[nodiscard]] virtual BindingType getBindingType(const interaction_bind_t& bind) const = 0;\n\n\n virtual interactor& toggleAnimation(\n AnimationDirection direction = AnimationDirection::FORWARD) = 0;\n virtual interactor& startAnimation(\n AnimationDirection direction = AnimationDirection::FORWARD) = 0;\n virtual interactor& stopAnimation() = 0;\n [[nodiscard]] virtual bool isPlayingAnimation() = 0;\n [[nodiscard]] virtual interactor::AnimationDirection getAnimationDirection() = 0;\n\n\n virtual interactor& enableCameraMovement() = 0;\n virtual interactor& disableCameraMovement() = 0;\n\n\n enum class MouseButton : unsigned char\n {\n LEFT,\n RIGHT,\n MIDDLE\n };\n\n enum class WheelDirection : unsigned char\n {\n FORWARD,\n BACKWARD,\n LEFT,\n RIGHT\n };\n\n enum class InputAction : unsigned char\n {\n PRESS,\n RELEASE\n };\n\n enum class InputModifier : unsigned char\n {\n NONE,\n CTRL,\n SHIFT,\n CTRL_SHIFT\n };\n\n virtual interactor& triggerModUpdate(InputModifier mod) = 0;\n\n virtual interactor& triggerMouseButton(InputAction action, MouseButton button) = 0;\n\n virtual interactor& triggerMousePosition(double xpos, double ypos) = 0;\n\n virtual interactor& triggerMouseWheel(WheelDirection direction) = 0;\n\n virtual interactor& triggerKeyboardKey(InputAction action, std::string_view keySym) = 0;\n\n virtual interactor& triggerTextCharacter(unsigned int codepoint) = 0;\n\n virtual interactor& triggerEventLoop(double deltaTime) = 0;\n\n virtual interactor& triggerNotification(\n std::string desc, std::string value = "", double duration = 3.f) = 0;\n\n virtual interactor& setNotificationCallback(\n std::function<bool(const std::string&, const std::string&, const std::string&, double)>\n callback) = 0;\n\n virtual bool playInteraction(const std::filesystem::path& file, double deltaTime = 1.0 / 30) = 0;\n\n virtual bool recordInteraction(const std::filesystem::path& file) = 0;\n\n virtual interactor& setEventLoopUserCallback(\n std::function<void(interactor_state_t)> userCallback) = 0;
1\n\n virtual interactor& start(double deltaTime = 1.0 / 30) = 0;\n\n virtual interactor& stop() = 0;\n\n virtual interactor& requestRender() = 0;\n\n virtual interactor& requestStop() = 0;\n\n struct already_exists_exception : public exception\n {\n explicit already_exists_exception(const std::string& what = "");\n };\n\n struct does_not_exists_exception : public exception\n {\n explicit does_not_exists_exception(const std::string& what = "");\n };\n\n struct command_runtime_exception : public exception\n {\n explicit command_runtime_exception(const std::string& what = "");\n };\n\n struct invalid_args_exception : public exception\n {\n explicit invalid_args_exception(const std::string& what = "")\n : exception(what)\n {\n }\n };\n\nprotected:\n interactor() = default;\n virtual ~interactor() = default;\n interactor(const interactor& opt) = delete;\n interactor(interactor&& opt) = delete;\n interactor& operator=(const interactor& opt) = delete;\n interactor& operator=(interactor&& opt) = delete;\n};\n\n//----------------------------------------------------------------------------\ninline bool interaction_bind_t::operator<(const interaction_bind_t& bind) const\n{\n return this->mod < bind.mod || (this->mod == bind.mod && this->inter < bind.inter);\n}\n\n//----------------------------------------------------------------------------\ninline bool interaction_bind_t::operator==(const interaction_bind_t& bind) const\n{\n return this->mod == bind.mod && this->inter == bind.inter;\n}\n\n//----------------------------------------------------------------------------\ninline std::string interaction_bind_t::format() const\n{\n std::string ctrlMod = "Ctrl+";\n std::string ctrlShiftMod = "Ctrl+Shift+";\n\n#ifdef __APPLE__\n const std::optional<std::string> forceCtrl = f3d::utils::getEnv("F3D_TEST_APPLE_FORCE_CTRL");\n if (!forceCtrl.has_value() || forceCtrl.value().empty() || forceCtrl != "true")\n {\n ctrlMod = "Cmd+";\n ctrlShiftMod = "Cmd+Shift+";\n }\n#endif\n\n switch (this->mod)\n {\n case ModifierKeys::CTRL_SHIFT:\n return ctrlShiftMod + this->inter;\n case ModifierKeys::CTRL:\n return ctrlMod + this->inter;\n case ModifierKeys::SHIFT:\n return "Shift+" + this->inter;\n case ModifierKeys::ANY:\n return "Any+" + this->inter;\n default:\n // No need to check for NONE\n return this->inter;\n }\n}\n\n//----------------------------------------------------------------------------\ninline interaction_bind_t interaction_bind_t::parse(std::string_view str)\n{\n interaction_bind_t bind;\n auto plusIt = str.find_last_of(\'+\');\n if (plusIt == std::string::npos)\n {\n bind.inter = str;\n }\n else\n {\n bind.inter = str.substr(plusIt + 1);\n\n std::string_view modStr = str.substr(0, plusIt);\n if (modStr == "Ctrl+Shift")\n {\n bind.mod = ModifierKeys::CTRL_SHIFT;\n }\n else if (modStr == "Shift")\n {\n bind.mod = ModifierKeys::SHIFT;\n }\n else if (modStr == "Ctrl")\n {\n bind.mod = ModifierKeys::CTRL;\n }\n else if (modStr == "Any")\n {\n bind.mod = ModifierKeys::ANY;\n }\n else if (modStr == "None")\n {\n bind.mod = ModifierKeys::NONE;\n }\n else\n {\n f3d::log::warn("Invalid modifier: ", modStr, ", ignoring modifier");\n }\n }\n return bind;\n}\n}\n\n#endif\n'})})]})}function u(n={}){let{wrapper:t}={...(0,o.R)(),...n.components};return t?(0,r.jsx)(t,{...n,children:(0,r.jsx)(l,{...n})}):l(n)}},28453(n,t,i){i.d(t,{R:()=>s,x:()=>d});var e=i(96540);let r={},o=e.createContext(r);function s(n){let t=e.useContext(o);return e.useMemo(function(){return"function"==typeof n?n(t):{...t,...n}},[t,n])}function d(n){let t;return t=n.disableParentContext?"function"==typeof n.components?n.components(r):n.components||r:s(n.components),e.createElement(o.Provider,{value:t},n.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.