Textures not loading

main
JanEhehalt 3 years ago
parent c289689b23
commit d6d94471e0

@ -7,9 +7,8 @@
#include <math.h>
#include "../List/list.h"
#include "../IsometricMap/tile.h"
#include "../game.h"
//TODO: Macht es Sinn ein einzelnes "Game" struct zu haben, das alle möglichen Pointer hat zu allen arrays, camera, textures etc?
// Man hat einen Übergabeparameter mit dem man dann alles verändern kann, man muss nicht alles was man verändern will einzeln übergeben
void DrawRect(Vector2 rectStart, Vector2 *mousePosition){
float width = GetMousePosition().x - rectStart.x;
@ -54,7 +53,13 @@ Vector2 GetRectangle(Vector2 rectStart){
return rectStart;
}
void mouseInput(InputHandler *inputHandler, List *sprites, Texture2D *texture, Camera2D *camera, IsometricMap **layers){
void mouseInput(Game *game){
InputHandler *inputHandler = game->inputHandler;
List *sprites = game->sprites;
Camera2D *camera = game->camera;
IsometricMap **layers = *game->layers;
Texture2D *texture = game->worker +4;
inputHandler->cursorPos.x = GetMousePosition().x;
inputHandler->cursorPos.y = GetMousePosition().y;

@ -4,6 +4,7 @@
#include "../sprite.h"
#include "../List/list.h"
#include "../IsometricMap/isometricMap.h"
#include "../game.h"
typedef struct InputHandler{
int pressed;
@ -16,7 +17,7 @@ typedef struct InputHandler{
Sprite *cursorSprite;
} InputHandler;
void mouseInput(InputHandler *inputHandler, List *sprites, Texture2D *texture, Camera2D *camera, IsometricMap **layers);
void mouseInput(Game *game);
void keyboardInput(InputHandler *inputHandler, Camera2D *camera);

@ -2,18 +2,16 @@
#define GAME_H_
#include "raylib.h"
#include "sprite.h"
#include "List/list.h"
#include "Input/inputHandler.h"
typedef struct Game {
// So kann man die includes umgehen, also keine Circular dependencies mehr :)
typedef struct Game{
Texture2D cursorTextures[2];
Sprite *cursorSprite;
Texture2D worker[8];
List *sprites;
InputHandler *inputHandler;
Camera2D *camera;
IsometricMap ***layers;
struct Sprite *cursorSprite;
struct List *sprites;
struct InputHandler *inputHandler;
struct Camera2D *camera;
struct IsometricMap ***layers;
} Game;
Game * GameInit();

BIN
game.o

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
list.o

Binary file not shown.

@ -15,14 +15,6 @@ int main(){
Game *game = GameInit();
// Test of the IsometricMapUnproject Function
//Vector2 asdf = {500, 600};
//printf("unprojected %f %f\n",asdf.x, asdf.y);
//IsometricMapProject(layers[0], &camera, asdf.x, asdf.y, &asdf);
//printf("projected %f %f\n",asdf.x, asdf.y);
//IsometricMapUnproject(layers[0], &camera, asdf.x, asdf.y, &asdf);
//printf("unprojected %f %f\n",asdf.x, asdf.y);
// Hides the operating systems own cursor
HideCursor();
SetTargetFPS(60);
@ -46,12 +38,12 @@ int main(){
DrawSpriteToScreen(game->cursorSprite);
// User Input Handling
mouseInput(game->inputHandler, game->sprites, game->worker+4, game->camera, *game->layers);
mouseInput(game);
keyboardInput(game->inputHandler, game->camera);
//cursor Positions test
//printf("Cursor Pos: %f %f\n", inputHandler.cursorPos.x, inputHandler.cursorPos.y);
//printf("Cursor World Pos: %f %f\n", inputHandler.cursorWorldPos.x, inputHandler.cursorWorldPos.y);
//printf("Cursor Pos: %f %f\n", game->inputHandler->cursorPos.x, game->inputHandler.cursorPos.y)->
//printf("Cursor World Pos: %f %f\n", game->inputHandler->cursorWorldPos.x, game->inputHandler->cursorWorldPos.y);
// Sprites move towards their destination
float movementSpeed = 10.0f;

BIN
main.o

Binary file not shown.

BIN
spiel

Binary file not shown.

Binary file not shown.

BIN
tile.o

Binary file not shown.
Loading…
Cancel
Save