我正在尝试使用 Raylib 创建游戏。我想使用 XCode,因为我认为库管理会像 Windows 上的 Visual Studio 一样简单。
我安装了这个库brew install raylib
。现在我尝试运行这个从 Raylib 网站复制的简单项目。
main.c
:
#include "raylib.h"
#include <stdio.h>
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - keyboard input");
Vector2 ballPosition = { (float)screenWidth/2, (float)screenHeight/2 };
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
if (IsKeyDown(KEY_RIGHT)) ballPosition.x += 2.0f;
if (IsKeyDown(KEY_LEFT)) ballPosition.x -= 2.0f;
if (IsKeyDown(KEY_UP)) ballPosition.y -= 2.0f;
if (IsKeyDown(KEY_DOWN)) ballPosition.y += 2.0f;
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText("move the ball with arrow keys", 10, 10, 20, DARKGRAY);
DrawCircleV(ballPosition, 50, MAROON);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}
我包括了搜索路径和标题路径,如下图所示:
代码构建得很好,但没有启动终端会话,也没有抽出球。您还可以在图片中看到库未加载,但我不明白为什么。我还制作了我包含的库和框架的屏幕截图:
任何帮助,将不胜感激。
通过查找解决了这个帖子 https://stackoverflow.com/questions/59214424/macos-homebrew-dylib-formula-all-hit-code-sign-errors
我刚刚从项目中删除了库验证。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)