This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef Cubeworld_BlockTypes_h | |
#define Cubeworld_BlockTypes_h | |
enum BLOCK_TYPES | |
{ | |
BLOCK_AIR, | |
BLOCK_SOLID, | |
BLOCK_GRASS, | |
BLOCK_DIRT, | |
BLOCK_WATER, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public boolean collidesWithPoint(int x,int y) | |
{ | |
if(x < this.x || x > this.x + width) | |
return false; | |
if(y < this.y || y > this.y + height) | |
return false; | |
return true; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 ctx.clearRect(0,0,640,400); | |
67 | |
68 ctx.save(); | |
69 | |
70 var tmpPos = programmer.position; | |
71 ctx.translate(tmpPos.x,tmpPos.y); | |
72 programmer.draw(); | |
73 | |
74 ctx.restore(); | |
75 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef struct | |
{ | |
position v; | |
colour c; | |
normal n; | |
textureCoord t; | |
} vertex; | |
glVertexAttribPointer(0,4,GL_FLOAT,GL_FALSE, | |
sizeof(vertex), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 330 | |
in vec4 position; | |
in vec4 color; | |
in vec3 normal; | |
in vec2 textureCoord; | |
out vec4 outColor; | |
uniform mat4 perspectiveMatrix; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function love.draw() | |
love.graphics.clear() | |
love.graphics.reset() | |
love.graphics.setColor(255,0,0); | |
love.graphics.print('Hello world',200,200) | |
love.graphics.translate(150,210); | |
drawStuff() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local framebuffer1 = love.graphics.newCanvas(); | |
local framebuffer2 = love.graphics.newCanvas(); | |
local framebuffer3 = love.graphics.newCanvas(); | |
local pos = {x = 20,y = 20} | |
local drawLines = true | |
local effect = fishEye | |
local barrel | |
local blur |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <SOIL/SOIL.h> | |
using namespace std; | |
int | |
main(int argc,char **argv) | |
{ | |
cout << "SOIL Demo" << endl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define GLFW_INCLUDE_GL3 | |
#include <GL/glfw.h> | |
#include <SOIL/SOIL.h> | |
#include <stdlib.h> | |
#include <iostream> | |
using namespace std; | |
int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Texture::flipImageData(unsigned char *data,int width,int height) | |
{ | |
int x,y; | |
int size = (width * height)-1; //Indices start at 0 | |
width = (width < 0) ? 0 : width; | |
height = (height < 0) ? 0 : height; | |
cout << "Image width: " << width << " height: " << height << endl; | |
for(y = 0; y < height/2;y++) { | |
cout << "y: " << y << " height - y " << height - y << endl; |
OlderNewer