aboutsummaryrefslogtreecommitdiff
path: root/src/gameScreen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gameScreen.c')
-rw-r--r--src/gameScreen.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/gameScreen.c b/src/gameScreen.c
index 7849af3..96e14ca 100644
--- a/src/gameScreen.c
+++ b/src/gameScreen.c
@@ -2,7 +2,7 @@
#include "game.h"
#include "world.h"
#include "bullets.h"
-#include <raylib.h>
+#include "assets.h"
void initGameScreenGui(GameScreen * gameScreen) {
float width = GetScreenWidth();
@@ -14,7 +14,6 @@ void initGameScreenGui(GameScreen * gameScreen) {
gameScreen->gyroscopePosition = (Vector2){
(width / 2.0) - (GYROSCOPE_TEXTURE_SIZE / 2.0),
height / 1.8
-
};
}
@@ -25,7 +24,7 @@ void initGameScreen(GameScreen * gameScreen) {
gameScreen->gyroscopeCamaera = (Camera3D){
.fovy = 45,
.projection = CAMERA_PERSPECTIVE,
- .position = (Vector3){0.0, 0.0, -3.0},
+ .position = (Vector3){0.0, 0.0, 3.0},
.target = Vector3Zero(),
.up = (Vector3){0.0, 1.0, 0.0}
};
@@ -34,15 +33,10 @@ void initGameScreen(GameScreen * gameScreen) {
GYROSCOPE_TEXTURE_SIZE,
GYROSCOPE_TEXTURE_SIZE
);
-
- // Load model.
- Mesh mesh = GenMeshSphere(1.0, 8, 8);
- gameScreen->gyroscopeModel = LoadModelFromMesh(mesh);
}
void freeGameScreen(GameScreen * gameScreen) {
UnloadRenderTexture(gameScreen->gyroscopeTexture);
- UnloadModel(gameScreen->gyroscopeModel);
}
void drawCrossHair(float size, float thick, Color color) {
@@ -70,14 +64,18 @@ void drawGyroscope(Game * game) {
Entity * player = getEntityFromWorld(game->world, 0);
Vector2 gyroscopePosition = gameScreen->gyroscopePosition;
+ // Get texture and model.
+ Texture2D texture = game->assets.textures[GYROSCOPE_TEXTURE_ASSET];
+ Model model = game->assets.models[GYROSCOPE_ASSET];
+
// Draw this mother fucker.
BeginTextureMode(gameScreen->gyroscopeTexture);
ClearBackground(BLACK);
BeginMode3D(gameScreen->gyroscopeCamaera);
// Set transform and draw.
- gameScreen->gyroscopeModel.transform = QuaternionToMatrix(QuaternionInvert(player->rotation));
- DrawModelWires(gameScreen->gyroscopeModel, Vector3Zero(), 1, BLUE);
+ model.transform = QuaternionToMatrix(player->rotation);
+ DrawModel(model, Vector3Zero(), 1, WHITE);
EndMode3D();
EndTextureMode();