From bf82dd59140d32f4eb265ae69a44784b5fda116a Mon Sep 17 00:00:00 2001 From: drumsetmonkey Date: Wed, 16 Dec 2015 07:32:28 -0500 Subject: Stuff --- src/world.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/world.cpp') diff --git a/src/world.cpp b/src/world.cpp index 1b460a2..d26b0fb 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -903,7 +903,7 @@ void World::addStructure(_TYPE t,BUILD_SUB sub, float x,float y,World *outside,W build.push_back(new Structures()); build.back()->spawn(t,sub,x,y); build.back()->inWorld=outside; - build.back()->inside=(void *)inside; + build.back()->inside=inside; entity.push_back(build.back()); } -- cgit v1.2.3 From 0f379ae55e07d4e1e7904a3eb33b1c29c2177ec1 Mon Sep 17 00:00:00 2001 From: drumsetmonkey Date: Fri, 18 Dec 2015 07:32:05 -0500 Subject: Added lights --- include/common.h | 3 ++- main.cpp | 12 ++++++++++-- src/entities.cpp | 4 ++-- src/world.cpp | 1 - test.frag | 21 +++++++++++++++++---- 5 files changed, 31 insertions(+), 10 deletions(-) (limited to 'src/world.cpp') diff --git a/include/common.h b/include/common.h index 5c90222..9dcc110 100644 --- a/include/common.h +++ b/include/common.h @@ -14,6 +14,7 @@ #include #include #include +#include #define GLEW_STATIC #include @@ -34,7 +35,7 @@ typedef unsigned int uint; * This flag lets the compiler know that we want to use shaders. */ -#define SHADERSs +#define SHADERS /** * This structure contains a set of coordinates for ease of coding. diff --git a/main.cpp b/main.cpp index 80bbeb9..014d950 100644 --- a/main.cpp +++ b/main.cpp @@ -595,7 +595,6 @@ void render(){ * Call the world's draw function, drawing the player, the world, the background, and entities. Also * draw the player's inventory if it exists. */ - glUseProgramObjectARB(shaderProgram); player->near=true; // Draw the player's name @@ -676,12 +675,20 @@ void render(){ } glUseProgramObjectARB(0); } + + glUseProgramObjectARB(shaderProgram); + glUniform2f(glGetUniformLocation(shaderProgram, "lightLocation"), 250,250); + glUniform3f(glGetUniformLocation(shaderProgram, "lightColor"), 1,0,0); + glColor4f(0.0f,0.0f,0.0f,1.0f); + glRectf(-SCREEN_WIDTH/2,0,SCREEN_WIDTH/2,SCREEN_HEIGHT); + glUseProgramObjectARB(0); + player->inv->draw(); /* * Here we draw a black overlay if it's been requested. */ - glUseProgramObjectARB(0); + //glUseProgramObjectARB(0); if(fadeIntensity){ @@ -772,6 +779,7 @@ void render(){ static volatile bool objectInteracting = false; void logic(){ + /* * NPCSelected is used to insure that only one NPC is made interactable with the mouse * if, for example, multiple entities are occupying one space. diff --git a/src/entities.cpp b/src/entities.cpp index 6a2f4db..cd8d29e 100644 --- a/src/entities.cpp +++ b/src/entities.cpp @@ -83,8 +83,8 @@ Player::Player(){ //sets all of the player specific traits on object creation subtype = 0; health = maxHealth = 100; speed = 1; - //tex = new Texturec(3, "assets/player1.png", "assets/player.png", "assets/player2.png"); - tex = new Texturec(3, "assets/maybeplayer.png", "assets/maybeplayer.png", "assets/maybeplayer.png"); + tex = new Texturec(3, "assets/player1.png", "assets/player.png", "assets/player2.png"); + //tex = new Texturec(3, "assets/maybeplayer.png", "assets/maybeplayer.png", "assets/maybeplayer.png"); inv = new Inventory(PLAYER_INV_SIZE); } Player::~Player(){ diff --git a/src/world.cpp b/src/world.cpp index 7f4d6f6..0ecf7ee 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -555,7 +555,6 @@ LOOP2: glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); //for the s direction glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); //for the t direction glBegin(GL_QUADS); - std::cout<