Merge pull request #16 from huaqo-games/huaqo
fix: target with shader rendering y-axis inversion
This commit is contained in:
+2
-2
@@ -49,8 +49,8 @@ Vector2 GetDirectionVector(void){
|
||||
Vector2 vector = {.x = 0.0f, .y = 0.0f};
|
||||
if (IsKeyDown(KEY_RIGHT) || IsKeyDown(KEY_D)){vector.x += 1.0f; }
|
||||
if (IsKeyDown(KEY_LEFT) || IsKeyDown(KEY_A)){ vector.x -= 1.0f; }
|
||||
if (IsKeyDown(KEY_UP) || IsKeyDown(KEY_W)){ vector.y += 1.0f; }
|
||||
if (IsKeyDown(KEY_DOWN) || IsKeyDown(KEY_S)){ vector.y -= 1.0f; }
|
||||
if (IsKeyDown(KEY_UP) || IsKeyDown(KEY_W)){ vector.y -= 1.0f; }
|
||||
if (IsKeyDown(KEY_DOWN) || IsKeyDown(KEY_S)){ vector.y += 1.0f; }
|
||||
if (Vector2Length(vector) > 0.0f) {vector = Vector2Normalize(vector); }
|
||||
return vector;
|
||||
}
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ void UpdatePostFX(PostProcessing *postFX){
|
||||
|
||||
void RenderPostFX(PostProcessing *postFX, RenderTexture2D *target){
|
||||
BeginShaderMode(postFX->shader);
|
||||
DrawTextureRec(target->texture, (Rectangle){ 0, 0, target->texture.width, target->texture.height }, (Vector2){ 0, 0 }, WHITE);
|
||||
DrawTextureRec(target->texture, (Rectangle){ 0, 0, target->texture.width, -target->texture.height }, (Vector2){ 0, 0 }, WHITE);
|
||||
EndShaderMode();
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ void RenderGame(GameState* g){
|
||||
BeginMode2D(g->camera);
|
||||
RenderComponents(g);
|
||||
EndMode2D();
|
||||
DrawTextureRec(g->mouse.cursorTexture, (Rectangle){ 0, 0, g->mouse.cursorTexture.width, -g->mouse.cursorTexture.height }, (Vector2){ g->mouse.screenPosition.x, GetScreenHeight() - g->mouse.screenPosition.y - g->mouse.cursorTexture.height}, WHITE);
|
||||
DrawTextureRec(g->mouse.cursorTexture, (Rectangle){ 0, 0, g->mouse.cursorTexture.width, g->mouse.cursorTexture.height }, (Vector2){ g->mouse.screenPosition.x, g->mouse.screenPosition.y}, WHITE);
|
||||
EndTextureMode();
|
||||
BeginDrawing();
|
||||
ClearBackground(BLACK);
|
||||
|
||||
@@ -17,9 +17,9 @@ typedef enum {
|
||||
} TextureID;
|
||||
|
||||
const TextureAsset texAssets[TEX_COUNT] = {
|
||||
{"assets/SproutLandsBasic/Characters/character.png", 48.0f, 48.0f, 180.0f},
|
||||
{"assets/SproutLandsBasic/Characters/BasicCharakterActions.png", 48.0f, 48.0f, 180.0f},
|
||||
{"assets/SproutLandsBasic/Objects/tools.png", 48.0f, 16.0f, 180.0f},
|
||||
{"assets/SproutLandsBasic/Characters/character.png", 48.0f, 48.0f, 0.0f},
|
||||
{"assets/SproutLandsBasic/Characters/BasicCharakterActions.png", 48.0f, 48.0f, 0.0f},
|
||||
{"assets/SproutLandsBasic/Objects/tools.png", 48.0f, 16.0f, 0.0f},
|
||||
{"assets/flower.png", 16.0f, 16.0f, 45.0f},
|
||||
{"assets/character_bee.png", 16.0f, 16.0f, 0.0f},
|
||||
{"assets/grass.png", 16.0f, 16.0f, 0.0f},
|
||||
|
||||
@@ -14,11 +14,11 @@ typedef enum {
|
||||
|
||||
const TextureAsset menuTextureAssets[MENU_TEX_COUNT] = {
|
||||
{"assets/SproutLandsUI/Spritesheets/Mouse sprites/TriangleMouseicon1.png", 16.0f, 16.0f, 0.0f },
|
||||
{"assets/SproutLandsUI/Spritesheets/UIBigPlayButtonHover.png", 96.0f, 32.0f, 180.0f},
|
||||
{"assets/SproutLandsUI/Spritesheets/Settingmenu.png", 128.0f, 144.0f, 180.0f},
|
||||
{"assets/Clouds/Clouds1/1.png", 576.0f, 324.0f, 180.0f},
|
||||
{"assets/Clouds/Clouds1/2.png", 576.0f, 324.0f, 180.0f},
|
||||
{"assets/Clouds/Clouds1/4.png", 576.0f, 324.0f, 180.0f}
|
||||
{"assets/SproutLandsUI/Spritesheets/UIBigPlayButtonHover.png", 96.0f, 32.0f, 0.0f},
|
||||
{"assets/SproutLandsUI/Spritesheets/Settingmenu.png", 128.0f, 144.0f, 0.0f},
|
||||
{"assets/Clouds/Clouds1/1.png", 576.0f, 324.0f, 0.0f},
|
||||
{"assets/Clouds/Clouds1/2.png", 576.0f, 324.0f, 0.0f},
|
||||
{"assets/Clouds/Clouds1/4.png", 576.0f, 324.0f, 0.0f}
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
|
||||
+6
-6
@@ -22,12 +22,12 @@ typedef enum {
|
||||
typedef enum {
|
||||
IDLE_DOWN,
|
||||
IDLE_UP,
|
||||
IDLE_RIGHT,
|
||||
IDLE_LEFT,
|
||||
IDLE_RIGHT,
|
||||
WALKING_DOWN,
|
||||
WALKING_UP,
|
||||
WALKING_RIGHT,
|
||||
WALKING_LEFT,
|
||||
WALKING_RIGHT,
|
||||
HOE_DOWN,
|
||||
HOE_UP,
|
||||
HOE_RIGHT,
|
||||
@@ -103,15 +103,15 @@ void UpdatePlayerAnimationState(int *state, SelectedTool *selectedTool, Vector2
|
||||
switch (*state) {
|
||||
case WALKING_DOWN: *state = IDLE_DOWN; break;
|
||||
case WALKING_UP: *state = IDLE_UP; break;
|
||||
case WALKING_RIGHT: *state = IDLE_RIGHT; break;
|
||||
case WALKING_LEFT: *state = IDLE_LEFT; break;
|
||||
case WALKING_RIGHT: *state = IDLE_RIGHT; break;
|
||||
default: break;
|
||||
}
|
||||
} else {
|
||||
if (dir->y == -1) *state = WALKING_DOWN;
|
||||
else if (dir->y == 1) *state = WALKING_UP;
|
||||
else if (dir->x == 1) *state = WALKING_RIGHT;
|
||||
if (dir->y == 1) *state = WALKING_DOWN;
|
||||
else if (dir->y == -1) *state = WALKING_UP;
|
||||
else if (dir->x == -1) *state = WALKING_LEFT;
|
||||
else if (dir->x == 1) *state = WALKING_RIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user