Skip to content

Commit

Permalink
Remove multiple inheritance and make SDLFrame inherit from GNUFrame.
Browse files Browse the repository at this point in the history
See sh95014#37

Signed-off-by: Andrea Odetti <[email protected]>
  • Loading branch information
audetto committed Jan 4, 2024
1 parent 5679f19 commit f05741b
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 20 deletions.
5 changes: 3 additions & 2 deletions source/frontends/common2/gnuframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ namespace
namespace common2
{

GNUFrame::GNUFrame()
: myHomeDir(GetHomeDir())
GNUFrame::GNUFrame(const EmulatorOptions & options)
: CommonFrame(options)
, myHomeDir(GetHomeDir())
, myResourceFolder(getResourceFolder("/resource/"))
{
// should this go down to LinuxFrame (maybe Initialisation?)
Expand Down
4 changes: 2 additions & 2 deletions source/frontends/common2/gnuframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
namespace common2
{

class GNUFrame : public virtual CommonFrame
class GNUFrame : public CommonFrame
{
public:
GNUFrame();
GNUFrame(const common2::EmulatorOptions & option);

std::string Video_GetScreenShotFolder() const override;
std::string getResourcePath(const std::string & filename) override;
Expand Down
3 changes: 1 addition & 2 deletions source/frontends/libretro/retroframe.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "StdAfx.h"
#include "frontends/common2/commonframe.h"
#include "frontends/libretro/retroframe.h"
#include "frontends/libretro/environment.h"

Expand Down Expand Up @@ -79,7 +78,7 @@ namespace ra2
{

RetroFrame::RetroFrame(const common2::EmulatorOptions & options)
: common2::CommonFrame(options)
: common2::GNUFrame(options)
{
}

Expand Down
3 changes: 1 addition & 2 deletions source/frontends/libretro/retroframe.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#pragma once

#include "frontends/common2/commonframe.h"
#include "frontends/common2/gnuframe.h"

#include <vector>

namespace ra2
{

class RetroFrame : public virtual common2::CommonFrame, public common2::GNUFrame
class RetroFrame : public common2::GNUFrame
{
public:
RetroFrame(const common2::EmulatorOptions & options);
Expand Down
2 changes: 1 addition & 1 deletion source/frontends/ncurses/nframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace na2
};

NFrame::NFrame(const common2::EmulatorOptions & options, const std::shared_ptr<EvDevPaddle> & paddle)
: common2::CommonFrame(options)
: common2::GNUFrame(options)
, myPaddle(paddle)
, myRows(-1)
, myColumns(-1)
Expand Down
3 changes: 1 addition & 2 deletions source/frontends/ncurses/nframe.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once

#include "frontends/common2/commonframe.h"
#include "frontends/common2/gnuframe.h"

#include <memory>
Expand All @@ -14,7 +13,7 @@ namespace na2
class EvDevPaddle;
struct NCurses;

class NFrame : public virtual common2::CommonFrame, public common2::GNUFrame
class NFrame : public common2::GNUFrame
{
public:
NFrame(const common2::EmulatorOptions & options, const std::shared_ptr<EvDevPaddle> & paddle);
Expand Down
1 change: 0 additions & 1 deletion source/frontends/sdl/imgui/sdlimguiframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ namespace sa2

SDLImGuiFrame::SDLImGuiFrame(const common2::EmulatorOptions & options)
: SDLFrame(options)
, CommonFrame(options)
, myPresenting(false)
{
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SA2_CONTEXT_FLAGS);
Expand Down
3 changes: 1 addition & 2 deletions source/frontends/sdl/imgui/sdlimguiframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
#include "frontends/sdl/sdlframe.h"
#include "frontends/sdl/imgui/sdlsettings.h"
#include "frontends/sdl/imgui/glselector.h"
#include "frontends/common2/gnuframe.h"

namespace sa2
{

class SDLImGuiFrame : public SDLFrame, public common2::GNUFrame
class SDLImGuiFrame : public SDLFrame
{
public:
SDLImGuiFrame(const common2::EmulatorOptions & options);
Expand Down
1 change: 0 additions & 1 deletion source/frontends/sdl/renderer/sdlrendererframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ namespace sa2

SDLRendererFrame::SDLRendererFrame(const common2::EmulatorOptions & options)
: SDLFrame(options)
, CommonFrame(options)
{
const common2::Geometry geometry = getGeometryOrDefault(options.geometry);

Expand Down
3 changes: 1 addition & 2 deletions source/frontends/sdl/renderer/sdlrendererframe.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#pragma once

#include "frontends/sdl/sdlframe.h"
#include "frontends/common2/gnuframe.h"
#include <memory>

namespace sa2
{

class SDLRendererFrame : public SDLFrame, public common2::GNUFrame
class SDLRendererFrame : public SDLFrame
{
public:
SDLRendererFrame(const common2::EmulatorOptions & options);
Expand Down
2 changes: 1 addition & 1 deletion source/frontends/sdl/sdlframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ namespace sa2
{

SDLFrame::SDLFrame(const common2::EmulatorOptions & options)
: CommonFrame(options)
: common2::GNUFrame(options)
, myTargetGLSwap(options.glSwapInterval)
, myPreserveAspectRatio(options.aspectRatio)
, myForceCapsLock(true)
Expand Down
4 changes: 2 additions & 2 deletions source/frontends/sdl/sdlframe.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "frontends/common2/commonframe.h"
#include "frontends/common2/gnuframe.h"
#include "frontends/common2/controllerquit.h"
#include "frontends/common2/programoptions.h"
#include "linux/network/portfwds.h"
Expand All @@ -9,7 +9,7 @@
namespace sa2
{

class SDLFrame : public virtual common2::CommonFrame
class SDLFrame : public common2::GNUFrame
{
public:
SDLFrame(const common2::EmulatorOptions & options);
Expand Down

0 comments on commit f05741b

Please sign in to comment.