1
0
Fork 0
mirror of https://github.com/suchmememanyskill/TegraExplorer.git synced 2024-11-26 13:52:06 +00:00

Horizontal TE, proper edition

yes i can't git, shut
This commit is contained in:
Such Meme, Many Skill 2020-04-30 23:40:26 +02:00
parent 931cbc829f
commit 305c372d8c
4 changed files with 73 additions and 40 deletions

View file

@ -165,14 +165,14 @@ void gfx_con_setcol(u32 fgcol, int fillbg, u32 bgcol)
void gfx_con_getpos(u32 *x, u32 *y)
{
*x = gfx_con.x;
*y = gfx_con.y;
*x = YLEFT - gfx_con.y;
*y = gfx_con.x;
}
void gfx_con_setpos(u32 x, u32 y)
{
gfx_con.x = x;
gfx_con.y = y;
gfx_con.x = y;
gfx_con.y = YLEFT - x;
}
void gfx_putc(char c)
@ -196,44 +196,53 @@ void gfx_putc(char c)
if (v & 1)
{
*fb = gfx_con.fgcol;
fb++;
fb -= gfx_ctxt.stride;
*fb = gfx_con.fgcol;
}
else if (gfx_con.fillbg)
{
*fb = gfx_con.bgcol;
fb++;
fb -= gfx_ctxt.stride;
*fb = gfx_con.bgcol;
}
else
fb++;
fb -= gfx_ctxt.stride;
v >>= 1;
fb++;
fb -= gfx_ctxt.stride;
}
fb += gfx_ctxt.stride - 16;
//fb += gfx_ctxt.stride - 16;
//fb = fbtop + 2;
fb += (gfx_ctxt.stride * 16) + 1;
v = *cbuf;
}
cbuf++;
}
/*
gfx_con.x += 16;
if (gfx_con.x >= gfx_ctxt.width - 16) {
gfx_con.x = 0;
gfx_con.y += 16;
}
*/
gfx_con.y -= 16;
if (gfx_con.y < 16){
gfx_con.y = YLEFT;
gfx_con.x += 16;
}
}
else if (c == '\n')
{
gfx_con.x = 0;
gfx_con.y +=16;
if (gfx_con.y > gfx_ctxt.height - 16)
gfx_con.y = 0;
gfx_con.y = YLEFT;
gfx_con.x += 16;
if (gfx_con.x > gfx_ctxt.width - 16)
gfx_con.x = 0;
}
else if (c == '\e')
gfx_con.x = 672;
gfx_con.y = 607;
else if (c == '\a')
gfx_con.x = 608;
gfx_con.y = 671;
else if (c == '\r')
gfx_con.x = 0;
gfx_con.y = YLEFT;
break;
case 8:
@ -252,29 +261,31 @@ void gfx_putc(char c)
else if (gfx_con.fillbg)
*fb = gfx_con.bgcol;
v >>= 1;
fb++;
fb -= gfx_ctxt.stride;
}
fb += gfx_ctxt.stride - 8;
fb += (gfx_ctxt.stride * 8) + 1;
}
gfx_con.x += 8;
if (gfx_con.x >= gfx_ctxt.width - 8) {
gfx_con.x = 0;
gfx_con.y += 8;
gfx_con.y -= 8;
if (gfx_con.y < 8){
gfx_con.y = YLEFT;
gfx_con.x += 8;
}
}
else if (c == '\n')
{
gfx_con.x = 0;
gfx_con.y += 8;
if (gfx_con.y > gfx_ctxt.height - 8)
gfx_con.y = 0;
gfx_con.y = YLEFT;
gfx_con.x += 8;
if (gfx_con.x > gfx_ctxt.width - 8)
gfx_con.x = 0;
}
else if (c == '\e')
gfx_con.x = 672;
else if (c == '\e')
gfx_con.y = 607;
else if (c == '\a')
gfx_con.x = 608;
gfx_con.y = 671;
else if (c == '\r')
gfx_con.x = 0;
gfx_con.y = YLEFT;
break;
}
@ -520,19 +531,33 @@ void gfx_set_rect_grey(const u8 *buf, u32 size_x, u32 size_y, u32 pos_x, u32 pos
}
void gfx_boxGrey(int x0, int y0, int x1, int y1, u8 shade){
for (int y = (YLEFT - x0); y >= (YLEFT - x1); y--){
memset(gfx_ctxt.fb + y * gfx_ctxt.stride + y0, shade, (y1 - y0 + 1) * 4);
}
}
/*
void gfx_boxGrey_old(int x0, int y0, int x1, int y1, u8 shade){
for (int y = y0; y <= y1; y++){
memset(gfx_ctxt.fb + y * gfx_ctxt.stride + x0, shade, (x1 - x0) * 4);
}
}
*/
void gfx_box(int x0, int y0, int x1, int y1, u32 color){
for (int y = (YLEFT - x0); y >= (YLEFT - x1); y--){
for (int x = y0; x <= y1; x++){
gfx_set_pixel(x, y, color);
}
}
}
/*
void gfx_box_old(int x0, int y0, int x1, int y1, u32 color){
for (int x = x0; x < x1 + 1; x++){
for (int y = y0; y < y1 + 1; y++){
gfx_set_pixel(x, y, color);
}
}
}
*/
void gfx_set_rect_rgb(const u8 *buf, u32 size_x, u32 size_y, u32 pos_x, u32 pos_y)
{
u32 pos = 0;

View file

@ -27,6 +27,8 @@
#define WPRINTF(text) gfx_printf("%k"text"%k\n", 0xFFFFDD00, 0xFFCCCCCC)
#define WPRINTFARGS(text, args...) gfx_printf("%k"text"%k\n", 0xFFFFDD00, args, 0xFFCCCCCC)
#define YLEFT 1279
void gfx_init_ctxt(u32 *fb, u32 width, u32 height, u32 stride);
void gfx_clear_grey(u8 color);
void gfx_clear_partial_grey(u8 color, u32 pos_x, u32 height);
@ -52,6 +54,12 @@ void gfx_render_bmp_argb(const u32 *buf, u32 size_x, u32 size_y, u32 pos_x, u32
void gfx_box(int x0, int y0, int x1, int y1, u32 color);
void gfx_boxGrey(int x0, int y0, int x1, int y1, u8 shade);
/*
#define GFX_SETPOSCORRECTED(x, y) gfx_con_setpos(y - YLEFT, x)
#define GFX_BOXCORRECTED(x0, y0, x1, y1, color) gfx_box_old((y0 - YLEFT), x0, (y1 - YLEFT), x1, color)
#define GFX_BOXGREYCORRECTED(x0, y0, x1, y1, shade) gfx_boxGrey((y0 - YLEFT), x0, (y1 - YLEFT), x1, shade)
*/
// Global gfx console and context.
gfx_ctxt_t gfx_ctxt;
gfx_con_t gfx_con;

View file

@ -19,11 +19,11 @@ void gfx_clearscreen(){
SWAPCOLOR(COLOR_DEFAULT);
SWAPBGCOLOR(COLOR_WHITE);
gfx_box(0, 1263, 719, 1279, COLOR_WHITE);
gfx_con_setpos(0, 1263);
gfx_boxGrey(0, 703, 1279, 719, 0xFF);
gfx_con_setpos(0, 703);
gfx_printf("Move: Vol+/- | Select: Pow | Battery: %3d%%", battery >> 8);
gfx_box(0, 0, 719, 15, COLOR_WHITE);
gfx_boxGrey(0, 0, 1279, 15, 0xFF);
gfx_con_setpos(0, 0);
gfx_printf("Tegraexplorer v1.5.2\n");
@ -121,7 +121,7 @@ void gfx_printandclear(char *in, int length){
gfx_printf(" ");
*/
gfx_boxGrey(x, y, 703, y + 16, 0x1B);
gfx_boxGrey(x, y, 687, y + 15, 0x1B);
gfx_con_setpos(x, y);

View file

@ -61,7 +61,7 @@ void _printentry(menu_entry entry, bool highlighted, bool refresh){
}
int menu_make(menu_entry *entries, int amount, char *toptext){
int currentpos = 0, res = 0, offset = 0, delay = 300, minscreen = 0, maxscreen = 59, calculatedamount = 0;
int currentpos = 0, res = 0, offset = 0, delay = 300, minscreen = 0, maxscreen = 29, calculatedamount = 0;
u32 scrolltimer, timer;
bool refresh = false;
@ -71,7 +71,7 @@ int menu_make(menu_entry *entries, int amount, char *toptext){
if (!(entries[i].property & ISMENU))
calculatedamount++;
gfx_con_setpos(512, 0);
gfx_con_setpos(1071, 0);
if (calculatedamount){
SWAPCOLOR(COLOR_DEFAULT);
SWAPBGCOLOR(COLOR_WHITE);
@ -113,11 +113,11 @@ int menu_make(menu_entry *entries, int amount, char *toptext){
refresh = true;
}
for (int i = 0 + offset; i < amount && i < 60 + offset; i++)
for (int i = 0 + offset; i < amount && i < 30 + offset; i++)
if (!(entries[i].property & ISHIDE))
_printentry(entries[i], (i == currentpos), refresh);
gfx_printf("\n%k%K %s %s\n\nTime taken for screen draw: %dms", COLOR_BLUE, COLOR_DEFAULT, (offset + 60 < amount) ? "v" : " ", (offset > 0) ? "^" : " ", get_tmr_ms() - timer);
gfx_printf("\n%k%K %s %s\n\nTime taken for screen draw: %dms ", COLOR_BLUE, COLOR_DEFAULT, (offset + 30 < amount) ? "v" : " ", (offset > 0) ? "^" : " ", get_tmr_ms() - timer);
while (btn_read() & BTN_POWER);