wip
This commit is contained in:
parent
b2f5e09465
commit
9b1f3d4a67
2
Makefile
2
Makefile
@ -1,6 +1,6 @@
|
|||||||
all: xm_player.elf
|
all: xm_player.elf
|
||||||
|
|
||||||
OPT = -O2
|
OPT = -O3
|
||||||
|
|
||||||
MAKEFILE_PATH := $(patsubst %/,%,$(dir $(abspath $(firstword $(MAKEFILE_LIST)))))
|
MAKEFILE_PATH := $(patsubst %/,%,$(dir $(abspath $(firstword $(MAKEFILE_LIST)))))
|
||||||
LIB ?= $(MAKEFILE_PATH)/dreamcast
|
LIB ?= $(MAKEFILE_PATH)/dreamcast
|
||||||
|
4
src/alpha.hpp
Normal file
4
src/alpha.hpp
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
//static constexpr uint32_t alpha = 0xcf000000;
|
||||||
|
static constexpr uint32_t alpha = 0x80000000;
|
@ -131,8 +131,8 @@ void main()
|
|||||||
system.IML4EXT = istext::aica;
|
system.IML4EXT = istext::aica;
|
||||||
|
|
||||||
static uint8_t op_buf[1024 * 1024] __attribute__((aligned(32)));
|
static uint8_t op_buf[1024 * 1024] __attribute__((aligned(32)));
|
||||||
static uint8_t pt_buf[1024 * 1024] __attribute__((aligned(32)));
|
static uint8_t pt_buf[1024 * 1024 / 2] __attribute__((aligned(32)));
|
||||||
static uint8_t tl_buf[1024 * 1024 / 2] __attribute__((aligned(32)));
|
static uint8_t tl_buf[1024 * 1024 / 4] __attribute__((aligned(32)));
|
||||||
ta_multiwriter multi(ta_parameter_writer(op_buf, (sizeof (op_buf))),
|
ta_multiwriter multi(ta_parameter_writer(op_buf, (sizeof (op_buf))),
|
||||||
ta_parameter_writer(pt_buf, (sizeof (pt_buf))),
|
ta_parameter_writer(pt_buf, (sizeof (pt_buf))),
|
||||||
ta_parameter_writer(tl_buf, (sizeof (tl_buf))));
|
ta_parameter_writer(tl_buf, (sizeof (tl_buf))));
|
||||||
|
@ -17,9 +17,9 @@
|
|||||||
#include "framebuffer.hpp"
|
#include "framebuffer.hpp"
|
||||||
#include "graphics.hpp"
|
#include "graphics.hpp"
|
||||||
|
|
||||||
#define __length(c) ((sizeof (c)) / (sizeof (c[0])))
|
#include "alpha.hpp"
|
||||||
|
|
||||||
uint32_t alpha = 0xcf000000;
|
#define __length(c) ((sizeof (c)) / (sizeof (c[0])))
|
||||||
|
|
||||||
void position_left()
|
void position_left()
|
||||||
{
|
{
|
||||||
@ -293,13 +293,13 @@ namespace scene::options {
|
|||||||
{(float)framebuffer.px_width, 0, 0.5},
|
{(float)framebuffer.px_width, 0, 0.5},
|
||||||
{(float)framebuffer.px_width, (float)framebuffer.px_height, 0.5},
|
{(float)framebuffer.px_width, (float)framebuffer.px_height, 0.5},
|
||||||
{0, (float)framebuffer.px_height, 0.5},
|
{0, (float)framebuffer.px_height, 0.5},
|
||||||
alpha | 0x202020);
|
(0xc0 << 24) | 0x202020);
|
||||||
}
|
}
|
||||||
|
|
||||||
void transfer(ta_multiwriter& multi)
|
void transfer(ta_multiwriter& multi)
|
||||||
{
|
{
|
||||||
update();
|
update();
|
||||||
top.draw(multi);
|
top.draw(multi, true);
|
||||||
draw_corners(multi.tl);
|
draw_corners(multi.tl);
|
||||||
draw_shroud(multi.tl);
|
draw_shroud(multi.tl);
|
||||||
}
|
}
|
||||||
|
@ -280,7 +280,7 @@ namespace scene::tracker {
|
|||||||
update_start();
|
update_start();
|
||||||
|
|
||||||
metadata::draw(multi, 5, 8);
|
metadata::draw(multi, 5, 8);
|
||||||
top.draw(multi);
|
top.draw(multi, false);
|
||||||
draw_button_labels(multi.pt);
|
draw_button_labels(multi.pt);
|
||||||
tracklist::draw(multi, top.width + 5, 5);
|
tracklist::draw(multi, top.width + 5, 5);
|
||||||
float y = top.y() + top.height + 5;
|
float y = top.y() + top.height + 5;
|
||||||
|
@ -3,23 +3,25 @@
|
|||||||
#include "ta_parameter.hpp"
|
#include "ta_parameter.hpp"
|
||||||
#include "graphics_primitive.hpp"
|
#include "graphics_primitive.hpp"
|
||||||
|
|
||||||
|
#include "alpha.hpp"
|
||||||
|
|
||||||
namespace widget {
|
namespace widget {
|
||||||
|
|
||||||
const static float shadow_depth = 1.0 / 10.0;
|
const static float shadow_depth = 1.0 / 10.0;
|
||||||
const static int shadow_color = 0x0000000;
|
const static int shadow_color = alpha | 0x0000000;
|
||||||
|
|
||||||
const static float lowlight_depth = 1.0 / 9.0;
|
const static float lowlight_depth = 1.0 / 9.0;
|
||||||
const static int lowlight_color = 0x0c0d0d;
|
const static int lowlight_color = alpha | 0x0c0d0d;
|
||||||
|
|
||||||
const static float highlight_depth = 1.0 / 8.0;
|
const static float highlight_depth = 1.0 / 8.0;
|
||||||
const static int highlight_color = 0x353a3a;
|
const static int highlight_color = alpha | 0x353a3a;
|
||||||
|
|
||||||
const static int highlight_click_color = 0x141616;
|
const static int highlight_click_color = alpha | 0x141616;
|
||||||
|
|
||||||
const static float background_depth = 1.0 / 7.0;
|
const static float background_depth = 1.0 / 7.0;
|
||||||
const static int background_color = 0x282c2c;
|
const static int background_color = alpha | 0x282c2c;
|
||||||
|
|
||||||
void button::draw_shadow(ta_parameter_writer& writer) const
|
void button::draw_shadow(ta_parameter_writer& writer, float dm) const
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
float x0 = x() + 1;
|
float x0 = x() + 1;
|
||||||
@ -27,10 +29,10 @@ namespace widget {
|
|||||||
float y0 = y();
|
float y0 = y();
|
||||||
float y1 = y() + height;
|
float y1 = y() + height;
|
||||||
quad_type_0(writer,
|
quad_type_0(writer,
|
||||||
{x0, y0, shadow_depth},
|
{x0, y0, shadow_depth * dm},
|
||||||
{x1, y0, shadow_depth},
|
{x1, y0, shadow_depth * dm},
|
||||||
{x1, y1, shadow_depth},
|
{x1, y1, shadow_depth * dm},
|
||||||
{x0, y1, shadow_depth},
|
{x0, y1, shadow_depth * dm},
|
||||||
shadow_color);
|
shadow_color);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -39,29 +41,29 @@ namespace widget {
|
|||||||
float y0 = y() + 1;
|
float y0 = y() + 1;
|
||||||
float y1 = y() + height - 1;
|
float y1 = y() + height - 1;
|
||||||
quad_type_0(writer,
|
quad_type_0(writer,
|
||||||
{x0, y0, shadow_depth},
|
{x0, y0, shadow_depth * dm},
|
||||||
{x1, y0, shadow_depth},
|
{x1, y0, shadow_depth * dm},
|
||||||
{x1, y1, shadow_depth},
|
{x1, y1, shadow_depth * dm},
|
||||||
{x0, y1, shadow_depth},
|
{x0, y1, shadow_depth * dm},
|
||||||
shadow_color);
|
shadow_color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void button::draw_lowlight(ta_parameter_writer& writer) const
|
void button::draw_lowlight(ta_parameter_writer& writer, float dm) const
|
||||||
{
|
{
|
||||||
float x0 = x() + 1;
|
float x0 = x() + 1;
|
||||||
float x1 = x() + width - 1;
|
float x1 = x() + width - 1;
|
||||||
float y0 = y() + 1;
|
float y0 = y() + 1;
|
||||||
float y1 = y() + height - 1;
|
float y1 = y() + height - 1;
|
||||||
quad_type_0(writer,
|
quad_type_0(writer,
|
||||||
{x0, y0, lowlight_depth},
|
{x0, y0, lowlight_depth * dm},
|
||||||
{x1, y0, lowlight_depth},
|
{x1, y0, lowlight_depth * dm},
|
||||||
{x1, y1, lowlight_depth},
|
{x1, y1, lowlight_depth * dm},
|
||||||
{x0, y1, lowlight_depth},
|
{x0, y1, lowlight_depth * dm},
|
||||||
lowlight_color);
|
lowlight_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void button::draw_highlight(ta_parameter_writer& writer) const
|
void button::draw_highlight(ta_parameter_writer& writer, float dm) const
|
||||||
{
|
{
|
||||||
float x0 = x() + 1;
|
float x0 = x() + 1;
|
||||||
float x1 = x() + width - 2;
|
float x1 = x() + width - 2;
|
||||||
@ -70,42 +72,50 @@ namespace widget {
|
|||||||
|
|
||||||
int color = (click_state == click_type::release) ? highlight_color : highlight_click_color;
|
int color = (click_state == click_type::release) ? highlight_color : highlight_click_color;
|
||||||
quad_type_0(writer,
|
quad_type_0(writer,
|
||||||
{x0, y0, highlight_depth},
|
{x0, y0, highlight_depth * dm},
|
||||||
{x1, y0, highlight_depth},
|
{x1, y0, highlight_depth * dm},
|
||||||
{x1, y1, highlight_depth},
|
{x1, y1, highlight_depth * dm},
|
||||||
{x0, y1, highlight_depth},
|
{x0, y1, highlight_depth * dm},
|
||||||
color);
|
color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void button::draw_background(ta_parameter_writer& writer) const
|
void button::draw_background(ta_parameter_writer& writer, float dm) const
|
||||||
{
|
{
|
||||||
float x0 = x() + 2;
|
float x0 = x() + 2;
|
||||||
float x1 = x() + width - 2;
|
float x1 = x() + width - 2;
|
||||||
float y0 = y() + 2;
|
float y0 = y() + 2;
|
||||||
float y1 = y() + height - 2;
|
float y1 = y() + height - 2;
|
||||||
quad_type_0(writer,
|
quad_type_0(writer,
|
||||||
{x0, y0, background_depth},
|
{x0, y0, background_depth * dm},
|
||||||
{x1, y0, background_depth},
|
{x1, y0, background_depth * dm},
|
||||||
{x1, y1, background_depth},
|
{x1, y1, background_depth * dm},
|
||||||
{x0, y1, background_depth},
|
{x0, y1, background_depth * dm},
|
||||||
background_color);
|
background_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void button::draw(ta_multiwriter& multi)
|
void button::draw(ta_multiwriter& multi, bool translucent)
|
||||||
{
|
{
|
||||||
|
ta_parameter_writer& writer = translucent ? multi.tl : multi.op;
|
||||||
|
|
||||||
|
if (translucent) {
|
||||||
global_polygon_untextured(multi.op,
|
global_polygon_untextured(multi.op,
|
||||||
para_control::list_type::opaque,
|
para_control::list_type::opaque,
|
||||||
tsp_instruction_word::dst_alpha_instr::zero);
|
tsp_instruction_word::dst_alpha_instr::zero);
|
||||||
|
} else {
|
||||||
|
global_polygon_translucent(multi.tl);
|
||||||
|
}
|
||||||
|
|
||||||
draw_shadow(multi.op);
|
float dm = translucent ? 10 : 1;
|
||||||
|
|
||||||
draw_lowlight(multi.op);
|
draw_shadow(writer, dm);
|
||||||
|
|
||||||
draw_highlight(multi.op);
|
draw_lowlight(writer, dm);
|
||||||
|
|
||||||
draw_background(multi.op);
|
draw_highlight(writer, dm);
|
||||||
|
|
||||||
widget::draw(multi);
|
draw_background(writer, dm);
|
||||||
|
|
||||||
|
widget::draw(multi, translucent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void button::click()
|
void button::click()
|
||||||
|
@ -18,11 +18,11 @@ namespace widget {
|
|||||||
: widget(_x, _y, _width, _height), on_click(_on_click)
|
: widget(_x, _y, _width, _height), on_click(_on_click)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
void draw_shadow(ta_parameter_writer& writer) const;
|
void draw_shadow(ta_parameter_writer& writer, float dm) const;
|
||||||
void draw_lowlight(ta_parameter_writer& writer) const;
|
void draw_lowlight(ta_parameter_writer& writer, float dm) const;
|
||||||
void draw_highlight(ta_parameter_writer& writer) const;
|
void draw_highlight(ta_parameter_writer& writer, float dm) const;
|
||||||
void draw_background(ta_parameter_writer& writer) const;
|
void draw_background(ta_parameter_writer& writer, float dm) const;
|
||||||
void draw(ta_multiwriter& multi) override;
|
void draw(ta_multiwriter& multi, bool translucent) override;
|
||||||
|
|
||||||
void click() override;
|
void click() override;
|
||||||
};
|
};
|
||||||
|
@ -10,7 +10,7 @@ namespace widget {
|
|||||||
const static float icon_shadow_depth = 1.0 / 5.5;
|
const static float icon_shadow_depth = 1.0 / 5.5;
|
||||||
const static int icon_shadow_color = 0x100000;
|
const static int icon_shadow_color = 0x100000;
|
||||||
|
|
||||||
void button_icon::draw_icon(ta_parameter_writer& writer) const
|
void button_icon::draw_icon(ta_parameter_writer& writer, float dm) const
|
||||||
{
|
{
|
||||||
float y_offset = (float)(click_state != click_type::release);
|
float y_offset = (float)(click_state != click_type::release);
|
||||||
|
|
||||||
@ -21,16 +21,18 @@ namespace widget {
|
|||||||
|
|
||||||
icons::global_polygon_icon(writer);
|
icons::global_polygon_icon(writer);
|
||||||
|
|
||||||
icons::draw(writer, icon_type, cx, cy, icon_depth, icon_color);
|
icons::draw(writer, icon_type, cx, cy, icon_depth * dm, icon_color);
|
||||||
|
|
||||||
if (click_state == click_type::release)
|
if (click_state == click_type::release)
|
||||||
icons::draw(writer, icon_type, cx + 1, cy + 1, icon_shadow_depth, icon_shadow_color);
|
icons::draw(writer, icon_type, cx + 1, cy + 1, icon_shadow_depth * dm, icon_shadow_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void button_icon::draw(ta_multiwriter& multi)
|
void button_icon::draw(ta_multiwriter& multi, bool translucent)
|
||||||
{
|
{
|
||||||
draw_icon(multi.pt);
|
float dm = translucent ? 10 : 1;
|
||||||
|
|
||||||
button::draw(multi);
|
draw_icon(multi.pt, dm);
|
||||||
|
|
||||||
|
button::draw(multi, translucent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ namespace widget {
|
|||||||
: button(_x, _y, _width, _height, _on_click), icon_type(icon_type)
|
: button(_x, _y, _width, _height, _on_click), icon_type(icon_type)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
void draw_icon(ta_parameter_writer& writer) const;
|
void draw_icon(ta_parameter_writer& writer, float dm) const;
|
||||||
void draw(ta_multiwriter& multi) override;
|
void draw(ta_multiwriter& multi, bool translucent) override;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -10,22 +10,24 @@ namespace widget {
|
|||||||
const static float label_shadow_depth = 1.0 / 6.0;
|
const static float label_shadow_depth = 1.0 / 6.0;
|
||||||
const static int label_shadow_color = 0x000000;
|
const static int label_shadow_color = 0x000000;
|
||||||
|
|
||||||
void button_label::draw_label(ta_parameter_writer& writer) const
|
void button_label::draw_label(ta_parameter_writer& writer, float dm) const
|
||||||
{
|
{
|
||||||
float y_offset = (float)(click_state != click_type::release);
|
float y_offset = (float)(click_state != click_type::release);
|
||||||
|
|
||||||
float cx = x() + width / 2 - (glyph::hori_advance * label_length) / 2;
|
float cx = x() + width / 2 - (glyph::hori_advance * label_length) / 2;
|
||||||
float cy = y() + height / 2 - glyph::vert_advance / 2 + y_offset;
|
float cy = y() + height / 2 - glyph::vert_advance / 2 + y_offset;
|
||||||
|
|
||||||
transfer_string(writer, label, cx, cy, label_depth, label_color);
|
transfer_string(writer, label, cx, cy, label_depth * dm, label_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void button_label::draw(ta_multiwriter& multi)
|
void button_label::draw(ta_multiwriter& multi, bool translucent)
|
||||||
{
|
{
|
||||||
transfer_global_polygon_glyph(multi.pt);
|
transfer_global_polygon_glyph(multi.pt);
|
||||||
|
|
||||||
draw_label(multi.pt);
|
float dm = translucent ? 10 : 1;
|
||||||
|
|
||||||
button::draw(multi);
|
draw_label(multi.pt, dm);
|
||||||
|
|
||||||
|
button::draw(multi, translucent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ namespace widget {
|
|||||||
: button(_x, _y, _width, _height, _on_click), label(label), label_length(str_length(label))
|
: button(_x, _y, _width, _height, _on_click), label(label), label_length(str_length(label))
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
void draw_label(ta_parameter_writer& writer) const;
|
void draw_label(ta_parameter_writer& writer, float dm) const;
|
||||||
void draw(ta_multiwriter& multi) override;
|
void draw(ta_multiwriter& multi, bool translucent) override;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -23,10 +23,10 @@ namespace widget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw(ta_multiwriter& multi)
|
void draw(ta_multiwriter& multi, bool translucent)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
children[i]->draw(multi);
|
children[i]->draw(multi, translucent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,22 +11,26 @@ namespace widget {
|
|||||||
const static float label_shadow_depth = 1.0 / 6.0;
|
const static float label_shadow_depth = 1.0 / 6.0;
|
||||||
const static int label_shadow_color = 0x000000;
|
const static int label_shadow_color = 0x000000;
|
||||||
|
|
||||||
void label::draw_label(ta_parameter_writer& writer) const
|
void label::draw_label(ta_parameter_writer& writer, float dm) const
|
||||||
{
|
{
|
||||||
float y_offset = 0;
|
float y_offset = 0;
|
||||||
|
|
||||||
float cx = x() + width / 2 - (glyph::hori_advance * value_length) / 2;
|
float cx = x() + width / 2 - (glyph::hori_advance * value_length) / 2;
|
||||||
float cy = y() + height / 2 - glyph::vert_advance / 2 + y_offset;
|
float cy = y() + height / 2 - glyph::vert_advance / 2 + y_offset;
|
||||||
|
|
||||||
transfer_string(writer, value, cx, cy, label_depth, label_color);
|
transfer_string(writer, value, cx, cy, label_depth * dm, label_color);
|
||||||
|
|
||||||
|
transfer_string(writer, value, cx + 1, cy + 1, label_shadow_depth * dm, label_shadow_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void label::draw(ta_multiwriter& multi)
|
void label::draw(ta_multiwriter& multi, bool translucent)
|
||||||
{
|
{
|
||||||
transfer_global_polygon_glyph(multi.pt);
|
transfer_global_polygon_glyph(multi.pt);
|
||||||
|
|
||||||
draw_label(multi.pt);
|
float dm = translucent ? 10 : 1;
|
||||||
|
|
||||||
widget::draw(multi);
|
draw_label(multi.pt, dm);
|
||||||
|
|
||||||
|
widget::draw(multi, translucent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ namespace widget {
|
|||||||
: widget(_x, _y, _width, _height), value(value), value_length(str_length(value))
|
: widget(_x, _y, _width, _height), value(value), value_length(str_length(value))
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
void draw_label(ta_parameter_writer& writer) const;
|
void draw_label(ta_parameter_writer& writer, float dm) const;
|
||||||
void draw(ta_multiwriter& multi) override;
|
void draw(ta_multiwriter& multi, bool translucent) override;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ namespace widget {
|
|||||||
: bounding_box(_x, _y, _width, _height), click_state(click_type::release)
|
: bounding_box(_x, _y, _width, _height), click_state(click_type::release)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
inline virtual void draw(ta_multiwriter& multi)
|
inline virtual void draw(ta_multiwriter& multi, bool translucent)
|
||||||
{
|
{
|
||||||
if (click_state == click_type::press)
|
if (click_state == click_type::press)
|
||||||
click_state = click_type::down;
|
click_state = click_type::down;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user