Mounten position based on screen ratio
This commit is contained in:
parent
03f47bcee5
commit
d06018ed16
23
Makefile
23
Makefile
@ -1,6 +1,6 @@
|
||||
RAYFLAGS= -D_GNU_SOURCE -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33
|
||||
RAYINCLUDE= -Iraylib/src -Iraylib/src/external/glfw/include -Iraylib/src/external/glfw/deps/mingw
|
||||
RAYOBJECTS= rl/rcore.o rl/rshapes.o rl/rtextures.o rl/rtext.o rl/utils.o rl/rglfw.o rl/rmodels.o rl/raudio.o
|
||||
RAYOBJECTS= obj/rcore.o obj/rshapes.o obj/rtextures.o obj/rtext.o obj/utils.o obj/rglfw.o obj/rmodels.o obj/raudio.o
|
||||
|
||||
#RAYOPT= -O3
|
||||
RAYOPT= -ggdb
|
||||
@ -14,33 +14,30 @@ setup:
|
||||
fi
|
||||
if [ ! -d "obj" ]; then \
|
||||
mkdir -p obj; \
|
||||
fi
|
||||
if [ ! -d "rl" ]; then \
|
||||
mkdir -p rl; \
|
||||
fi
|
||||
|
||||
rl/rcore.o: raylib/src/rcore.c
|
||||
obj/rcore.o: raylib/src/rcore.c
|
||||
gcc -c $< -o $@ $(RAYOPT) $(RAYFLAGS) $(RAYINCLUDE)
|
||||
|
||||
rl/rshapes.o: raylib/src/rshapes.c
|
||||
obj/rshapes.o: raylib/src/rshapes.c
|
||||
gcc -c $< -o $@ $(RAYOPT) $(RAYFLAGS) $(RAYINCLUDE)
|
||||
|
||||
rl/rtextures.o: raylib/src/rtextures.c
|
||||
obj/rtextures.o: raylib/src/rtextures.c
|
||||
gcc -c $< -o $@ $(RAYOPT) $(RAYFLAGS) $(RAYINCLUDE)
|
||||
|
||||
rl/rtext.o: raylib/src/rtext.c
|
||||
obj/rtext.o: raylib/src/rtext.c
|
||||
gcc -c $< -o $@ $(RAYOPT) $(RAYFLAGS) $(RAYINCLUDE)
|
||||
|
||||
rl/utils.o: raylib/src/utils.c
|
||||
obj/utils.o: raylib/src/utils.c
|
||||
gcc -c $< -o $@ $(RAYOPT) $(RAYFLAGS) $(RAYINCLUDE)
|
||||
|
||||
rl/rglfw.o: raylib/src/rglfw.c
|
||||
obj/rglfw.o: raylib/src/rglfw.c
|
||||
gcc -c $< -o $@ $(RAYOPT) $(RAYFLAGS) $(RAYINCLUDE)
|
||||
|
||||
rl/rmodels.o: raylib/src/rmodels.c
|
||||
obj/rmodels.o: raylib/src/rmodels.c
|
||||
gcc -c $< -o $@ $(RAYOPT) $(RAYFLAGS) $(RAYINCLUDE)
|
||||
|
||||
rl/raudio.o: raylib/src/raudio.c
|
||||
obj/raudio.o: raylib/src/raudio.c
|
||||
gcc -c $< -o $@ $(RAYOPT) $(RAYFLAGS) $(RAYINCLUDE)
|
||||
|
||||
SRCDIR = src
|
||||
@ -66,7 +63,7 @@ run: main
|
||||
./main
|
||||
|
||||
clean:
|
||||
rm -rf obj
|
||||
rm -rf $(OBJECTS)
|
||||
rm -f main example
|
||||
|
||||
cleanAll: clean
|
||||
|
@ -24,9 +24,13 @@ private:
|
||||
Color starColor = WHITE;
|
||||
|
||||
Color moonColor = {240, 240, 190, 255};
|
||||
int minSizeOfMoon = 40;
|
||||
int maxSizeOfMoon = 60;
|
||||
int maxYPosOfMoon = 600;
|
||||
float minSizeOfMoon = 0.05f;
|
||||
float maxSizeOfMoon = 0.075f;
|
||||
float maxYPosOfMoon = 0.75f;
|
||||
|
||||
Color mountenColor = {28, 28, 38, 255};
|
||||
float mounten1 = 0.6875f;
|
||||
float mounten2 = 0.8125f;
|
||||
float mounten3 = 0.9125;
|
||||
float mounten4 = 0.975f;
|
||||
};
|
||||
|
@ -17,9 +17,9 @@ void BackGround::newGen()
|
||||
ClearBackground(backGroundColor);
|
||||
starts();
|
||||
moon();
|
||||
mounten(20, 0.3, 550, 650, mountenColor);
|
||||
mounten(21, 0.3, 650, 730, ColorLerp(mountenColor, BLACK, 0.1f));
|
||||
mounten(23, 0.3, 730, 780, ColorLerp(mountenColor, BLACK, 0.3f));
|
||||
mounten(20, 0.3, (int)(mounten1 * size), (int)(mounten2 * size), mountenColor);
|
||||
mounten(21, 0.3, (int)(mounten2 * size), (int)(mounten3 * size), ColorLerp(mountenColor, BLACK, 0.1f));
|
||||
mounten(23, 0.3, (int)(mounten3 * size), (int)(mounten4 * size), ColorLerp(mountenColor, BLACK, 0.3f));
|
||||
}
|
||||
|
||||
void BackGround::starts()
|
||||
@ -60,8 +60,8 @@ void BackGround::starts()
|
||||
void BackGround::moon()
|
||||
{
|
||||
int xpos = GetRandomValue(100, size - 100);
|
||||
int ypos = GetRandomValue(100, maxYPosOfMoon);
|
||||
int r = GetRandomValue(minSizeOfMoon, maxSizeOfMoon);
|
||||
int ypos = GetRandomValue(100, (int)(maxYPosOfMoon * size));
|
||||
int r = GetRandomValue((int)(minSizeOfMoon * size), (int)(maxSizeOfMoon * size));
|
||||
|
||||
DrawCircle(xpos, ypos, r + 20, ColorLerp(backGroundColor, moonColor, 0.02f));
|
||||
DrawCircle(xpos, ypos, r + 10, ColorLerp(backGroundColor, moonColor, 0.05f));
|
||||
|
Loading…
x
Reference in New Issue
Block a user