Change fro, RL_QUADS to RL_TRIANGLES
for web support
This commit is contained in:
parent
09d1b0f5b0
commit
e62b0eb6bf
6
.vscode/settings.json
vendored
6
.vscode/settings.json
vendored
@ -78,6 +78,10 @@
|
|||||||
"__config": "cpp",
|
"__config": "cpp",
|
||||||
"__split_buffer": "cpp",
|
"__split_buffer": "cpp",
|
||||||
"__verbose_abort": "cpp",
|
"__verbose_abort": "cpp",
|
||||||
"locale": "cpp"
|
"locale": "cpp",
|
||||||
|
"coroutine": "cpp",
|
||||||
|
"forward_list": "cpp",
|
||||||
|
"span": "cpp",
|
||||||
|
"variant": "cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -10,6 +10,7 @@ std::filesystem::path BUILD_FILE = "main";
|
|||||||
bool web_build = false;
|
bool web_build = false;
|
||||||
bool build = false;
|
bool build = false;
|
||||||
bool clear = false;
|
bool clear = false;
|
||||||
|
bool run = false;
|
||||||
|
|
||||||
std::string cpp_compiler = "g++";
|
std::string cpp_compiler = "g++";
|
||||||
std::string c_compiler = "gcc";
|
std::string c_compiler = "gcc";
|
||||||
@ -171,6 +172,9 @@ int main(int argc, char const *argv[])
|
|||||||
if (!std::strcmp(argv[i], "build"))
|
if (!std::strcmp(argv[i], "build"))
|
||||||
build = true;
|
build = true;
|
||||||
|
|
||||||
|
if (!std::strcmp(argv[i], "run"))
|
||||||
|
run = true;
|
||||||
|
|
||||||
if (!std::strcmp(argv[i], "cla"))
|
if (!std::strcmp(argv[i], "cla"))
|
||||||
{
|
{
|
||||||
clear_build_dir(true, true);
|
clear_build_dir(true, true);
|
||||||
@ -215,7 +219,6 @@ int main(int argc, char const *argv[])
|
|||||||
|
|
||||||
if (web_build)
|
if (web_build)
|
||||||
{
|
{
|
||||||
clear_build_dir(true, true);
|
|
||||||
cpp_compiler = "em++";
|
cpp_compiler = "em++";
|
||||||
c_compiler = "emcc";
|
c_compiler = "emcc";
|
||||||
opt_flags = "-Os";
|
opt_flags = "-Os";
|
||||||
@ -233,7 +236,7 @@ int main(int argc, char const *argv[])
|
|||||||
if (!std::filesystem::exists(BUILD_FILE))
|
if (!std::filesystem::exists(BUILD_FILE))
|
||||||
compile_obj_dir();
|
compile_obj_dir();
|
||||||
|
|
||||||
if (!web_build && !build)
|
if (!web_build && run)
|
||||||
{
|
{
|
||||||
command = {"./" + BUILD_FILE.string()};
|
command = {"./" + BUILD_FILE.string()};
|
||||||
nob_cmd_run_sync(command);
|
nob_cmd_run_sync(command);
|
||||||
|
@ -25,7 +25,7 @@ void BackGround::newGen()
|
|||||||
void BackGround::starts()
|
void BackGround::starts()
|
||||||
{
|
{
|
||||||
rlSetTexture(texShapes.id);
|
rlSetTexture(texShapes.id);
|
||||||
rlBegin(RL_QUADS);
|
rlBegin(RL_TRIANGLES);
|
||||||
rlNormal3f(0.0f, 0.0f, 1.0f);
|
rlNormal3f(0.0f, 0.0f, 1.0f);
|
||||||
|
|
||||||
for (size_t i = 1; i <= numOfStarts; i++)
|
for (size_t i = 1; i <= numOfStarts; i++)
|
||||||
@ -40,18 +40,18 @@ void BackGround::starts()
|
|||||||
rlColor4ub(color.r, color.g, color.b, color.a);
|
rlColor4ub(color.r, color.g, color.b, color.a);
|
||||||
|
|
||||||
// topLeft
|
// topLeft
|
||||||
rlTexCoord2f(0, 0);
|
|
||||||
rlVertex2f(x, y);
|
rlVertex2f(x, y);
|
||||||
// bottomLeft
|
// bottomLeft
|
||||||
rlTexCoord2f(0, 1);
|
|
||||||
rlVertex2f(x, y + weight);
|
rlVertex2f(x, y + weight);
|
||||||
|
// topRight
|
||||||
|
rlVertex2f(x + weight, y);
|
||||||
|
|
||||||
// bottomRight
|
// bottomRight
|
||||||
rlTexCoord2f(1, 1);
|
|
||||||
rlVertex2f(x + weight, y + weight);
|
rlVertex2f(x + weight, y + weight);
|
||||||
// topRight
|
// topRight
|
||||||
rlTexCoord2f(1, 0);
|
|
||||||
rlVertex2f(x + weight, y);
|
rlVertex2f(x + weight, y);
|
||||||
|
// bottomLeft
|
||||||
|
rlVertex2f(x, y + weight);
|
||||||
}
|
}
|
||||||
rlEnd();
|
rlEnd();
|
||||||
rlSetTexture(0);
|
rlSetTexture(0);
|
||||||
@ -83,17 +83,15 @@ void BackGround::mounten(size_t mountenSegments, float scale, int min, int max,
|
|||||||
int y = Lerp(min, max, p);
|
int y = Lerp(min, max, p);
|
||||||
|
|
||||||
rlSetTexture(texShapes.id);
|
rlSetTexture(texShapes.id);
|
||||||
rlBegin(RL_QUADS);
|
rlBegin(RL_TRIANGLES);
|
||||||
rlNormal3f(0.0f, 0.0f, 1.0f);
|
rlNormal3f(0.0f, 0.0f, 1.0f);
|
||||||
rlColor4ub(color.r, color.g, color.b, color.a);
|
rlColor4ub(color.r, color.g, color.b, color.a);
|
||||||
|
|
||||||
for (size_t i = 1; i <= mountenSegments; i++)
|
for (size_t i = 1; i <= mountenSegments; i++)
|
||||||
{
|
{
|
||||||
// topLeft
|
// topLeft
|
||||||
rlTexCoord2f(0, 0);
|
|
||||||
rlVertex2f(x, y);
|
rlVertex2f(x, y);
|
||||||
// bottomLeft
|
// bottomLeft
|
||||||
rlTexCoord2f(0, 1);
|
|
||||||
rlVertex2f(x, size);
|
rlVertex2f(x, size);
|
||||||
|
|
||||||
nx = (float)(i + offsetX) * scale;
|
nx = (float)(i + offsetX) * scale;
|
||||||
@ -101,13 +99,15 @@ void BackGround::mounten(size_t mountenSegments, float scale, int min, int max,
|
|||||||
p = (p + 1.0f) / 2.0f;
|
p = (p + 1.0f) / 2.0f;
|
||||||
y = Lerp(min, max, p);
|
y = Lerp(min, max, p);
|
||||||
x += diff;
|
x += diff;
|
||||||
|
// topRight
|
||||||
|
rlVertex2f(x, y);
|
||||||
|
|
||||||
// bottomRight
|
// bottomRight
|
||||||
rlTexCoord2f(1, 1);
|
|
||||||
rlVertex2f(x, size);
|
rlVertex2f(x, size);
|
||||||
// topRight
|
// topRight
|
||||||
rlTexCoord2f(1, 0);
|
|
||||||
rlVertex2f(x, y);
|
rlVertex2f(x, y);
|
||||||
|
|
||||||
|
rlVertex2f(x - diff, size);
|
||||||
}
|
}
|
||||||
rlEnd();
|
rlEnd();
|
||||||
rlSetTexture(0);
|
rlSetTexture(0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user