fix mouse movement speed

isolation_bkp/dynres
Dominik Madarász 2021-05-08 18:38:33 +02:00
parent d4aab12811
commit de93637d9a
2 changed files with 12 additions and 5 deletions

View File

@ -127,7 +127,7 @@ void game_init(int8_t play_mode, uint32_t num_viewers, int32_t seed, uint16_t bl
ECS_IMPORT(world_ecs(), Controllers);
ECS_IMPORT(world_ecs(), Physics);
uint16_t half_world_dim = world_dim() / 2;
for (int i = 0; i < 1000; i++) {
for (int i = 0; i < 100; i++) {
uint64_t e = entity_spawn(NULL);
ecs_add(world_ecs(), e, EcsDemoNPC);
Position *pos = ecs_get_mut(world_ecs(), e, Position, NULL);

View File

@ -7,8 +7,8 @@
#include "camera.h"
#include "math.h"
const uint16_t screenWidth = 1600;
const uint16_t screenHeight = 900;
uint16_t screenWidth = 1600;
uint16_t screenHeight = 900;
#define GFX_WORLD_SCALE 20.0f
@ -51,8 +51,12 @@ void DrawRectangleEco(int posX, int posY, int width, int height, Color color)
void platform_init() {
InitWindow(screenWidth, screenHeight, "eco2d - client");
SetWindowState(FLAG_WINDOW_UNDECORATED|FLAG_WINDOW_HIGHDPI|FLAG_WINDOW_MAXIMIZED|FLAG_WINDOW_RESIZABLE);
SetTargetFPS(60);
screenWidth = GetScreenWidth();
screenHeight = GetScreenHeight();
render_camera.target = (Vector2){0.0f,0.0f};
render_camera.offset = (Vector2){screenWidth/2.0f, screenHeight/2.0f};
render_camera.rotation = 0.0f;
@ -91,8 +95,11 @@ void platform_input() {
Vector2 mouse_pos = GetMousePosition();
mouse_pos.x /= screenWidth;
mouse_pos.y /= screenHeight;
x = mouse_pos.x-0.5f;
y = mouse_pos.y-0.5f;
mouse_pos.x -= 0.5f;
mouse_pos.y -= 0.5f;
mouse_pos = Vector2Normalize(mouse_pos);
x = mouse_pos.x;
y = mouse_pos.y;
}