Wildvine Engine
Referencia Doxygen del codigo propio de Wildvine Engine.
Cargando...
Buscando...
Nada coincide
Window.cpp
Ir a la documentación de este archivo.
1
6#include "Window.h"
7#include "Device.h"
8#include "BaseApp.h"
9
10HRESULT
11Window::init(HINSTANCE hInstance, int nCmdShow, WNDPROC wndproc, BaseApp* app) {
12 // Store instance of the class
13 m_hInst = hInstance;
14
15 // Register class
16 WNDCLASSEX wcex;
17 wcex.cbSize = sizeof(WNDCLASSEX);
18 wcex.style = CS_HREDRAW | CS_VREDRAW;
19 wcex.lpfnWndProc = wndproc;
20 wcex.cbClsExtra = 0;
21 wcex.cbWndExtra = 0;
22 wcex.hInstance = m_hInst;
23 wcex.hIcon = LoadIcon(m_hInst, (LPCTSTR)IDI_TUTORIAL1);
24 wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
25 wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
26 wcex.lpszMenuName = NULL;
27 wcex.lpszClassName = "TutorialWindowClass";
28 wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_TUTORIAL1);
29 if (!RegisterClassEx(&wcex))
30 return E_FAIL;
31
32 // Create window
33 RECT rc = { 0, 0, 1200, 950};
34 m_rect = rc;
35
36 AdjustWindowRect(&rc, WS_OVERLAPPEDWINDOW, FALSE);
37
38 m_hWnd = CreateWindow("TutorialWindowClass",
39 m_windowName.c_str(),
40 WS_OVERLAPPEDWINDOW,
41 CW_USEDEFAULT,
42 CW_USEDEFAULT,
43 rc.right - rc.left,
44 rc.bottom - rc.top,
45 NULL,
46 NULL,
47 hInstance,
48 app);
49
50 if (!m_hWnd) {
51 MessageBox(nullptr, "CreateWindow failed!", "Error", MB_OK);
52 ERROR("Window", "init", "CHECK FOR CreateWindow()");
53 return E_FAIL;
54 }
55
56 ShowWindow(m_hWnd, nCmdShow);
57
58 UpdateWindow(m_hWnd);
59
60 // Setup Viewport Dimensions
61 GetClientRect(m_hWnd, &m_rect);
62 m_width = m_rect.right - m_rect.left;
63 m_height = m_rect.bottom - m_rect.top;
64
65 return S_OK;
66}
67
68void
71
72void
75
76void
79
80
81
Declara la API de BaseApp dentro del subsistema Core.
Declara la API de Device dentro del subsistema Core.
#define ERROR(classObj, method, errorMSG)
#define IDI_TUTORIAL1
Definition Resource.h:18
Declara la API de Window dentro del subsistema Core.
Coordina el ciclo de vida principal de Wildvine Engine.
Definition BaseApp.h:48
void render()
Definition Window.cpp:73
HRESULT init(HINSTANCE hInstance, int nCmdShow, WNDPROC wndproc, BaseApp *app)
Crea y muestra la ventana principal del motor.
Definition Window.cpp:11
unsigned int m_width
Ancho actual del area cliente.
Definition Window.h:47
HINSTANCE m_hInst
Definition Window.h:50
unsigned int m_height
Alto actual del area cliente.
Definition Window.h:48
void update()
Definition Window.cpp:69
RECT m_rect
Definition Window.h:51
void destroy()
Definition Window.cpp:77
HWND m_hWnd
Handle de la ventana nativa.
Definition Window.h:46
std::string m_windowName
Definition Window.h:52