aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornathansmithsmith <nathansmith7@mailfence.com>2023-09-18 22:00:27 -0600
committernathansmithsmith <nathansmith7@mailfence.com>2023-09-18 22:00:27 -0600
commit0387c05d7d4b784b91ea35b88caa12c4fc9fd6d3 (patch)
treeee200d2b281597736f67706e0a219811a6daf72b
parent7e49b327b5b06d5461dbc483a2d81a347150200c (diff)
Added crossy thingy to gyro
-rw-r--r--src/gameScreen.c31
-rw-r--r--src/gameScreen.h2
2 files changed, 25 insertions, 8 deletions
diff --git a/src/gameScreen.c b/src/gameScreen.c
index 86b6a51..7849af3 100644
--- a/src/gameScreen.c
+++ b/src/gameScreen.c
@@ -25,7 +25,7 @@ void initGameScreen(GameScreen * gameScreen) {
gameScreen->gyroscopeCamaera = (Camera3D){
.fovy = 45,
.projection = CAMERA_PERSPECTIVE,
- .position = (Vector3){0.0, 0.0, -5.0},
+ .position = (Vector3){0.0, 0.0, -3.0},
.target = Vector3Zero(),
.up = (Vector3){0.0, 1.0, 0.0}
};
@@ -68,27 +68,44 @@ void drawCrossHair(float size, float thick, Color color) {
void drawGyroscope(Game * game) {
GameScreen * gameScreen = &game->gameScreen;
Entity * player = getEntityFromWorld(game->world, 0);
+ Vector2 gyroscopePosition = gameScreen->gyroscopePosition;
// Draw this mother fucker.
BeginTextureMode(gameScreen->gyroscopeTexture);
ClearBackground(BLACK);
BeginMode3D(gameScreen->gyroscopeCamaera);
- //DrawSphereWires(Vector3Zero(), 1.0, 8, 8, GREEN);
-
+ // Set transform and draw.
gameScreen->gyroscopeModel.transform = QuaternionToMatrix(QuaternionInvert(player->rotation));
-
- DrawModelWires(gameScreen->gyroscopeModel, Vector3Zero(), 1, GREEN);
+ DrawModelWires(gameScreen->gyroscopeModel, Vector3Zero(), 1, BLUE);
EndMode3D();
EndTextureMode();
+ // Draw render texture.
DrawTexture(
gameScreen->gyroscopeTexture.texture,
- gameScreen->gyroscopePosition.x,
- gameScreen->gyroscopePosition.y,
+ gyroscopePosition.x,
+ gyroscopePosition.y,
WHITE
);
+
+ // Top to bottom.
+ DrawLine(
+ gyroscopePosition.x + (GYROSCOPE_TEXTURE_SIZE / 2.0),
+ gyroscopePosition.y,
+ gyroscopePosition.x + (GYROSCOPE_TEXTURE_SIZE / 2.0),
+ gyroscopePosition.y + GYROSCOPE_TEXTURE_SIZE,
+ RED
+ );
+
+ DrawLine(
+ gyroscopePosition.x,
+ gyroscopePosition.y + (GYROSCOPE_TEXTURE_SIZE / 2.0),
+ gyroscopePosition.x + GYROSCOPE_TEXTURE_SIZE,
+ gyroscopePosition.y + (GYROSCOPE_TEXTURE_SIZE / 2.0),
+ RED
+ );
}
void drawGameScreenGui(Game * game) {
diff --git a/src/gameScreen.h b/src/gameScreen.h
index 84d589b..c0169c6 100644
--- a/src/gameScreen.h
+++ b/src/gameScreen.h
@@ -4,7 +4,7 @@
#define GAME_SCREEN_H
#define GAME_SCREEN_TEXT_SIZE 20.0
-#define GYROSCOPE_TEXTURE_SIZE 100
+#define GYROSCOPE_TEXTURE_SIZE 80
// Gui stuff and shit.
typedef struct GameScreen {