@@ -62,16 +62,16 @@ constexpr uint8_t MapWidth = 24;
62
62
constexpr uint8_t MapHeight = 24 ;
63
63
64
64
// how big each map grid is in pixels for the top view
65
- constexpr uint8_t MapPixelSize = 16 ;
65
+ constexpr uint8_t MapPixelSize = 24 ;
66
66
67
67
RenderTexture MapRenderTexture; // render texture for the top view
68
68
RenderTexture ViewRenderTexture; // render texture for the 3d view
69
69
70
70
Texture2D WallTexture = { 0 };
71
71
72
72
// 3d view size
73
- constexpr uint16_t ViewWidth = 256 ;
74
- constexpr uint16_t ViewHeight = 196 ;
73
+ constexpr uint16_t ViewWidth = 256 * 4 ;
74
+ constexpr uint16_t ViewHeight = 192 * 4 ;
75
75
76
76
constexpr float ViewFOV = 90 * DEG2RAD;
77
77
@@ -393,12 +393,15 @@ void UpdateMovement()
393
393
// compute a rotation for this frame
394
394
float rotation = 0 ;
395
395
396
- if (IsKeyDown (KEY_A ))
396
+ if (IsKeyDown (KEY_Q ))
397
397
rotation += rotationSpeed;
398
398
399
- if (IsKeyDown (KEY_D ))
399
+ if (IsKeyDown (KEY_E ))
400
400
rotation -= rotationSpeed;
401
401
402
+ if (IsMouseButtonDown (MOUSE_BUTTON_RIGHT))
403
+ rotation -= GetMouseDelta ().x / 100 .0f ;
404
+
402
405
// rotate the player and the camera plane
403
406
PlayerFacing = Vector2Rotate (PlayerFacing, rotation);
404
407
CameraPlane = Vector2Rotate (CameraPlane, rotation);
@@ -416,10 +419,10 @@ void UpdateMovement()
416
419
if (IsKeyDown (KEY_S))
417
420
newPos = Vector2Add (newPos, Vector2Scale (PlayerFacing, -movementSpeed));
418
421
419
- if (IsKeyDown (KEY_Q ))
422
+ if (IsKeyDown (KEY_A ))
420
423
newPos = Vector2Add (newPos, Vector2Scale (sideStepVector, movementSpeed));
421
424
422
- if (IsKeyDown (KEY_E ))
425
+ if (IsKeyDown (KEY_D ))
423
426
newPos = Vector2Add (newPos, Vector2Scale (sideStepVector, -movementSpeed));
424
427
425
428
// if the new pos is not inside the world, allow the player to move there
@@ -430,9 +433,9 @@ void UpdateMovement()
430
433
int main ()
431
434
{
432
435
// set up the window
433
- SetConfigFlags (FLAG_VSYNC_HINT);
434
- InitWindow (1280 , 800 , " Raycaster Example" );
435
- SetTargetFPS (144 );
436
+ // SetConfigFlags(FLAG_VSYNC_HINT);
437
+ InitWindow (1800 , 900 , " Raycaster Example" );
438
+ // SetTargetFPS(500 );
436
439
437
440
// load render textures for the top view and 3d view
438
441
MapRenderTexture = LoadRenderTexture (MapWidth * MapPixelSize, MapHeight * MapPixelSize);
0 commit comments