Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
chiappa committed Jan 19, 2022
1 parent 1cad65b commit 5b06a46
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 35 deletions.
5 changes: 3 additions & 2 deletions Code/Engine/System/SystemInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,6 @@ bool CSystem::Init()
return false;
//LoadCrynetwork();
//====================================================
Log("Initialize Game");
if (m_pUserCallback)
m_pUserCallback->OnInitProgress("Initializing Game...");
if (!m_pGame->Init(this, m_env.IsDedicated(), m_startupParams.bEditor, "FunCry"))
Expand Down Expand Up @@ -584,7 +583,7 @@ bool CSystem::InitRender()
// In release mode it failed!!!
// TODO: Fix it
if (m_pUserCallback)
m_pUserCallback->OnInitProgress("Initializing Render...");
m_pUserCallback->OnInitProgress("Initializing Renderer...");

if (m_env.pRenderer)
{
Expand Down Expand Up @@ -982,6 +981,8 @@ bool CSystem::LoadCrynetwork()
IGame* CSystem::CreateGame(IGame* game)
{
string gameDLLName = "Game";
if (m_pUserCallback)
m_pUserCallback->OnInitProgress("Initializing Game...");
if (ICVar* pCVarGameDir = gEnv->pConsole->GetCVar("sys_dll_game"))
{
gameDLLName = pCVarGameDir->GetString();
Expand Down
5 changes: 5 additions & 0 deletions Code/Sandbox/Editor/GameEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,16 @@ bool CGameEngine::Init(bool bTestMode, bool bShaderCacheGen, const char* sInCmdL
}
#endif

auto wnd_proc_before = GetWindowLongPtr((HWND)startupParams.hWnd, GWLP_WNDPROC);
if (!InitializeEngine(startupParams, true))
{
return false;
}
auto wnd_proc_after = GetWindowLongPtr((HWND)startupParams.hWnd, GWLP_WNDPROC);
#if 0
assert(wnd_proc_before == wnd_proc_after && "Wnd procedures missmatch");

#endif
m_pGame = gEnv->pSystem->GetIGame();
return true;
}
Expand Down
9 changes: 9 additions & 0 deletions Code/Sandbox/Editor/Qt/EditorMainFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ CEditorMainFrame::CEditorMainFrame(QWidget *parent)
, ui(new Ui::CEditorMainFrame)
{
ui->setupUi(this);
setEnabled(true);
setFocusPolicy(Qt::StrongFocus);
setFocus();


QFrame * frame = nullptr;
Expand All @@ -28,6 +31,12 @@ CEditorMainFrame::CEditorMainFrame(QWidget *parent)
//ui->toolBar->setStyleSheet("QMenuBar::separator { background-color: #454545; }");
//ui->toolBar->setStyleSheet("QMenuBar { background-color: #454545; }");

//UpdateWindowTitle();

setWindowIcon(QIcon("icons:editor_icon.ico"));
qApp->setWindowIcon(windowIcon());


QTimer::singleShot(0, this, &CEditorMainFrame::OnIdleCallback);
}

Expand Down
12 changes: 12 additions & 0 deletions Code/Sandbox/Editor/Qt/EditorMainFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#define GAMEWINDOW_H

#include <QMainWindow>
#include <QKeyEvent>
#include <QEvent>

QT_BEGIN_NAMESPACE
namespace Ui { class CEditorMainFrame; }
Expand All @@ -20,6 +22,16 @@ class CEditorMainFrame : public QMainWindow

void OnIdleCallback();

void keyPressEvent(QKeyEvent* pEvent)
{
CryLog("Key [%s] pressed", pEvent->text().toLocal8Bit());
}

void mousePressEvent(QMouseEvent* pEvent)
{
CryLog("Mouse pressed");
}

private slots:
void on_action_Clear_Console_triggered();
void on_action_Toggle_Console_toggled(bool arg1);
Expand Down
78 changes: 45 additions & 33 deletions Include/public/BlackBox/System/IWindow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,20 @@ struct Rect
int top;
int width;
int height;
Rect(int l, int t, int w, int h) : left(l), top(t), width(w), height(h) {}
Rect() : left(0), top(0), width(0), height(0) {}
Rect(int l, int t, int w, int h)
: left(l)
, top(t)
, width(w)
, height(h)
{
}
Rect()
: left(0)
, top(0)
, width(0)
, height(0)
{
}
};

typedef void* Params;
Expand All @@ -26,42 +38,42 @@ struct IWindow
{
struct SInitParams
{
const char* title;
int x;
int y;
int width;
int height;
unsigned int cbpp;
int zbpp;
int sbits;
bool fullscreen;
const char* title;
int x;
int y;
int width;
int height;
unsigned int cbpp;
int zbpp;
int sbits;
bool fullscreen;
RenderBackend backend;
};
virtual void Release() = 0;
virtual bool create(Params params) = 0;
virtual bool init(SInitParams* pInitParams) = 0;
virtual void update() = 0;
virtual void clear() = 0;
virtual bool closed() = 0;
virtual void swap() = 0;
virtual void setTitle(const char*) = 0;
virtual void show() = 0;
virtual int getWidth() = 0;
virtual int getHeight() = 0;
virtual void* getHandle() = 0;
virtual void* getNativeHandle() = 0;
virtual void setFlags(int flags) = 0;
virtual Rect& getViewPort() = 0;
virtual void changeSize(int w, int h) = 0;
virtual GLContext getContext() = 0;
virtual DisplayMode GetDesktopMode() = 0;
virtual void EnterFullscreen(bool mode) = 0;
virtual void close() = 0;
virtual void Release() = 0;
virtual bool create(Params params) = 0;
virtual bool init(SInitParams* pInitParams) = 0;
virtual void update() = 0;
virtual void clear() = 0;
virtual bool closed() = 0;
virtual void swap() = 0;
virtual void setTitle(const char*) = 0;
virtual void show() = 0;
virtual int getWidth() = 0;
virtual int getHeight() = 0;
virtual void* getHandle() = 0;
virtual void* getNativeHandle() = 0;
virtual void setFlags(int flags) = 0;
virtual Rect& getViewPort() = 0;
virtual void changeSize(int w, int h) = 0;
virtual GLContext getContext() = 0;
virtual DisplayMode GetDesktopMode() = 0;
virtual void EnterFullscreen(bool mode) = 0;
virtual void close() = 0;
};

extern "C"
{
IWINDOW_API IWindow* CreateIWindow(NativeWindow* hWnd);
IWINDOW_API void* CurrentHandledWindow();
typedef IWindow* (*PFNCREATEWINDOW)(NativeWindow* hWnd);
IWINDOW_API void* CurrentHandledWindow();
typedef IWindow* (*PFNCREATEWINDOW)(NativeWindow* hWnd);
}

0 comments on commit 5b06a46

Please sign in to comment.