[Crosshair] Small tweaks.

This commit is contained in:
Quentin Bazin 2018-06-30 20:09:01 +02:00
parent aecadf3976
commit 59cf061e97
4 changed files with 9 additions and 13 deletions

View File

@ -23,17 +23,17 @@
class RectangleShape : public IDrawable, public Transformable {
public:
RectangleShape() = default;
RectangleShape(u16 width, u16 height, const Color &color = Color::black);
RectangleShape(float width, float height, const Color &color = Color::black);
const Color &color() const { return m_color; }
void setColor(const Color &color) { m_color = color; updateVertexBuffer(); }
void setWireframeMode(bool wireframeMode) { m_wireframeMode = wireframeMode; }
u16 width() const { return m_width; }
u16 height() const { return m_height; }
float width() const { return m_width; }
float height() const { return m_height; }
void setSize(u16 width, u16 height) { m_width = width; m_height = height; updateVertexBuffer(); }
void setSize(float width, float height) { m_width = width; m_height = height; updateVertexBuffer(); }
private:
void updateVertexBuffer() const;

View File

@ -6,7 +6,7 @@ varying float v_faceValue;
uniform sampler2D u_tex;
// uniform int u_renderType;
uniform int u_renderType;
void main() {
vec4 color = v_color;

View File

@ -19,7 +19,7 @@
#include "Shader.hpp"
#include "Vertex.hpp"
RectangleShape::RectangleShape(u16 width, u16 height, const Color &color) {
RectangleShape::RectangleShape(float width, float height, const Color &color) {
m_color = color;
setSize(width, height);

View File

@ -25,9 +25,9 @@ Crosshair::Crosshair() {
float xFactor = SCREEN_WIDTH * SCREEN_HEIGHT / 100;
float yFactor = SCREEN_HEIGHT * SCREEN_WIDTH / 100;
m_hShape.setSize(0.002 * xFactor, 0.0004 * yFactor);
m_vShape1.setSize(0.0004 * xFactor, 0.001 * yFactor - m_hShape.height() / 2);
m_vShape2.setSize(0.0004 * xFactor, 0.001 * yFactor - m_hShape.height() / 2);
m_hShape.setSize(0.002 * xFactor, 0.0002 * yFactor);
m_vShape1.setSize(0.0002 * xFactor, 0.001 * yFactor - m_hShape.height() / 2);
m_vShape2.setSize(0.0002 * xFactor, 0.001 * yFactor - m_hShape.height() / 2);
m_hShape.setColor(Color{200, 200, 200, 180});
m_vShape1.setColor(Color{200, 200, 200, 180});
@ -46,12 +46,8 @@ void Crosshair::draw(RenderTarget &target, RenderStates states) const {
// m_shader.setUniform("u_renderType", -1);
// Shader::bind(nullptr);
// glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO);
target.draw(m_hShape, states);
target.draw(m_vShape1, states);
target.draw(m_vShape2, states);
// glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}