[raylib] raylib 설정하고 사용하기
SDL, raylib 2025. 5. 2. 22:34 |반응형
raylib를 다운받고 아래와 같이 프로젝트를 설정한다.
- Project Property Pages - Debugging - Environment - path=D:\raylib\lib
- Project Property Pages - C/C++ - General - Additional Include Directories - D:\raylib\include
- Project Property Pages - Linker - General - Additional Library Directories - D:\raylib\lib
- Project Property Pages - Linker - Input - Additional Dependencies - raylib.lib;winmm.lib
- Project Property Pages - Linker - Input - Ignore Specific Default Libraries - msvcrt.lib
※ Debug 모드에서 msvcrt.lib를 Ignore Specific Default Libraries에 넣지 않으면 아래와 같은 경고가 발생한다. (Release 모드에서는 넣으면 안된다. 에러가 발생한다.)
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#include "raylib.h"
//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
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
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}
|
코드를 입력하고 빌드한다.
아래 예제 코드를 참고한다.
반응형
'SDL, raylib' 카테고리의 다른 글
[raylib] Transparent Window(Window Flags) (0) | 2025.05.03 |
---|---|
[raylib] raylib with opencv (0) | 2025.05.03 |
[SDL3] Framerate Per Second FPS (0) | 2025.04.22 |
[SDL3] Snapshot(Screenshot) 스냅샷 (0) | 2025.04.20 |
[SDL3] Particle 파티클 (Fireworks/Snow) (0) | 2025.04.18 |