mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-28 23:13:02 +00:00
djui_hud_set_rotation (#356)
* djui_hud_set_rotation * some goddard textures
This commit is contained in:
parent
59453c6165
commit
fe934ffe82
10 changed files with 165 additions and 25 deletions
|
@ -3718,6 +3718,14 @@ function djui_hud_set_resolution(resolutionType)
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- @param rotation integer
|
||||||
|
--- @param pivotX number
|
||||||
|
--- @param pivotY number
|
||||||
|
--- @return nil
|
||||||
|
function djui_hud_set_rotation(rotation, pivotX, pivotY)
|
||||||
|
-- ...
|
||||||
|
end
|
||||||
|
|
||||||
--- @param pos Vec3f
|
--- @param pos Vec3f
|
||||||
--- @param out Vec3f
|
--- @param out Vec3f
|
||||||
--- @return nil
|
--- @return nil
|
||||||
|
|
|
@ -1592,6 +1592,30 @@ extern ALIGNED8 const Texture wmotr_seg7_texture_07000800[];
|
||||||
extern ALIGNED8 const Texture wmotr_seg7_texture_07000C00[];
|
extern ALIGNED8 const Texture wmotr_seg7_texture_07000C00[];
|
||||||
extern ALIGNED8 const Texture wmotr_seg7_texture_07001400[];
|
extern ALIGNED8 const Texture wmotr_seg7_texture_07001400[];
|
||||||
extern ALIGNED8 const Texture wmotr_seg7_texture_07001600[];
|
extern ALIGNED8 const Texture wmotr_seg7_texture_07001600[];
|
||||||
|
extern ALIGNED8 Texture gd_texture_hand_open[];
|
||||||
|
extern ALIGNED8 Texture gd_texture_hand_closed[];
|
||||||
|
extern ALIGNED8 Texture gd_texture_red_star_0[];
|
||||||
|
extern ALIGNED8 Texture gd_texture_red_star_1[];
|
||||||
|
extern ALIGNED8 Texture gd_texture_red_star_2[];
|
||||||
|
extern ALIGNED8 Texture gd_texture_red_star_3[];
|
||||||
|
extern ALIGNED8 Texture gd_texture_red_star_4[];
|
||||||
|
extern ALIGNED8 Texture gd_texture_red_star_5[];
|
||||||
|
extern ALIGNED8 Texture gd_texture_red_star_6[];
|
||||||
|
extern ALIGNED8 Texture gd_texture_red_star_7[];
|
||||||
|
extern ALIGNED8 Texture gd_texture_white_star_0[];
|
||||||
|
extern ALIGNED8 Texture gd_texture_white_star_1[];
|
||||||
|
extern ALIGNED8 Texture gd_texture_white_star_2[];
|
||||||
|
extern ALIGNED8 Texture gd_texture_white_star_3[];
|
||||||
|
extern ALIGNED8 Texture gd_texture_white_star_4[];
|
||||||
|
extern ALIGNED8 Texture gd_texture_white_star_5[];
|
||||||
|
extern ALIGNED8 Texture gd_texture_white_star_6[];
|
||||||
|
extern ALIGNED8 Texture gd_texture_white_star_7[];
|
||||||
|
extern ALIGNED8 Texture gd_texture_sparkle_0[];
|
||||||
|
extern ALIGNED8 Texture gd_texture_sparkle_1[];
|
||||||
|
extern ALIGNED8 Texture gd_texture_sparkle_2[];
|
||||||
|
extern ALIGNED8 Texture gd_texture_sparkle_3[];
|
||||||
|
extern ALIGNED8 Texture gd_texture_sparkle_4[];
|
||||||
|
extern ALIGNED8 Texture gd_texture_sparkle_5[];
|
||||||
|
|
||||||
extern ALIGNED8 const Texture mario_texture_metal[];
|
extern ALIGNED8 const Texture mario_texture_metal[];
|
||||||
extern ALIGNED8 const Texture mario_texture_yellow_button[];
|
extern ALIGNED8 const Texture mario_texture_yellow_button[];
|
||||||
|
|
|
@ -1695,6 +1695,32 @@ static const struct BuiltinTexInfo sDynosBuiltinTexs[] = {
|
||||||
define_builtin_tex(texture_font_normal, "textures/custom_font/custom_font_normal.rgba32.png", 512, 256, 32),
|
define_builtin_tex(texture_font_normal, "textures/custom_font/custom_font_normal.rgba32.png", 512, 256, 32),
|
||||||
define_builtin_tex(texture_font_title, "textures/custom_font/custom_font_title.rgba32.png", 1024, 512, 32),
|
define_builtin_tex(texture_font_title, "textures/custom_font/custom_font_title.rgba32.png", 1024, 512, 32),
|
||||||
define_builtin_tex(texture_font_tiny, "textures/custom_font/custom_font_tiny.rgba32.png", 256, 128, 32),
|
define_builtin_tex(texture_font_tiny, "textures/custom_font/custom_font_tiny.rgba32.png", 256, 128, 32),
|
||||||
|
|
||||||
|
// Goddard
|
||||||
|
define_builtin_tex(gd_texture_hand_open, "textures/intro_raw/hand_open.rgba16.png", 32, 32, 16),
|
||||||
|
define_builtin_tex(gd_texture_hand_closed, "textures/intro_raw/hand_closed.rgba16.png", 32, 32, 16),
|
||||||
|
define_builtin_tex(gd_texture_red_star_0, "textures/intro_raw/red_star_0.rgba16.png", 32, 32, 16),
|
||||||
|
define_builtin_tex(gd_texture_red_star_1, "textures/intro_raw/red_star_1.rgba16.png", 32, 32, 16),
|
||||||
|
define_builtin_tex(gd_texture_red_star_2, "textures/intro_raw/red_star_2.rgba16.png", 32, 32, 16),
|
||||||
|
define_builtin_tex(gd_texture_red_star_3, "textures/intro_raw/red_star_3.rgba16.png", 32, 32, 16),
|
||||||
|
define_builtin_tex(gd_texture_red_star_4, "textures/intro_raw/red_star_4.rgba16.png", 32, 32, 16),
|
||||||
|
define_builtin_tex(gd_texture_red_star_5, "textures/intro_raw/red_star_5.rgba16.png", 32, 32, 16),
|
||||||
|
define_builtin_tex(gd_texture_red_star_6, "textures/intro_raw/red_star_6.rgba16.png", 32, 32, 16),
|
||||||
|
define_builtin_tex(gd_texture_red_star_7, "textures/intro_raw/red_star_7.rgba16.png", 32, 32, 16),
|
||||||
|
define_builtin_tex(gd_texture_white_star_0, "textures/intro_raw/white_star_0.rgba16.png", 32, 32, 16),
|
||||||
|
define_builtin_tex(gd_texture_white_star_1, "textures/intro_raw/white_star_1.rgba16.png", 32, 32, 16),
|
||||||
|
define_builtin_tex(gd_texture_white_star_2, "textures/intro_raw/white_star_2.rgba16.png", 32, 32, 16),
|
||||||
|
define_builtin_tex(gd_texture_white_star_3, "textures/intro_raw/white_star_3.rgba16.png", 32, 32, 16),
|
||||||
|
define_builtin_tex(gd_texture_white_star_4, "textures/intro_raw/white_star_4.rgba16.png", 32, 32, 16),
|
||||||
|
define_builtin_tex(gd_texture_white_star_5, "textures/intro_raw/white_star_5.rgba16.png", 32, 32, 16),
|
||||||
|
define_builtin_tex(gd_texture_white_star_6, "textures/intro_raw/white_star_6.rgba16.png", 32, 32, 16),
|
||||||
|
define_builtin_tex(gd_texture_white_star_7, "textures/intro_raw/white_star_7.rgba16.png", 32, 32, 16),
|
||||||
|
define_builtin_tex(gd_texture_sparkle_0, "textures/intro_raw/sparkle_0.rgba16.png", 32, 32, 16),
|
||||||
|
define_builtin_tex(gd_texture_sparkle_1, "textures/intro_raw/sparkle_1.rgba16.png", 32, 32, 16),
|
||||||
|
define_builtin_tex(gd_texture_sparkle_2, "textures/intro_raw/sparkle_2.rgba16.png", 32, 32, 16),
|
||||||
|
define_builtin_tex(gd_texture_sparkle_3, "textures/intro_raw/sparkle_3.rgba16.png", 32, 32, 16),
|
||||||
|
define_builtin_tex(gd_texture_sparkle_4, "textures/intro_raw/sparkle_4.rgba16.png", 32, 32, 16),
|
||||||
|
define_builtin_tex(gd_texture_sparkle_5, "textures/intro_raw/sparkle_5.rgba16.png", 32, 32, 16),
|
||||||
};
|
};
|
||||||
|
|
||||||
const Texture* DynOS_Builtin_Tex_GetFromName(const char* aDataName) {
|
const Texture* DynOS_Builtin_Tex_GetFromName(const char* aDataName) {
|
||||||
|
|
|
@ -2357,6 +2357,28 @@
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
## [djui_hud_set_rotation](#djui_hud_set_rotation)
|
||||||
|
|
||||||
|
### Lua Example
|
||||||
|
`djui_hud_set_rotation(rotation, pivotX, pivotY)`
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
| Field | Type |
|
||||||
|
| ----- | ---- |
|
||||||
|
| rotation | `integer` |
|
||||||
|
| pivotX | `number` |
|
||||||
|
| pivotY | `number` |
|
||||||
|
|
||||||
|
### Returns
|
||||||
|
- None
|
||||||
|
|
||||||
|
### C Prototype
|
||||||
|
`void djui_hud_set_rotation(s16 rotation, f32 pivotX, f32 pivotY);`
|
||||||
|
|
||||||
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
## [djui_hud_world_pos_to_screen_pos](#djui_hud_world_pos_to_screen_pos)
|
## [djui_hud_world_pos_to_screen_pos](#djui_hud_world_pos_to_screen_pos)
|
||||||
|
|
||||||
### Lua Example
|
### Lua Example
|
||||||
|
|
|
@ -731,6 +731,7 @@
|
||||||
- [djui_hud_set_mouse_locked](functions-3.md#djui_hud_set_mouse_locked)
|
- [djui_hud_set_mouse_locked](functions-3.md#djui_hud_set_mouse_locked)
|
||||||
- [djui_hud_set_render_behind_hud](functions-3.md#djui_hud_set_render_behind_hud)
|
- [djui_hud_set_render_behind_hud](functions-3.md#djui_hud_set_render_behind_hud)
|
||||||
- [djui_hud_set_resolution](functions-3.md#djui_hud_set_resolution)
|
- [djui_hud_set_resolution](functions-3.md#djui_hud_set_resolution)
|
||||||
|
- [djui_hud_set_rotation](functions-3.md#djui_hud_set_rotation)
|
||||||
- [djui_hud_world_pos_to_screen_pos](functions-3.md#djui_hud_world_pos_to_screen_pos)
|
- [djui_hud_world_pos_to_screen_pos](functions-3.md#djui_hud_world_pos_to_screen_pos)
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
|
@ -118,6 +118,7 @@ extern s16 gCutsceneMsgYOffset;
|
||||||
|
|
||||||
void create_dl_identity_matrix(void);
|
void create_dl_identity_matrix(void);
|
||||||
void create_dl_translation_matrix(s8 pushOp, f32 x, f32 y, f32 z);
|
void create_dl_translation_matrix(s8 pushOp, f32 x, f32 y, f32 z);
|
||||||
|
void create_dl_rotation_matrix(s8 pushOp, f32 a, f32 x, f32 y, f32 z);
|
||||||
void create_dl_ortho_matrix(void);
|
void create_dl_ortho_matrix(void);
|
||||||
void render_generic_char(u8 c);
|
void render_generic_char(u8 c);
|
||||||
u8 str_ascii_char_to_dialog(char c);
|
u8 str_ascii_char_to_dialog(char c);
|
||||||
|
|
|
@ -238,67 +238,67 @@ ALIGNED8 Texture gd_texture_hand_closed[] = {
|
||||||
#include "textures/intro_raw/hand_closed.rgba16.inc.c"
|
#include "textures/intro_raw/hand_closed.rgba16.inc.c"
|
||||||
};
|
};
|
||||||
|
|
||||||
ALIGNED8 static Texture gd_texture_red_star_0[] = {
|
ALIGNED8 Texture gd_texture_red_star_0[] = {
|
||||||
#include "textures/intro_raw/red_star_0.rgba16.inc.c"
|
#include "textures/intro_raw/red_star_0.rgba16.inc.c"
|
||||||
};
|
};
|
||||||
|
|
||||||
ALIGNED8 static Texture gd_texture_red_star_1[] = {
|
ALIGNED8 Texture gd_texture_red_star_1[] = {
|
||||||
#include "textures/intro_raw/red_star_1.rgba16.inc.c"
|
#include "textures/intro_raw/red_star_1.rgba16.inc.c"
|
||||||
};
|
};
|
||||||
|
|
||||||
ALIGNED8 static Texture gd_texture_red_star_2[] = {
|
ALIGNED8 Texture gd_texture_red_star_2[] = {
|
||||||
#include "textures/intro_raw/red_star_2.rgba16.inc.c"
|
#include "textures/intro_raw/red_star_2.rgba16.inc.c"
|
||||||
};
|
};
|
||||||
|
|
||||||
ALIGNED8 static Texture gd_texture_red_star_3[] = {
|
ALIGNED8 Texture gd_texture_red_star_3[] = {
|
||||||
#include "textures/intro_raw/red_star_3.rgba16.inc.c"
|
#include "textures/intro_raw/red_star_3.rgba16.inc.c"
|
||||||
};
|
};
|
||||||
|
|
||||||
ALIGNED8 static Texture gd_texture_red_star_4[] = {
|
ALIGNED8 Texture gd_texture_red_star_4[] = {
|
||||||
#include "textures/intro_raw/red_star_4.rgba16.inc.c"
|
#include "textures/intro_raw/red_star_4.rgba16.inc.c"
|
||||||
};
|
};
|
||||||
|
|
||||||
ALIGNED8 static Texture gd_texture_red_star_5[] = {
|
ALIGNED8 Texture gd_texture_red_star_5[] = {
|
||||||
#include "textures/intro_raw/red_star_5.rgba16.inc.c"
|
#include "textures/intro_raw/red_star_5.rgba16.inc.c"
|
||||||
};
|
};
|
||||||
|
|
||||||
ALIGNED8 static Texture gd_texture_red_star_6[] = {
|
ALIGNED8 Texture gd_texture_red_star_6[] = {
|
||||||
#include "textures/intro_raw/red_star_6.rgba16.inc.c"
|
#include "textures/intro_raw/red_star_6.rgba16.inc.c"
|
||||||
};
|
};
|
||||||
|
|
||||||
ALIGNED8 static Texture gd_texture_red_star_7[] = {
|
ALIGNED8 Texture gd_texture_red_star_7[] = {
|
||||||
#include "textures/intro_raw/red_star_7.rgba16.inc.c"
|
#include "textures/intro_raw/red_star_7.rgba16.inc.c"
|
||||||
};
|
};
|
||||||
|
|
||||||
ALIGNED8 static Texture gd_texture_white_star_0[] = {
|
ALIGNED8 Texture gd_texture_white_star_0[] = {
|
||||||
#include "textures/intro_raw/white_star_0.rgba16.inc.c"
|
#include "textures/intro_raw/white_star_0.rgba16.inc.c"
|
||||||
};
|
};
|
||||||
|
|
||||||
ALIGNED8 static Texture gd_texture_white_star_1[] = {
|
ALIGNED8 Texture gd_texture_white_star_1[] = {
|
||||||
#include "textures/intro_raw/white_star_1.rgba16.inc.c"
|
#include "textures/intro_raw/white_star_1.rgba16.inc.c"
|
||||||
};
|
};
|
||||||
|
|
||||||
ALIGNED8 static Texture gd_texture_white_star_2[] = {
|
ALIGNED8 Texture gd_texture_white_star_2[] = {
|
||||||
#include "textures/intro_raw/white_star_2.rgba16.inc.c"
|
#include "textures/intro_raw/white_star_2.rgba16.inc.c"
|
||||||
};
|
};
|
||||||
|
|
||||||
ALIGNED8 static Texture gd_texture_white_star_3[] = {
|
ALIGNED8 Texture gd_texture_white_star_3[] = {
|
||||||
#include "textures/intro_raw/white_star_3.rgba16.inc.c"
|
#include "textures/intro_raw/white_star_3.rgba16.inc.c"
|
||||||
};
|
};
|
||||||
|
|
||||||
ALIGNED8 static Texture gd_texture_white_star_4[] = {
|
ALIGNED8 Texture gd_texture_white_star_4[] = {
|
||||||
#include "textures/intro_raw/white_star_4.rgba16.inc.c"
|
#include "textures/intro_raw/white_star_4.rgba16.inc.c"
|
||||||
};
|
};
|
||||||
|
|
||||||
ALIGNED8 static Texture gd_texture_white_star_5[] = {
|
ALIGNED8 Texture gd_texture_white_star_5[] = {
|
||||||
#include "textures/intro_raw/white_star_5.rgba16.inc.c"
|
#include "textures/intro_raw/white_star_5.rgba16.inc.c"
|
||||||
};
|
};
|
||||||
|
|
||||||
ALIGNED8 static Texture gd_texture_white_star_6[] = {
|
ALIGNED8 Texture gd_texture_white_star_6[] = {
|
||||||
#include "textures/intro_raw/white_star_6.rgba16.inc.c"
|
#include "textures/intro_raw/white_star_6.rgba16.inc.c"
|
||||||
};
|
};
|
||||||
|
|
||||||
ALIGNED8 static Texture gd_texture_white_star_7[] = {
|
ALIGNED8 Texture gd_texture_white_star_7[] = {
|
||||||
#include "textures/intro_raw/white_star_7.rgba16.inc.c"
|
#include "textures/intro_raw/white_star_7.rgba16.inc.c"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -469,30 +469,30 @@ static Gfx *gd_silver_star_dl_array[] = {
|
||||||
gd_dl_silver_star_7,
|
gd_dl_silver_star_7,
|
||||||
};
|
};
|
||||||
|
|
||||||
ALIGNED8 static Texture gd_texture_sparkle_0[] = {
|
ALIGNED8 Texture gd_texture_sparkle_0[] = {
|
||||||
#include "textures/intro_raw/sparkle_0.rgba16.inc.c"
|
#include "textures/intro_raw/sparkle_0.rgba16.inc.c"
|
||||||
};
|
};
|
||||||
|
|
||||||
ALIGNED8 static Texture gd_texture_sparkle_1[] = {
|
ALIGNED8 Texture gd_texture_sparkle_1[] = {
|
||||||
#include "textures/intro_raw/sparkle_1.rgba16.inc.c"
|
#include "textures/intro_raw/sparkle_1.rgba16.inc.c"
|
||||||
};
|
};
|
||||||
|
|
||||||
ALIGNED8 static Texture gd_texture_sparkle_2[] = {
|
ALIGNED8 Texture gd_texture_sparkle_2[] = {
|
||||||
#include "textures/intro_raw/sparkle_2.rgba16.inc.c"
|
#include "textures/intro_raw/sparkle_2.rgba16.inc.c"
|
||||||
};
|
};
|
||||||
|
|
||||||
ALIGNED8 static Texture gd_texture_sparkle_3[] = {
|
ALIGNED8 Texture gd_texture_sparkle_3[] = {
|
||||||
#include "textures/intro_raw/sparkle_3.rgba16.inc.c"
|
#include "textures/intro_raw/sparkle_3.rgba16.inc.c"
|
||||||
};
|
};
|
||||||
|
|
||||||
ALIGNED8 static Texture gd_texture_sparkle_4[] = {
|
ALIGNED8 Texture gd_texture_sparkle_4[] = {
|
||||||
#include "textures/intro_raw/sparkle_4.rgba16.inc.c"
|
#include "textures/intro_raw/sparkle_4.rgba16.inc.c"
|
||||||
};
|
};
|
||||||
|
|
||||||
//! No reference to this texture. Two DL's uses the same previous texture
|
//! No reference to this texture. Two DL's uses the same previous texture
|
||||||
// instead of using this texture.
|
// instead of using this texture.
|
||||||
// Fixed via setting TEXTURE_FIX to 1.
|
// Fixed via setting TEXTURE_FIX to 1.
|
||||||
ALIGNED8 static Texture gd_texture_sparkle_5[] = {
|
ALIGNED8 Texture gd_texture_sparkle_5[] = {
|
||||||
#include "textures/intro_raw/sparkle_5.rgba16.inc.c"
|
#include "textures/intro_raw/sparkle_5.rgba16.inc.c"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
static enum HudUtilsResolution sResolution = RESOLUTION_DJUI;
|
static enum HudUtilsResolution sResolution = RESOLUTION_DJUI;
|
||||||
static enum DjuiFontType sFont = FONT_NORMAL;
|
static enum DjuiFontType sFont = FONT_NORMAL;
|
||||||
|
static struct { f32 rotation; f32 pivotX; f32 pivotY; } sRotation = { 0, 0, 0 };
|
||||||
|
|
||||||
f32 gDjuiHudUtilsZ = 0;
|
f32 gDjuiHudUtilsZ = 0;
|
||||||
u8 gDjuiHudLockMouse = false;
|
u8 gDjuiHudLockMouse = false;
|
||||||
|
@ -152,6 +153,12 @@ void djui_hud_set_color(u8 r, u8 g, u8 b, u8 a) {
|
||||||
gDPSetEnvColor(gDisplayListHead++, r, g, b, a);
|
gDPSetEnvColor(gDisplayListHead++, r, g, b, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void djui_hud_set_rotation(s16 rotation, f32 pivotX, f32 pivotY) {
|
||||||
|
sRotation.rotation = (rotation * 180.f) / 0x8000;
|
||||||
|
sRotation.pivotX = pivotX;
|
||||||
|
sRotation.pivotY = pivotY;
|
||||||
|
}
|
||||||
|
|
||||||
u32 djui_hud_get_screen_width(void) {
|
u32 djui_hud_get_screen_width(void) {
|
||||||
u32 windowWidth, windowHeight;
|
u32 windowWidth, windowHeight;
|
||||||
wm_api->get_dimensions(&windowWidth, &windowHeight);
|
wm_api->get_dimensions(&windowWidth, &windowHeight);
|
||||||
|
@ -268,11 +275,20 @@ void djui_hud_render_texture_raw(const u8* texture, u32 bitSize, u32 width, u32
|
||||||
djui_hud_position_translate(&translatedX, &translatedY);
|
djui_hud_position_translate(&translatedX, &translatedY);
|
||||||
create_dl_translation_matrix(DJUI_MTX_PUSH, translatedX, translatedY, gDjuiHudUtilsZ);
|
create_dl_translation_matrix(DJUI_MTX_PUSH, translatedX, translatedY, gDjuiHudUtilsZ);
|
||||||
|
|
||||||
// translate scale
|
// rotate
|
||||||
f32 translatedW = scaleW;
|
f32 translatedW = scaleW;
|
||||||
f32 translatedH = scaleH;
|
f32 translatedH = scaleH;
|
||||||
djui_hud_size_translate(&translatedW);
|
djui_hud_size_translate(&translatedW);
|
||||||
djui_hud_size_translate(&translatedH);
|
djui_hud_size_translate(&translatedH);
|
||||||
|
if (sRotation.rotation != 0) {
|
||||||
|
f32 pivotTranslationX = width * translatedW * sRotation.pivotX;
|
||||||
|
f32 pivotTranslationY = height * translatedH * sRotation.pivotY;
|
||||||
|
create_dl_translation_matrix(DJUI_MTX_NOPUSH, +pivotTranslationX, -pivotTranslationY, 0);
|
||||||
|
create_dl_rotation_matrix(DJUI_MTX_NOPUSH, sRotation.rotation, 0, 0, 1);
|
||||||
|
create_dl_translation_matrix(DJUI_MTX_NOPUSH, -pivotTranslationX, +pivotTranslationY, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// translate scale
|
||||||
create_dl_scale_matrix(DJUI_MTX_NOPUSH, width * translatedW, height * translatedH, 1.0f);
|
create_dl_scale_matrix(DJUI_MTX_NOPUSH, width * translatedW, height * translatedH, 1.0f);
|
||||||
|
|
||||||
// render
|
// render
|
||||||
|
@ -293,11 +309,21 @@ void djui_hud_render_texture_tile_raw(const u8* texture, u32 bitSize, u32 width,
|
||||||
djui_hud_position_translate(&translatedX, &translatedY);
|
djui_hud_position_translate(&translatedX, &translatedY);
|
||||||
create_dl_translation_matrix(DJUI_MTX_PUSH, translatedX, translatedY, gDjuiHudUtilsZ);
|
create_dl_translation_matrix(DJUI_MTX_PUSH, translatedX, translatedY, gDjuiHudUtilsZ);
|
||||||
|
|
||||||
// translate scale
|
// rotate
|
||||||
f32 translatedW = scaleW;
|
f32 translatedW = scaleW;
|
||||||
f32 translatedH = scaleH;
|
f32 translatedH = scaleH;
|
||||||
djui_hud_size_translate(&translatedW);
|
djui_hud_size_translate(&translatedW);
|
||||||
djui_hud_size_translate(&translatedH);
|
djui_hud_size_translate(&translatedH);
|
||||||
|
if (sRotation.rotation != 0) {
|
||||||
|
f32 aspect = tileH ? ((f32) tileW / (f32) tileH) : 1.f;
|
||||||
|
f32 pivotTranslationX = width * translatedW * aspect * sRotation.pivotX;
|
||||||
|
f32 pivotTranslationY = height * translatedH * sRotation.pivotY;
|
||||||
|
create_dl_translation_matrix(DJUI_MTX_NOPUSH, +pivotTranslationX, -pivotTranslationY, 0);
|
||||||
|
create_dl_rotation_matrix(DJUI_MTX_NOPUSH, sRotation.rotation, 0, 0, 1);
|
||||||
|
create_dl_translation_matrix(DJUI_MTX_NOPUSH, -pivotTranslationX, +pivotTranslationY, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// translate scale
|
||||||
create_dl_scale_matrix(DJUI_MTX_NOPUSH, width * translatedW, height * translatedH, 1.0f);
|
create_dl_scale_matrix(DJUI_MTX_NOPUSH, width * translatedW, height * translatedH, 1.0f);
|
||||||
|
|
||||||
// render
|
// render
|
||||||
|
@ -369,11 +395,20 @@ void djui_hud_render_rect(f32 x, f32 y, f32 width, f32 height) {
|
||||||
djui_hud_position_translate(&translatedX, &translatedY);
|
djui_hud_position_translate(&translatedX, &translatedY);
|
||||||
create_dl_translation_matrix(DJUI_MTX_PUSH, translatedX, translatedY, gDjuiHudUtilsZ);
|
create_dl_translation_matrix(DJUI_MTX_PUSH, translatedX, translatedY, gDjuiHudUtilsZ);
|
||||||
|
|
||||||
// translate scale
|
// rotate
|
||||||
f32 translatedW = width;
|
f32 translatedW = width;
|
||||||
f32 translatedH = height;
|
f32 translatedH = height;
|
||||||
djui_hud_size_translate(&translatedW);
|
djui_hud_size_translate(&translatedW);
|
||||||
djui_hud_size_translate(&translatedH);
|
djui_hud_size_translate(&translatedH);
|
||||||
|
if (sRotation.rotation != 0) {
|
||||||
|
f32 pivotTranslationX = translatedW * sRotation.pivotX;
|
||||||
|
f32 pivotTranslationY = translatedH * sRotation.pivotY;
|
||||||
|
create_dl_translation_matrix(DJUI_MTX_NOPUSH, +pivotTranslationX, -pivotTranslationY, 0);
|
||||||
|
create_dl_rotation_matrix(DJUI_MTX_NOPUSH, sRotation.rotation, 0, 0, 1);
|
||||||
|
create_dl_translation_matrix(DJUI_MTX_NOPUSH, -pivotTranslationX, +pivotTranslationY, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// translate scale
|
||||||
create_dl_scale_matrix(DJUI_MTX_NOPUSH, translatedW, translatedH, 1.0f);
|
create_dl_scale_matrix(DJUI_MTX_NOPUSH, translatedW, translatedH, 1.0f);
|
||||||
|
|
||||||
// render
|
// render
|
||||||
|
|
|
@ -39,6 +39,7 @@ extern u8 gDjuiHudLockMouse;
|
||||||
void djui_hud_set_resolution(enum HudUtilsResolution resolutionType);
|
void djui_hud_set_resolution(enum HudUtilsResolution resolutionType);
|
||||||
void djui_hud_set_font(enum DjuiFontType fontType);
|
void djui_hud_set_font(enum DjuiFontType fontType);
|
||||||
void djui_hud_set_color(u8 r, u8 g, u8 b, u8 a);
|
void djui_hud_set_color(u8 r, u8 g, u8 b, u8 a);
|
||||||
|
void djui_hud_set_rotation(s16 rotation, f32 pivotX, f32 pivotY);
|
||||||
|
|
||||||
u32 djui_hud_get_screen_width(void);
|
u32 djui_hud_get_screen_width(void);
|
||||||
u32 djui_hud_get_screen_height(void);
|
u32 djui_hud_get_screen_height(void);
|
||||||
|
|
|
@ -11771,6 +11771,27 @@ int smlua_func_djui_hud_set_resolution(lua_State* L) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int smlua_func_djui_hud_set_rotation(lua_State* L) {
|
||||||
|
if (L == NULL) { return 0; }
|
||||||
|
|
||||||
|
int top = lua_gettop(L);
|
||||||
|
if (top != 3) {
|
||||||
|
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "djui_hud_set_rotation", 3, top);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
s16 rotation = smlua_to_integer(L, 1);
|
||||||
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "djui_hud_set_rotation"); return 0; }
|
||||||
|
f32 pivotX = smlua_to_number(L, 2);
|
||||||
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "djui_hud_set_rotation"); return 0; }
|
||||||
|
f32 pivotY = smlua_to_number(L, 3);
|
||||||
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "djui_hud_set_rotation"); return 0; }
|
||||||
|
|
||||||
|
djui_hud_set_rotation(rotation, pivotX, pivotY);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int smlua_func_djui_hud_world_pos_to_screen_pos(lua_State* L) {
|
int smlua_func_djui_hud_world_pos_to_screen_pos(lua_State* L) {
|
||||||
if (L == NULL) { return 0; }
|
if (L == NULL) { return 0; }
|
||||||
|
|
||||||
|
@ -29889,6 +29910,7 @@ void smlua_bind_functions_autogen(void) {
|
||||||
smlua_bind_function(L, "djui_hud_set_mouse_locked", smlua_func_djui_hud_set_mouse_locked);
|
smlua_bind_function(L, "djui_hud_set_mouse_locked", smlua_func_djui_hud_set_mouse_locked);
|
||||||
smlua_bind_function(L, "djui_hud_set_render_behind_hud", smlua_func_djui_hud_set_render_behind_hud);
|
smlua_bind_function(L, "djui_hud_set_render_behind_hud", smlua_func_djui_hud_set_render_behind_hud);
|
||||||
smlua_bind_function(L, "djui_hud_set_resolution", smlua_func_djui_hud_set_resolution);
|
smlua_bind_function(L, "djui_hud_set_resolution", smlua_func_djui_hud_set_resolution);
|
||||||
|
smlua_bind_function(L, "djui_hud_set_rotation", smlua_func_djui_hud_set_rotation);
|
||||||
smlua_bind_function(L, "djui_hud_world_pos_to_screen_pos", smlua_func_djui_hud_world_pos_to_screen_pos);
|
smlua_bind_function(L, "djui_hud_world_pos_to_screen_pos", smlua_func_djui_hud_world_pos_to_screen_pos);
|
||||||
|
|
||||||
// djui_popup.h
|
// djui_popup.h
|
||||||
|
|
Loading…
Reference in a new issue