Merge branch 'BenCat07-master'
This commit is contained in:
commit
e6b723b743
@ -4,7 +4,7 @@
|
||||
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser" keep-relative-paths="false" name="CDT GCC Build Output Parser" parameter="(g?cc)|([gc]\+\+)|(clang)" prefer-non-shared="true"/>
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser" keep-relative-paths="false" name="CDT GCC Build Output Parser" parameter="(g?cc)|([gc]\+\+)|(clang)" prefer-non-shared="true"/>
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1065738691104269017" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
|
@ -98,7 +98,7 @@ void glez_rect_outline(float x, float y, float w, float h, glez_rgba_t color,
|
||||
|
||||
void glez_rect_textured(float x, float y, float w, float h, glez_rgba_t color,
|
||||
glez_texture_t texture, float tx, float ty, float tw,
|
||||
float th);
|
||||
float th, float angle);
|
||||
|
||||
void glez_string(float x, float y, const char *string, glez_font_t font,
|
||||
glez_rgba_t color, float *out_x, float *out_y);
|
||||
|
34
src/glez.c
34
src/glez.c
@ -11,6 +11,7 @@
|
||||
#include "internal/draw.h"
|
||||
#include "internal/fonts.h"
|
||||
#include "internal/textures.h"
|
||||
#include <vec234.h>
|
||||
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
@ -136,10 +137,9 @@ void glez_rect_outline(float x, float y, float w, float h, glez_rgba_t color,
|
||||
glez_line(x + w, y + h, -w, 0, color, thickness);
|
||||
glez_line(x, y + h, 0, -h, color, thickness);
|
||||
}
|
||||
|
||||
void glez_rect_textured(float x, float y, float w, float h, glez_rgba_t color,
|
||||
glez_texture_t texture, float tx, float ty, float tw,
|
||||
float th)
|
||||
float th, float angle)
|
||||
{
|
||||
internal_texture_t *tex = internal_texture_get(texture);
|
||||
internal_texture_bind(texture);
|
||||
@ -185,6 +185,36 @@ void glez_rect_textured(float x, float y, float w, float h, glez_rgba_t color,
|
||||
vertices[3].color = color;
|
||||
vertices[3].mode = DRAW_MODE_TEXTURED;
|
||||
|
||||
if (angle) {
|
||||
float v1[2] = {vertices[0].position.x, vertices[0].position.y};
|
||||
float v2[2] = {vertices[1].position.x, vertices[1].position.y};
|
||||
float v3[2] = {vertices[2].position.x, vertices[2].position.y};
|
||||
float v4[2] = {vertices[3].position.x, vertices[3].position.y};
|
||||
vertices[0].position.x = -tw;
|
||||
vertices[1].position.x = -tw;
|
||||
vertices[2].position.x = tw;
|
||||
vertices[3].position.x = tw;
|
||||
|
||||
vertices[0].position.y = -th;
|
||||
vertices[1].position.y = th;
|
||||
vertices[2].position.y = th;
|
||||
vertices[3].position.y = -th;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
float x = vertices[i].position.x;
|
||||
float y = vertices[i].position.y;
|
||||
vertices[i].position.x = x *cos(angle) - y *sin(angle);
|
||||
vertices[i].position.y = x *sin(angle) + y *cos(angle);
|
||||
}
|
||||
vertices[0].position.x += v1[0];
|
||||
vertices[0].position.y += v1[1];
|
||||
vertices[1].position.x += v2[0];
|
||||
vertices[1].position.y += v2[1];
|
||||
vertices[2].position.x += v3[0];
|
||||
vertices[2].position.y += v3[1];
|
||||
vertices[3].position.x += v4[0];
|
||||
vertices[3].position.y += v4[1];
|
||||
}
|
||||
|
||||
vertex_buffer_push_back(program.buffer, vertices, 4, indices, 6);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user