Пример #1
0
void Projectile::draw(WebEngine::SpriteBatch& spriteBatch)
{
	WebEngine::ColorRGBA8 color;
	color.r = 255;
	color.g = 255;
	color.b = 255;
	color.a = 255;

	glm::vec4 uv(0.0f, 0.0f, 1.0f, 1.0f);
	glm::vec4 posAndSize(_position, 30.0f, 30.0f);
	static WebEngine::GLTexture texture = WebEngine::ResourceManager::getTexture("Textures/jimmyJump_pack/PNG/CharacterRight_Standing.png");

	spriteBatch.draw( posAndSize , uv, texture.id, 0.2f, color);
}
Пример #2
0
void Level::init(const std::string filePath, GamaGameEngine::PhysicsWorld* world) {
	glClearDepth(1.0);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	m_startPlayerPos.x = -100;
	m_startPlayerPos.y = -100;

	m_spriteBatch.init();
	m_spriteBatch.begin();

	glm::vec4 posAndSize(-420.0f, -226.0f, 7688, 384);
	glm::vec4 uv(0.0f, 0.0f, 1.0f, 1.0f);
	static GamaGameEngine::GLTexture texture = GamaGameEngine::ResourceManager::getTexture(filePath);
	GamaGameEngine::Colour colour;
	colour.r = 255;
	colour.g = 255;
	colour.b = 255;
	colour.a = 255;
	m_border.init(world, glm::vec2(3700.0f, 30.0f),glm::vec2(7400.0f, 5.0f), 0.0f, false);
	m_border.m_body->setStatic();
	m_border.init(world, glm::vec2(3700.0f, -220.0f), glm::vec2(7400.0f, 5.0f), 0.0f, false);
	m_border.m_body->setStatic();
	m_border.init(world, glm::vec2(-400.0f, 0.0f), glm::vec2(5.0f, 500.0f), 0.0f, false);
	m_border.m_body->setStatic();
	m_border.init(world, glm::vec2(7265.0f, 0.0f), glm::vec2(5.0f, 500.0f), 0.0f, false);
	m_border.m_body->setStatic();

	m_spriteBatch.addSprite(posAndSize, uv, texture.id, 0.0f, colour);

	m_spriteBatch.end();

	draw();

	//glBindTexture(GL_TEXTURE_2D, 0);

	//m_window.swapBuffer();
}