mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-08 23:10:52 -04:00
Add option for adjusting scale of scrollbar in inventory
This commit is contained in:
parent
19038d55a4
commit
315f8debee
@ -200,13 +200,15 @@ static void VP_DirtyUniform(int uniform) {
|
||||
static void VP_ReloadUniforms(void) {
|
||||
VertexProgram* VP = VP_Active;
|
||||
if (!VP) return;
|
||||
int ret;
|
||||
|
||||
if (VP->dirtyUniforms & VP_UNI_MATRIX) {
|
||||
void *uniform_buffer;
|
||||
void *uniform_buffer = NULL;
|
||||
|
||||
sceGxmReserveVertexDefaultUniformBuffer(gxm_context, &uniform_buffer);
|
||||
sceGxmSetUniformDataF(uniform_buffer, VP->param_uni_mvp,
|
||||
0, 4 * 4, transposed_mvp);
|
||||
ret = sceGxmReserveVertexDefaultUniformBuffer(gxm_context, &uniform_buffer);
|
||||
if (ret) Logger_Abort2(ret, "Reserving uniform buffer");
|
||||
ret = sceGxmSetUniformDataF(uniform_buffer, VP->param_uni_mvp, 0, 4 * 4, transposed_mvp);
|
||||
if (ret) Logger_Abort2(ret, "Updating uniform buffer");
|
||||
|
||||
VP->dirtyUniforms &= ~VP_UNI_MATRIX;
|
||||
}
|
||||
@ -307,7 +309,7 @@ static void DQCallback(const void *callback_data) {
|
||||
|
||||
if (gfx_vsync) sceDisplayWaitVblankStart();
|
||||
|
||||
GPUBuffers_DeleteUnreferenced();
|
||||
GPUBuffers_DeleteUnreferenced();
|
||||
GPUTextures_DeleteUnreferenced();
|
||||
frameCounter++;
|
||||
}
|
||||
@ -343,7 +345,7 @@ static void AllocRingBuffers(void) {
|
||||
static void AllocGXMContext(void) {
|
||||
SceGxmContextParams params = { 0 };
|
||||
|
||||
params.hostMem = Mem_TryAlloc(1, SCE_GXM_MINIMUM_CONTEXT_HOST_MEM_SIZE);
|
||||
params.hostMem = Mem_Alloc(1, SCE_GXM_MINIMUM_CONTEXT_HOST_MEM_SIZE, "Host memory");
|
||||
params.hostMemSize = SCE_GXM_MINIMUM_CONTEXT_HOST_MEM_SIZE;
|
||||
|
||||
params.vdmRingBufferMem = vdm_ring_buffer_addr;
|
||||
|
@ -77,6 +77,7 @@ Copyright 2014-2023 ClassiCube | Licensed under BSD-3
|
||||
#define OPT_RAW_INPUT "win-raw-input"
|
||||
#define OPT_DPI_SCALING "win-dpi-scaling"
|
||||
#define OPT_GAME_VERSION "game-version"
|
||||
#define OPT_INV_SCROLLBAR_SCALE "inv-scrollbar-scale"
|
||||
|
||||
#define OPT_SELECTED_BLOCK_OUTLINE_COLOR "selected-block-outline-color"
|
||||
#define OPT_SELECTED_BLOCK_OUTLINE_OPACITY "selected-block-outline-opacity"
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "World.h"
|
||||
#include "Input.h"
|
||||
#include "Utils.h"
|
||||
#include "Options.h"
|
||||
|
||||
#define CHAT_MAX_STATUS Array_Elems(Chat_Status)
|
||||
#define CHAT_MAX_BOTTOMRIGHT Array_Elems(Chat_BottomRight)
|
||||
@ -1593,7 +1594,7 @@ static void InventoryScreen_Init(void* screen) {
|
||||
s->maxVertices = TEXTWIDGET_MAX + TABLE_MAX_VERTICES;
|
||||
|
||||
TextWidget_Init(&s->title);
|
||||
TableWidget_Create(&s->table);
|
||||
TableWidget_Create(&s->table, 22 * Options_GetFloat(OPT_INV_SCROLLBAR_SCALE, 0, 10, 1));
|
||||
s->table.blocksPerRow = Inventory.BlocksPerRow;
|
||||
s->table.UpdateTitle = InventoryScreen_OnUpdateTitle;
|
||||
TableWidget_RecreateBlocks(&s->table);
|
||||
|
@ -360,10 +360,10 @@ static const struct WidgetVTABLE ScrollbarWidget_VTABLE = {
|
||||
Widget_InputDown, Widget_InputUp, ScrollbarWidget_MouseScroll,
|
||||
ScrollbarWidget_PointerDown, ScrollbarWidget_PointerUp, ScrollbarWidget_PointerMove
|
||||
};
|
||||
void ScrollbarWidget_Create(struct ScrollbarWidget* w) {
|
||||
void ScrollbarWidget_Create(struct ScrollbarWidget* w, int width) {
|
||||
Widget_Reset(w);
|
||||
w->VTABLE = &ScrollbarWidget_VTABLE;
|
||||
w->width = Display_ScaleX(22);
|
||||
w->width = Display_ScaleX(width);
|
||||
w->borderX = Display_ScaleX(2);
|
||||
w->borderY = Display_ScaleY(2);
|
||||
w->nubsWidth = Display_ScaleX(3);
|
||||
@ -972,12 +972,12 @@ static const struct WidgetVTABLE TableWidget_VTABLE = {
|
||||
TableWidget_PointerDown, TableWidget_PointerUp, TableWidget_PointerMove,
|
||||
TableWidget_BuildMesh, TableWidget_Render2
|
||||
};
|
||||
void TableWidget_Create(struct TableWidget* w) {
|
||||
void TableWidget_Create(struct TableWidget* w, int sbWidth) {
|
||||
cc_bool classic;
|
||||
Widget_Reset(w);
|
||||
w->VTABLE = &TableWidget_VTABLE;
|
||||
w->lastCreatedIndex = -1000;
|
||||
ScrollbarWidget_Create(&w->scroll);
|
||||
ScrollbarWidget_Create(&w->scroll, sbWidth);
|
||||
|
||||
w->horAnchor = ANCHOR_CENTRE;
|
||||
w->verAnchor = ANCHOR_CENTRE;
|
||||
|
@ -62,7 +62,7 @@ struct ScrollbarWidget {
|
||||
int nubsWidth, offsets[3];
|
||||
};
|
||||
/* Resets state of the given scrollbar widget to default. */
|
||||
CC_NOINLINE void ScrollbarWidget_Create(struct ScrollbarWidget* w);
|
||||
CC_NOINLINE void ScrollbarWidget_Create(struct ScrollbarWidget* w, int width);
|
||||
|
||||
#define HOTBAR_CORE_VERTICES (INVENTORY_BLOCKS_PER_HOTBAR * ISOMETRICDRAWER_MAXVERTICES)
|
||||
/* A row of blocks with a background. */
|
||||
@ -111,7 +111,7 @@ struct TableWidget {
|
||||
int verticesCount;
|
||||
};
|
||||
|
||||
CC_NOINLINE void TableWidget_Create(struct TableWidget* w);
|
||||
CC_NOINLINE void TableWidget_Create(struct TableWidget* w, int sbWidth);
|
||||
/* Sets the selected block in the table to the given block. */
|
||||
/* Also adjusts scrollbar and moves cursor to be over the given block. */
|
||||
CC_NOINLINE void TableWidget_SetBlockTo(struct TableWidget* w, BlockID block);
|
||||
|
Loading…
x
Reference in New Issue
Block a user