From: drumsetmonkey Date: Thu, 12 May 2016 12:05:34 +0000 (-0400) Subject: RENDERING X-Git-Url: https://code.bitgloo.com/?a=commitdiff_plain;h=ee4522669875b694911635b0c6cfbde7003ef040;p=clyne%2Fgamedev.git RENDERING --- ee4522669875b694911635b0c6cfbde7003ef040 diff --cc brice.dat index 573541a,ea71945..61d57c2 --- a/brice.dat +++ b/brice.dat @@@ -1,1 -1,5 +1,5 @@@ + 2 -canSprint -0 + canJump + 0 ++canSprint +0 diff --cc src/entities.cpp index efe9d13,64feaa5..5084fd6 --- a/src/entities.cpp +++ b/src/entities.cpp @@@ -72,24 -72,28 +72,29 @@@ void randGetomName(Entity *e delete[] bufs; } - // spawns the entity you pass to it based off of coords and global entity settings - void Entity::spawn(float x, float y) + Entity::Entity(void) { - loc.x = x; - loc.y = y; - vel.x = 0; - vel.y = 0; + vel = 0; + width = 0; + height = 0; + health = 0; + maxHealth = 0; + z = 1.0f; targetx = 0.9112001f; - alive = true; - right = true; - left = false; - near = false; - //canMove = true; - ground = false; + type = UNKNOWNT; + + // set flags + alive = true; + right = true; + left = false; + near = false; + canMove = true; + ground = false; forcedMove = false; + z = -1.0f; + // clear counters ticksToUse = 0; hitCooldown = 0; diff --cc src/world.cpp index fb40864,4fe2743..88ef57a --- a/src/world.cpp +++ b/src/world.cpp @@@ -285,22 -276,14 +276,14 @@@ void World::drawBackgrounds(void vec2(0.0f, 1.0f), vec2(0.0f, 0.0f)}; - /*safeSetColorA(255, 255, 255, alpha); - glBegin(GL_QUADS); - glTexCoord2i(0, 0); glVertex2i(offset.x - backgroundOffset.x - 5, offset.y + backgroundOffset.y); - glTexCoord2i(1, 0); glVertex2i(offset.x + backgroundOffset.x + 5, offset.y + backgroundOffset.y); - glTexCoord2i(1, 1); glVertex2i(offset.x + backgroundOffset.x + 5, offset.y - backgroundOffset.y); - glTexCoord2i(0, 1); glVertex2i(offset.x - backgroundOffset.x - 5, offset.y - backgroundOffset.y); - glEnd();*/ - bgTex(0); - GLfloat back_tex_coord[] = {offset.x - backgroundOffset.x - 5, offset.y + backgroundOffset.y, 1.0f, - offset.x + backgroundOffset.x + 5, offset.y + backgroundOffset.y, 1.0f, - offset.x + backgroundOffset.x + 5, offset.y - backgroundOffset.y, 1.0f, + GLfloat back_tex_coord[] = {offset.x - backgroundOffset.x - 5, offset.y + backgroundOffset.y, 10.0f, + offset.x + backgroundOffset.x + 5, offset.y + backgroundOffset.y, 10.0f, + offset.x + backgroundOffset.x + 5, offset.y - backgroundOffset.y, 10.0f, - offset.x + backgroundOffset.x + 5, offset.y - backgroundOffset.y, 1.0f, - offset.x - backgroundOffset.x - 5, offset.y - backgroundOffset.y, 1.0f, - offset.x - backgroundOffset.x - 5, offset.y + backgroundOffset.y, 1.0f}; + offset.x + backgroundOffset.x + 5, offset.y - backgroundOffset.y, 10.0f, + offset.x - backgroundOffset.x - 5, offset.y - backgroundOffset.y, 10.0f, + offset.x - backgroundOffset.x - 5, offset.y + backgroundOffset.y, 10.0f}; glUseProgram(worldShader); @@@ -347,16 -305,15 +305,15 @@@ std::vector bg_items; bgTex++; - //safeSetColorA(150 + shadeBackground * 2, 150 + shadeBackground * 2, 150 + shadeBackground * 2, 255); auto xcoord = width / 2 * -1 + offset.x * 0.85f; for (unsigned int i = 0; i <= worldData.size() * HLINE / 1920; i++) { - bg_items.push_back(vec3(1920 * i + xcoord, GROUND_HEIGHT_MINIMUM, 1.0f)); - bg_items.push_back(vec3(1920 * (i + 1) + xcoord, GROUND_HEIGHT_MINIMUM, 1.0f)); - bg_items.push_back(vec3(1920 * (i + 1) + xcoord, GROUND_HEIGHT_MINIMUM + 1080, 1.0f)); + bg_items.push_back(vec3(1920 * i + xcoord, GROUND_HEIGHT_MINIMUM, 8.0f)); + bg_items.push_back(vec3(1920 * (i + 1) + xcoord, GROUND_HEIGHT_MINIMUM, 8.0f)); + bg_items.push_back(vec3(1920 * (i + 1) + xcoord, GROUND_HEIGHT_MINIMUM + 1080, 8.0f)); - bg_items.push_back(vec3(1920 * (i + 1) + xcoord, GROUND_HEIGHT_MINIMUM + 1080, 1.0f)); - bg_items.push_back(vec3(1920 * i + xcoord, GROUND_HEIGHT_MINIMUM + 1080, 1.0f)); - bg_items.push_back(vec3(1920 * i + xcoord, GROUND_HEIGHT_MINIMUM, 1.0f)); + bg_items.push_back(vec3(1920 * (i + 1) + xcoord, GROUND_HEIGHT_MINIMUM + 1080, 8.0f)); + bg_items.push_back(vec3(1920 * i + xcoord, GROUND_HEIGHT_MINIMUM + 1080, 8.0f)); + bg_items.push_back(vec3(1920 * i + xcoord, GROUND_HEIGHT_MINIMUM, 8.0f)); } std::vector bg_i; @@@ -394,20 -350,15 +350,15 @@@ for (unsigned int i = 0; i < 4; i++) { std::vectorc; bgTex++; - /*safeSetColorA(bgDraw[i][0] + shadeBackground * 2, - bgDraw[i][0] + shadeBackground * 2, - bgDraw[i][0] + shadeBackground * 2, - bgDraw[i][1] - );*/ auto xcoord = offset.x * bgDraw[i][2]; for (int j = worldStart; j <= -worldStart; j += 600) { - c.push_back(vec3(j + xcoord, GROUND_HEIGHT_MINIMUM, 1)); - c.push_back(vec3(j + 600 + xcoord, GROUND_HEIGHT_MINIMUM, 1)); - c.push_back(vec3(j + 600 + xcoord, GROUND_HEIGHT_MINIMUM + 400, 1)); + c.push_back(vec3(j + xcoord, GROUND_HEIGHT_MINIMUM, 7-(i*.1))); + c.push_back(vec3(j + 600 + xcoord, GROUND_HEIGHT_MINIMUM, 7-(i*.1))); + c.push_back(vec3(j + 600 + xcoord, GROUND_HEIGHT_MINIMUM + 400, 7-(i*.1))); - c.push_back(vec3(j + 600 + xcoord, GROUND_HEIGHT_MINIMUM + 400, 1)); - c.push_back(vec3(j + xcoord, GROUND_HEIGHT_MINIMUM + 400, 1)); - c.push_back(vec3(j + xcoord, GROUND_HEIGHT_MINIMUM, 1)); + c.push_back(vec3(j + 600 + xcoord, GROUND_HEIGHT_MINIMUM + 400, 7-(i*.1))); + c.push_back(vec3(j + xcoord, GROUND_HEIGHT_MINIMUM + 400, 7-(i*.1))); + c.push_back(vec3(j + xcoord, GROUND_HEIGHT_MINIMUM, 7-(i*.1))); } bg_i.clear();