Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge master into renderer ng #589

Open
wants to merge 33 commits into
base: renderer-ng
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
70d142b
apply c++ warning to only c++ compilation units, fixing warning on in…
devnexen Apr 30, 2022
fd6d928
Fixed #525 + prevent error (warning as error) when trying to build wi…
Aidoneus May 2, 2022
402c040
Fixed #455
Aidoneus May 2, 2022
9af346c
Dynamic aspect
caiiiycuk May 4, 2022
cb61426
dastPutSandOnMapAlt: checking lt in the main cycle
lpenguin May 9, 2022
6946544
Show commit information in error message
DileSoft May 9, 2022
a5ce644
git command
DileSoft May 9, 2022
c9b749a
git command
DileSoft May 9, 2022
ff9cfc7
git command
DileSoft May 9, 2022
c83be0c
Merge pull request #576 from lpenguin/fix-575
stalkerg May 10, 2022
c83543c
Merge pull request #565 from devnexen/dictionary_to_cpp
stalkerg May 10, 2022
90e7e7e
Merge pull request #566 from Aidoneus/fix525
stalkerg May 10, 2022
f466a9c
Merge pull request #567 from Aidoneus/fix455
stalkerg May 10, 2022
4ae8062
indent change
DileSoft May 11, 2022
29907d8
Merge pull request #578 from DileSoft/git_message
stalkerg May 11, 2022
9d4de50
Better error message for I/O operations
caiiiycuk May 12, 2022
0f8ca06
Fix SEGFAULT (on android) in error handler
caiiiycuk May 12, 2022
f81c03c
Support android in CMakeLists.txt
caiiiycuk May 12, 2022
867553e
Move lang.cpp/lang.h to xtool to avoid linking problems
caiiiycuk May 12, 2022
091a457
* Change main name for android
caiiiycuk May 12, 2022
f8320b3
Merge pull request #579 from caiiiycuk/va_ioerror
stalkerg May 12, 2022
b36b573
Merge pull request #581 from caiiiycuk/va_xerrhead_segfault
stalkerg May 12, 2022
7412ed8
Merge pull request #582 from caiiiycuk/va_movelang
stalkerg May 12, 2022
b91edbf
add -fsigned-char compile option
caiiiycuk May 13, 2022
5c9f0b9
couple of surface/script mem leak fixes proposal.
devnexen May 14, 2022
063a9eb
Merge pull request #564 from caiiiycuk/patch-2
stalkerg May 19, 2022
beff3da
Merge pull request #583 from caiiiycuk/va_cmakeandroid
stalkerg May 19, 2022
6504b52
Merge pull request #584 from caiiiycuk/va_androidhd_main
stalkerg May 19, 2022
44c2517
Merge pull request #585 from caiiiycuk/va_fsigned_char
stalkerg May 19, 2022
95a0a65
Merge pull request #586 from devnexen/script_load_mem_leak_fix
stalkerg May 19, 2022
0064bca
aciScreenText mem leak fix
devnexen May 27, 2022
c44ecd9
Merge pull request #588 from devnexen/actin_memleak
stalkerg May 29, 2022
591cc42
Merge remote-tracking branch 'upstream/master' into renderer-ng
lpenguin Jun 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 32 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ add_definitions(-D_USE_MATH_DEFINES)
add_compile_options(-Werror=shift-negative-value)
add_compile_options(-Werror=dangling-else)
add_compile_options(-Werror=parentheses)
add_compile_options(-Werror=delete-non-virtual-dtor)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Werror=delete-non-virtual-dtor>)
add_compile_options(-Werror=write-strings)
add_compile_options(-fsigned-char)

if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(-Werror=mismatched-new-delete )
Expand All @@ -89,13 +90,40 @@ IF(WIN32)
)
ENDIF(WIN32)

# Get the current working branch
IF(NOT($ENV{GITHUB_REF_NAME}))
execute_process(
COMMAND git rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_BRANCH
COMMAND_ECHO STDOUT
ECHO_OUTPUT_VARIABLE
ECHO_ERROR_VARIABLE
OUTPUT_STRIP_TRAILING_WHITESPACE)
ENDIF()

# Get the latest commit hash
IF(NOT($ENV{GITHUB_SHA}))
execute_process(
COMMAND git rev-parse HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
COMMAND_ECHO STDOUT
ECHO_OUTPUT_VARIABLE
ECHO_ERROR_VARIABLE
OUTPUT_STRIP_TRAILING_WHITESPACE)
ENDIF()

# subdirs
ADD_SUBDIRECTORY("src")
ADD_SUBDIRECTORY("lib/glad")
ADD_SUBDIRECTORY("lib/renderer")
ADD_SUBDIRECTORY("lib/xgraph")
ADD_SUBDIRECTORY("lib/xsound")
ADD_SUBDIRECTORY("lib/xtool")
ADD_SUBDIRECTORY("lib/utils")
ADD_SUBDIRECTORY("server")
ADD_SUBDIRECTORY("surmap")

if(NOT ANDROID)
ADD_SUBDIRECTORY("lib/utils")
ADD_SUBDIRECTORY("server")
ADD_SUBDIRECTORY("surmap")
endif()
2 changes: 1 addition & 1 deletion data/data/Incubator.dil
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
3 5 "Wormaster part note" "5" "0" "0" "data LUCK > 50 data INV_NYMBOS > 3 data HUSKER == 0" " " " "
4 5 "Last Moggy part note" "5" "0" "0" "data LUCK > 50 data INV_WEEZYK > 0 data PUT_PUT == 0" " " " "
7 7 "Eleerection Reject" "2" "0" "1" "data THIEF_PALOCHKA > 0" " " " "
8 7 "Eleerection Participation Question" "2" "0" "1" "visitE I > 1 visitE P > 1 data CYCLE == $PREV_CYCLE_1 cycle_exist 1 > 0 data THIEF_PALOCHKA == 0" " " " "
8 7 "Eleerection Participation Question" "2" "0" "1" "visitE I > 1 visitE P > 1 data CYCLE == $PREV_CYCLE_1 cycle_exist 1 > 0 cycle_exist 0 > 0 data THIEF_PALOCHKA == 0" " " " "
8 6 "empty" "0" "0" "0" "true" " " " "
8 4 "Ark-a-Znoy visit" "5" "0" "0" "visitW A > 0" " " " "
9 4 "Khox visit" "5" "0" "0" "visitW K > 0" " " " "
Expand Down
2 changes: 1 addition & 1 deletion data/data/Lampasso.dil
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
10 0 "Mechanic Messiah in Inventory" "3" "0" "1" "data INV_MESSIAH > 0" "abort" "block"
0 8 "Sports Introduction" "1" "1" "0" "data TABUTASKS > 0" " " "continue"
11 8 "empty" "0" "0" "0" "true" " " " "
12 8 "Kernowar Waiting?" "2" "0" "1" "BSTATUS == 1 data CYCLE == $PREV_CYCLE_2 cycle_exist 2 > 0" " " " "
12 8 "Kernowar Waiting?" "2" "0" "1" "BSTATUS == 1 data CYCLE == $PREV_CYCLE_2 cycle_exist 2 > 0 cycle_exist 1 > 0" " " " "
0 7 "empty" "0" "0" "0" "true" " " " "
0 6 "Protractor in Inventory" "5" "0" "0" "data INV_PROTRACTOR > 0" " " " "
12 5 "hMok visit" "5" "0" "0" "visitW h > 0" " " " "
Expand Down
2 changes: 1 addition & 1 deletion data/data/Ogorod.dil
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
4 10 "MP4 Comment" "2" "1" "1" "MP_GAME == 4" " " " "
4 9 "MP4 Start" "1" "0" "0" "MP_GAME == 4" " " "clear"
7 4 "Larva in Inventory" "2" "0" "1" "data INV_BAD_LARVA > 0 OR data INV_GOOD_LARVA > 0" " " " "
0 7 "Pipiska Waiting?" "2" "0" "1" "BSTATUS == 1 data CYCLE == $PREV_CYCLE_1 cycle_exist 1 > 0" " " " "
0 7 "Pipiska Waiting?" "2" "0" "1" "BSTATUS == 1 data CYCLE == $PREV_CYCLE_1 cycle_exist 1 > 0 cycle_exist 0 > 0" " " " "
11 0 "Mechanic Messiah in Inventory" "3" "0" "1" "data INV_MESSIAH > 0" "abort" "block"
6 5 "Weexow visit" "5" "0" "0" "visitW W > 0 BSTATUS == 2" " " " "
7 5 "Boozeena visit" "5" "0" "0" "visitW B > 0" " " " "
Expand Down
4 changes: 2 additions & 2 deletions data/data/VigBoo.dil
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
0 7 "empty" "0" "0" "0" "true" " " " "
0 6 "Zyklope warning" "5" "0" "0" "( BSTATUS == 2 data LUCK > 75 ) OR ( BSTATUS == 2 AND data LUCK > 40 AND visitW N > 0 )" " " " "
0 5 "Protractor in Inventory" "5" "0" "0" "data INV_PROTRACTOR > 0" " " " "
1 8 "Pipiska Waiting?" "2" "0" "1" "BSTATUS == 1 data CYCLE == $PREV_CYCLE_1 cycle_exist 1 > 0" " " " "
0 8 "Kernowar Waiting?" "2" "0" "1" "BSTATUS == 1 data CYCLE == $PREV_CYCLE_2 cycle_exist 2 > 0" " " " "
1 8 "Pipiska Waiting?" "2" "0" "1" "BSTATUS == 1 data CYCLE == $PREV_CYCLE_1 cycle_exist 1 > 0 cycle_exist 0 > 0" " " " "
0 8 "Kernowar Waiting?" "2" "0" "1" "BSTATUS == 1 data CYCLE == $PREV_CYCLE_2 cycle_exist 2 > 0 cycle_exist 1 > 0" " " " "
6 4 "Good Larva Delivery" "2" "0" "1" "data INV_GOOD_LARVA > 0" " " " "
7 4 "Good Cirt Delivery" "2" "0" "1" "data INV_GOOD_CIRT > 0" " " " "
8 4 "NO-Cirt Delivery" "2" "0" "1" "data INV_GOOD_CIRT == 0 data INV_BAD_CIRT == 0" " " " "
Expand Down
2 changes: 1 addition & 1 deletion data/data/ZeePa.dil
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
4 1 "NO-Cirt Delivery" "2" "0" "1" "data INV_GOOD_CIRT == 0 data INV_BAD_CIRT == 0" " " " "
5 1 "Toxick Delivery" "2" "0" "1" "data INV_TOXICK > 0" " " " "
0 2 "empty" "0" "0" "0" "true" " " " "
6 6 "Zyklope Waiting" "2" "0" "1" "data CYCLE == $PREV_CYCLE_1 cycle_exist 1 > 0" " " " "
6 6 "Zyklope Waiting" "2" "0" "1" "data CYCLE == $PREV_CYCLE_1 cycle_exist 1 > 0 cycle_exist 0 > 0" " " " "
7 6 "WeeZyk Assignment" "2" "0" "1" "data CYCLE == 1 QCODE > 0 data WEEZYK_ASSIGNMENT == 2" " " " "
8 6 "WeeZyk Recession" "2" "0" "1" "data CYCLE == 1 QCODE > 0 data WEEZYK_ASSIGNMENT == 1" " " " "
6 0 "Mechanic Messiah in Inventory" "3" "0" "1" "data INV_MESSIAH > 0" "abort" "block"
Expand Down
Binary file modified data/diagen.text
Binary file not shown.
Binary file modified data/diagen_eng.text
Binary file not shown.
12 changes: 6 additions & 6 deletions lib/xgraph/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ SET(xgraph_SRCS
xside.cpp
)

ADD_LIBRARY(xgraph STATIC ${xgraph_SRCS})

TARGET_LINK_LIBRARIES(xgraph
${SDL2_LIBRARY}
renderer
)
if (ANDROID)
ADD_LIBRARY(xgraph OBJECT ${xgraph_SRCS})
else()
ADD_LIBRARY(xgraph STATIC ${xgraph_SRCS})
TARGET_LINK_LIBRARIES(xgraph ${SDL2_LIBRARY} renderer)
endif()
78 changes: 47 additions & 31 deletions lib/xgraph/xgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ XGR_Screen::XGR_Screen(void)
texture = renderer::compositor::Texture::Invalid;
}

int XGR_Screen::init(int x,int y,int flags_in)
int XGR_Screen::init(int flags_in)
{
flags = flags_in;
std::cout<<"XGR_Screen::init"<<std::endl;
Expand All @@ -162,19 +162,36 @@ int XGR_Screen::init(int x,int y,int flags_in)
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);

SDL_DisplayMode displayMode;
SDL_GetCurrentDisplayMode(0, &displayMode);
int maxWidth = displayMode.w;
int maxHeight = displayMode.h;

float aspect = (float) maxWidth / (float) maxHeight;
if (aspect < 4/3.f) {
aspect = 4/3.f;
}

if (aspect > 13/6.f /* iPhone */) {
aspect = 13/6.f;
}

this->hdWidth = 1280;
this->hdHeight = 1280 / aspect;

std::cout<<"SDL_CreateWindowAndRenderer"<<std::endl;
if (XGR_FULL_SCREEN) {
if ((sdlWindow = SDL_CreateWindow("Vangers", 0, 0, 0, 0, SDL_WINDOW_OPENGL | SDL_WINDOW_FULLSCREEN_DESKTOP)) == nullptr) {
std::cout<<"ERROR1"<<std::endl;
ErrH.Abort(SDL_GetError(),XERR_USER, 0);
}
} else {
if ((sdlWindow = SDL_CreateWindow("Vangers", 0, 0, x, y, SDL_WINDOW_OPENGL)) == nullptr) {
if ((sdlWindow = SDL_CreateWindow("Vangers", 0, 0, this->hdWidth, this->hdHeight, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_MAXIMIZED)) == nullptr) {
std::cout<<"ERROR2"<<std::endl;
ErrH.Abort(SDL_GetError(),XERR_USER, 0);
}
}
std::cout<<"SDL_SetWindowTitle"<<std::endl;
std::cout << "SDL_Window created: " << this->hdWidth << "x" << this->hdHeight << std::endl;
SDL_SetWindowTitle(sdlWindow, "Vangers");

std::cout<<"SDL_GL_CreateContext"<<std::endl;
Expand All @@ -193,7 +210,7 @@ int XGR_Screen::init(int x,int y,int flags_in)
std::cout<<"Can't load icon vangers.bmp"<<std::endl;
}

renderer = new renderer::compositor::gles3::GLES3Compositor(x, y, (GLADloadproc)SDL_GL_GetProcAddress);
renderer = new renderer::compositor::gles3::GLES3Compositor(this->hdWidth, this->hdHeight, (GLADloadproc)SDL_GL_GetProcAddress);
renderer->initialize();
// TODO:
std::cout<<"SDL_SetRenderDrawColor"<<std::endl;
Expand All @@ -203,7 +220,7 @@ int XGR_Screen::init(int x,int y,int flags_in)
// TODO: renderer filtering
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "best"); // "linear" make the scaled rendering look smoother.

create_surfaces(x, y);
create_surfaces(this->hdWidth, this->hdHeight);

std::cout<<"SDL_ShowCursor"<<std::endl;
//SDL_SetRelativeMouseMode(SDL_TRUE);
Expand Down Expand Up @@ -239,9 +256,9 @@ int XGR_Screen::init(int x,int y,int flags_in)
}

void XGR_Screen::create_surfaces(int width, int height) {
XGR_ScreenSurface = new uint8_t[width * height] {0};
XGR_ScreenSurface2D = new uint8_t[width * height] {0};
XGR_ScreenSurface2DRgba = new uint32_t[width * height] {0};
XGR_ScreenSurface.reset(new uint8_t[width * height] {0});
XGR_ScreenSurface2D.reset(new uint8_t[width * height] {0});
XGR_ScreenSurface2DRgba.reset(new uint32_t[width * height] {0});

std::cout<<"XGR32_ScreenSurface = SDL_CreateRGBSurface"<<std::endl;
XGR32_ScreenSurface = SDL_CreateRGBSurfaceWithFormat(0, width, height, 32, SDL_PIXELFORMAT_RGBA32);
Expand Down Expand Up @@ -273,17 +290,7 @@ void XGR_Screen::create_surfaces(int width, int height) {
}

void XGR_Screen::set_resolution(int width, int height){
// TODO: do not change resolution, is new res is the same
std::cout << "XGR_Screen::set_resolution: " << width << ", " << height << std::endl;
if(width == ScreenX && height == ScreenY){
std::cout << "Resolution didn't change" << std::endl;
return;
}

destroy_surfaces();
SDL_SetWindowSize(sdlWindow, width, height);
renderer->set_physical_screen_size(width, height);
create_surfaces(width, height);

if (width == 800 && height == 600) {
// for comparison == 1
Expand All @@ -293,6 +300,16 @@ void XGR_Screen::set_resolution(int width, int height){
screen_scale_x = (float)width / 800;
screen_scale_y = (float)height / 600;
}

if(width == ScreenX && height == ScreenY){
std::cout << "Resolution didn't change" << std::endl;
return;
}

destroy_surfaces();
// SDL_SetWindowSize(sdlWindow, width, height);
renderer->set_physical_screen_size(width, height);
create_surfaces(width, height);
}

const float XGR_Screen::get_screen_scale_x() {
Expand All @@ -309,9 +326,6 @@ void XGR_Screen::destroy_surfaces() {

SDL_UnlockSurface(XGR32_ScreenSurface);

delete[] XGR_ScreenSurface;
delete[] XGR_ScreenSurface2D;
delete[] XGR_ScreenSurface2DRgba;
SDL_FreeSurface(XGR32_ScreenSurface);

texture = renderer::compositor::Texture::Invalid;
Expand Down Expand Up @@ -885,27 +899,27 @@ uint8_t* XGR_Screen::get_active_render_buffer() {
}

uint8_t* XGR_Screen::get_default_render_buffer() {
return XGR_ScreenSurface;
return XGR_ScreenSurface.get();
}

uint8_t* XGR_Screen::get_2d_render_buffer() {
return XGR_ScreenSurface2D;
return XGR_ScreenSurface2D.get();
}

uint32_t* XGR_Screen::get_2d_rgba_render_buffer() {
return XGR_ScreenSurface2DRgba;
return XGR_ScreenSurface2DRgba.get();
}

void XGR_Screen::set_active_render_buffer(uint8_t *buf) {
ScreenBuf = (unsigned char*)buf;
}

void XGR_Screen::set_default_render_buffer() {
set_active_render_buffer(XGR_ScreenSurface);
set_active_render_buffer(get_default_render_buffer());
}

void XGR_Screen::set_2d_render_buffer() {
set_active_render_buffer(XGR_ScreenSurface2D);
set_active_render_buffer(get_2d_render_buffer());
}

SDL_Surface* XGR_Screen::get_screenshot() {
Expand Down Expand Up @@ -939,9 +953,11 @@ void XGR_Screen::flip()
// TODO: pixels size should be renderer-specific
uint32_t *pixels = new uint32_t [xgrScreenSizeX * xgrScreenSizeY];
int pitch;
blitRgba(pixels, XGR_ScreenSurface, XGR_ScreenSurface2DRgba, XGR_ScreenSurface2D);
blitRgba((uint32_t*)pixels, get_default_render_buffer(), get_2d_rgba_render_buffer(), get_2d_render_buffer());
renderer->texture_set_data(texture, (uint8_t*)pixels);
delete[] pixels;


if (XGR_FULL_SCREEN) {
SDL_GetWindowSize(sdlWindow, &RealX, &RealY);
// TODO:
Expand Down Expand Up @@ -975,8 +991,7 @@ void XGR_Screen::flip()
.width = new_width,
.height = xgrScreenSizeY,
};

XGR_RenderSides(renderer);
XGR_RenderSides(renderer, this->hdWidth);
// TODO:
// SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, 0);
renderer->texture_render(texture, src_rect, dst_rect);
Expand Down Expand Up @@ -1046,8 +1061,9 @@ void XGR_Screen::flush(int x,int y,int sx,int sy)

void XGR_Screen::fill(int col, void* buffer)
{
if (buffer == XGR_ScreenSurface2DRgba) {
memset(XGR_ScreenSurface2DRgba, col, ScreenX * ScreenY * 4);
auto surface2dRgba = XGR_ScreenSurface2DRgba.get();
if (buffer == surface2dRgba) {
memset(surface2dRgba, col, ScreenX * ScreenY * 4);
} else {
memset(buffer == NULL ? ScreenBuf : buffer, col, ScreenX * ScreenY);
}
Expand Down
14 changes: 8 additions & 6 deletions lib/xgraph/xgraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ struct XGR_Screen
{
int flags;

int hdWidth;
int hdHeight;

int ScreenX;
int ScreenY;
int RealX;
Expand Down Expand Up @@ -147,7 +150,7 @@ struct XGR_Screen
void line(int x1,int y1,int x2,int y2,int col);
void lineto(int x,int y,int len,int dir,int col);

int init(int x,int y,int flags);
int init(int flags);
void close(void);
void finit(void);

Expand Down Expand Up @@ -197,9 +200,9 @@ struct XGR_Screen

uint8_t *ScreenBuf;

uint8_t *XGR_ScreenSurface;
uint8_t *XGR_ScreenSurface2D;
uint32_t *XGR_ScreenSurface2DRgba;
std::unique_ptr<uint8_t[]> XGR_ScreenSurface;
std::unique_ptr<uint8_t[]> XGR_ScreenSurface2D;
std::unique_ptr<uint32_t[]> XGR_ScreenSurface2DRgba;
SDL_Surface *XGR32_ScreenSurface;

SDL_Surface *IconSurface;
Expand Down Expand Up @@ -457,8 +460,7 @@ struct XGR_Mouse
XGR_Mouse(void);
};

#define XGR_Init(x,y,fl) XGR_Obj.init(x,y,fl)
#define XGR_ReInit(x,y,fl) XGR_Obj.init(x,y,fl | XGR_REINIT)
#define XGR_Init(fl) XGR_Obj.init(fl)
#define XGR_Finit() XGR_Obj.finit()
#define XGR_SetClip(left,top,right,bottom) XGR_Obj.set_clip(left,top,right,bottom)
#define XGR_GetClip(left,top,right,bottom) XGR_Obj.get_clip(left,top,right,bottom)
Expand Down
7 changes: 6 additions & 1 deletion lib/xgraph/xside.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//

#include "xbmp.h"
#include <algorithm>
#include <functional>
#include <utility>

Expand All @@ -21,6 +22,7 @@ renderer::compositor::Texture HDRightSideTexture = renderer::compositor::Texture
std::pair<const char *, const char *> activeSides = std::make_pair<>(nullptr, nullptr);
int currentRto = 0;
int currentIScreenId = 0;
constexpr int contentWidth = 160;

std::pair<const char *, const char *> getSideNames() {
int activeRtoId = getCurRtoId();
Expand Down Expand Up @@ -83,7 +85,7 @@ std::pair<const char *, const char *> getSideNames() {
}
}

void XGR_RenderSides(renderer::compositor::AbstractCompositor* renderer) {
void XGR_RenderSides(renderer::compositor::AbstractCompositor* renderer, int renderWidth) {
auto sideNames = getSideNames();

if (sideNames.first != activeSides.first) {
Expand All @@ -107,6 +109,9 @@ void XGR_RenderSides(renderer::compositor::AbstractCompositor* renderer) {
activeSides.second = sideNames.second;
}

// TODO:
// int outWidth = (xgrScreenSizeX - renderWidth) / 2;
// dst_rect.x = std::max<int>(0, outWidth - contentWidth);
int32_t width;
if (HDLeftSideTexture.is_valid()) {
renderer->texture_query(HDLeftSideTexture, &width, nullptr, nullptr, nullptr);
Expand Down
2 changes: 1 addition & 1 deletion lib/xgraph/xside.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

#include <SDL.h>
#include <renderer/compositor/AbstractCompositor.h>
void XGR_RenderSides(renderer::compositor::AbstractCompositor* renderer);
void XGR_RenderSides(renderer::compositor::AbstractCompositor* renderer, int renderWidth);

#endif // VANGERS_XSIDE_H
Loading