Skip to content

Commit

Permalink
Removed the unuse Xbox screen resizer menu element
Browse files Browse the repository at this point in the history
  • Loading branch information
mmatyas committed Dec 5, 2023
1 parent 50f2e4b commit 4fe755e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 146 deletions.
125 changes: 0 additions & 125 deletions src/smw/uicustomcontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,128 +52,3 @@ extern WorldMusicList *worldmusiclist;
extern CGameValues game_values;
extern CResourceManager* rm;
extern CGame* smw;


/**************************************
* MI_ScreenResize Class
**************************************/

#ifdef _XBOX
MI_ScreenResize::MI_ScreenResize() :
UI_Control(0, 0)
{
miText[0] = new MI_Text("Use left joystick to set", 320, 110, 0, 2, 1);
miText[1] = new MI_Text("upper left corner.", 320, 135, 0, 2, 1);
miText[2] = new MI_Text("Use right joystick to set", 320, 190, 0, 2, 1);
miText[3] = new MI_Text("lower right corner.", 320, 215, 0, 2, 1);
miText[4] = new MI_Text("Press random to snap", 320, 270, 0, 2, 1);
miText[5] = new MI_Text("to preset screen size.", 320, 295, 0, 2, 1);
miText[6] = new MI_Text("Press key to exit.", 320, 350, 0, 2, 1);

fAutoModify = true;
dPreset = 0.0f;
}

MI_ScreenResize::~MI_ScreenResize()
{
for (int iText = 0; iText < 7; iText++)
delete miText[iText];
}

MenuCodeEnum MI_ScreenResize::Modify(bool modify)
{
fModifying = modify;
return MENU_CODE_MODIFY_ACCEPTED;
}

MenuCodeEnum MI_ScreenResize::SendInput(CPlayerInput * playerInput)
{
SDL_Event event;
bool done = false;

short iLastJoy1X = 0, iLastJoy1Y = 0, iLastJoy2X = 0, iLastJoy2Y = 0;

bool resized = false;
while (!done) {
game_values.playerInput.ClearPressedKeys(1);

while (SDL_PollEvent(&event)) {
game_values.playerInput.Update(event, 1);

for (int iPlayer = 0; iPlayer < 4; iPlayer++) {
if (playerInput->outputControls[iPlayer].menu_cancel.fPressed ||
playerInput->outputControls[iPlayer].menu_select.fPressed) {
done = true;
break;
} else if (playerInput->outputControls[iPlayer].menu_random.fPressed) {
if (dPreset * 4.0f == game_values.screenResizeX && dPreset * 3.0f == game_values.screenResizeY &&
dPreset * -8.0f == game_values.screenResizeW && dPreset * -6.0f == game_values.screenResizeH) {
dPreset += 1.0f;
if (dPreset > 21.0f)
dPreset = 0.0f;
}

game_values.screenResizeX = dPreset * 4.0f;
game_values.screenResizeY = dPreset * 3.0f;
game_values.screenResizeW = dPreset * -8.0f;
game_values.screenResizeH = dPreset * -6.0f;
resized = true;

break;
}
}

if (event.type == SDL_JOYAXISMOTION) {
if (event.jaxis.axis == 0)
iLastJoy1X = event.jaxis.value;
else if (event.jaxis.axis == 1)
iLastJoy1Y = event.jaxis.value;
else if (event.jaxis.axis == 2)
iLastJoy2X = event.jaxis.value;
else if (event.jaxis.axis == 3)
iLastJoy2Y = event.jaxis.value;
}
}

if (iLastJoy1X > JOYSTICK_DEAD_ZONE || iLastJoy1X < -JOYSTICK_DEAD_ZONE) {
game_values.screenResizeX += (float)iLastJoy1X / 50000.0f;
resized = true;
}

if (iLastJoy1Y > JOYSTICK_DEAD_ZONE || iLastJoy1Y < -JOYSTICK_DEAD_ZONE) {
game_values.screenResizeY += (float)iLastJoy1Y / 50000.0f;
resized = true;
}

if (iLastJoy2X > JOYSTICK_DEAD_ZONE || iLastJoy2X < -JOYSTICK_DEAD_ZONE) {
game_values.screenResizeW += (float)iLastJoy2X / 50000.0f;
resized = true;
}

if (iLastJoy2Y > JOYSTICK_DEAD_ZONE || iLastJoy2Y < -JOYSTICK_DEAD_ZONE) {
game_values.screenResizeH += (float)iLastJoy2Y / 50000.0f;
resized = true;
}

if (resized) {
resized = false;
SDL_XBOX_SetScreenStretch(game_values.screenResizeW, game_values.screenResizeH);
SDL_XBOX_SetScreenPosition(game_values.screenResizeX, game_values.screenResizeY);
}
}

game_values.playerInput.ResetKeys();

fModifying = false;
return MENU_CODE_BACK_TO_SCREEN_SETTINGS_MENU;
}

void MI_ScreenResize::Draw()
{
if (!fShow)
return;

for (int iText = 0; iText < 7; iText++)
miText[iText]->Draw();
}
#endif //_XBOX
21 changes: 0 additions & 21 deletions src/smw/uicustomcontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,4 @@ class MapListNode;
class MI_ScoreText;
class MI_Text;


#ifdef _XBOX
class MI_ScreenResize : public UI_Control
{
public:

MI_ScreenResize();
virtual ~MI_ScreenResize();

void Draw();

MenuCodeEnum SendInput(CPlayerInput * playerInput);
MenuCodeEnum Modify(bool modify);

private:

MI_Text * miText[7];
float dPreset;
};
#endif //_XBOX

#endif // UICUSTOMCONTROL_H

0 comments on commit 4fe755e

Please sign in to comment.