我正在尝试为 opengl 开发设置 Visual Studio 代码。我已经将它用于普通的 c/c++ 开发,我现在正尝试将 opengl 开发添加到组合中。我知道如何在其他平台(即 Eclipse、Xcode、Visual Studio、CodeBlocks)上设置 opengl。我的问题的根源更多是如何在 Visual Studio 代码中设置依赖项。我最好的猜测是在 task.json 文件中运行一个任务。现在它只是填充了每次运行程序时编译项目的代码。
我想将库依赖项添加到我的项目中,而不必将它们复制并粘贴到MinGW文件夹中。有什么办法可以做到这一点VS Code吗?几乎类似于如何Visual Studio使用包含路径。
注意:我的配置可以编译并完美运行,直到您尝试添加外部依赖项。
c_cpp_properties.json
{
"configurations": [
{
"name": "Mac",
"includePath": [
"${workspaceRoot}",
"/usr/include",
"/usr/local/include"
],
"defines": [],
"intelliSenseMode": "clang-x64",
"browse": {
"path": [
"/usr/include",
"/usr/local/include"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
},
{
"name": "Linux",
"includePath": [
"${workspaceRoot}",
"/usr/include",
"/usr/local/include"
],
"defines": [],
"intelliSenseMode": "clang-x64",
"browse": {
"path": [
"/usr/include",
"/usr/local/include"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
},
{
"name": "Win32",
"includePath": [
"${workspaceRoot}",
"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.10.25017/include/*",
"C:/Program Files (x86)/Windows …Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个简单的GLFW窗口并成功,但xcode给了我一个错误:
2016-12-14 10:16:40.412191 CREngine[830:21929] [General] ERROR: Setting <GLFWContentView: 0x100369850> as the first responder for window <GLFWWindow: 0x10033ea00>, but it is in a different window ((null))! This would eventually crash when the view is freed. The first responder will be set to nil.
(
0 AppKit 0x00007fff9710b9a4 -[NSWindow _validateFirstResponder:] + 566
1 AppKit 0x00007fff968fc9eb -[NSWindow _setFirstResponder:] + 31
2 AppKit 0x00007fff969a466a -[NSWindow _realMakeFirstResponder:] + 406
3 AppKit 0x00007fff969a4480 -[NSWindow makeFirstResponder:] + 123
4 libglfw.3.dylib 0x00000001000a9895 _glfwPlatformCreateWindow + 631
5 libglfw.3.dylib 0x00000001000a5430 …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用带有 firebase-admin 的 node.js 登录,但是当我查找 API 时,它们只有关于update、delete和 的部分create。
他们确实有关于如何通过电子邮件获取用户的部分,但如果我想登录用户,我是否也应该不通过他们的密码进行验证。我觉得我错误地阅读了如何使用 firebase-admin。我最好的猜测是我应该直接使用 Firebase 而不是新的 firebase-admin。
编辑:
如果可能的话,我只想通过电子邮件登录用户(即不是通过谷歌登录或 Facebook 登录)。
我想获取在 Android 中运行的套接字的 ID。一切都正常创建,并且能够来回发送数据,但我需要获取 Android 套接字 ID 以便在整个应用程序中使用。我试图找到解决方案,但它们要么已经过时,要么不起作用。以下是我解决此问题的最新尝试。通过这次尝试,它错误地指出 中没有元素args[0]。我也尝试过mSocket.id();,但没有任何回报。
public class GameSocket {
private Socket mSocket = null;
private static GameSocket mInstance;
public synchronized static GameSocket getInstance() {
if (mInstance == null) {
mInstance = new GameSocket();
}
return mInstance;
}
public void initialize() {
mSocket = IO.socket(URI.create(SERVER_URI));
mSocket.off();
mSocket.on(Socket.EVENT_CONNECT, new Emitter.Listener() {
@Override
public void call(Object... args) {
Log.d(GameSocket.class.getSimpleName(), "Event connection...");
mSocketId = args[0].toString();
Log.d("CONNECT ID", mSocketId);
}
})
.on(Socket.EVENT_ERROR, new Emitter.Listener() {
@Override
public …Run Code Online (Sandbox Code Playgroud) 我在调试std::vector<std::unique_ptr<>>抽象类错误时遇到问题.我所知道的错误是试图vector.push_back()在a上使用std::unique_ptr.
Components.h
namespace cr {
class Component {
public:
Component();
virtual ~Component();
virtual void draw() = 0;
virtual void inflate(Frame frame) = 0;
private:
Frame _frame;
};
class ButtonComponent : public Component {
public:
void draw();
void inflate(Frame frame);
};
}
Run Code Online (Sandbox Code Playgroud)
Components.cpp
void cr::ButtonComponent::draw()
{
}
void cr::ButtonComponent::inflate(cr::Frame frame)
{
}
cr::Component::Component()
{
}
cr::Component::~Component()
{
}
Run Code Online (Sandbox Code Playgroud)
Window.h 窗口的一部分
class View {
friend class ViewController;
public:
void render();
void insert(std::unique_ptr<Component> component);
protected:
void inflate(); …Run Code Online (Sandbox Code Playgroud) 我正在重新设计游戏引擎以使用smart-pointers。我有一Object门课,所有东西都从那里继承。我有一个可渲染的GameObject,因此它是从IRenderable(定义纯虚拟渲染函数的类)继承的,而不是从Object继承的。我有一个RenderSystem应该shared_ptr在场景中容纳所有IRenderable的对象。
我遇到的问题是如何将我的GameObject shared_ptr投射到RenderSystem的IRenderable?
我尝试过的想法:
这完全可以使用原始指针完成,因此,我觉得可以通过智能指针找到某种方法来达到相同的结果
例:
// Object.h
class Object : public enable_shared_from_this<Object> { ... }
// GameObject.h
class GameObject : public Object { ... }
// MeshRenderer.h
class MeshRenderer : public GameObject, IRenderable {
public:
void initialize()
{
// Not able to cast Object to IRenderable
RenderSystem::instance().addRenderable(getShared());
// AND
// Not able to cast Object to IRenderable
RenderSystem::instance().addRenderable(std::static_pointer_cast<IRenderable>(getShared()));
}
}
// RenderSystem.h
class …Run Code Online (Sandbox Code Playgroud) c++ ×5
opengl ×2
abstract ×1
android ×1
c++11 ×1
dependencies ×1
firebase ×1
glfw ×1
inheritance ×1
lib ×1
node.js ×1
shared-ptr ×1
sockets ×1
vector ×1