GL could draw an object but now adding DanBiasGame - problems with dll!
This commit is contained in:
parent
fd1ac35c45
commit
1a5d1217a3
|
@ -29,6 +29,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GamePhysics", "GamePhysics\
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tester", "Tester\Tester.vcxproj", "{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tester", "Tester\Tester.vcxproj", "{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DanBiasGame", "DanBiasGame\DanBiasGame.vcxproj", "{2A1BC987-AF42-4500-802D-89CD32FC1309}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Mixed Platforms = Debug|Mixed Platforms
|
Debug|Mixed Platforms = Debug|Mixed Platforms
|
||||||
|
@ -175,6 +177,7 @@ Global
|
||||||
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|Win32.ActiveCfg = Debug|Win32
|
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|Win32.Build.0 = Debug|Win32
|
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|x64.ActiveCfg = Debug|x64
|
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|x64.Build.0 = Debug|x64
|
||||||
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||||
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Release|Mixed Platforms.Build.0 = Release|Win32
|
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Release|Mixed Platforms.Build.0 = Release|Win32
|
||||||
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Release|Win32.ActiveCfg = Release|Win32
|
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
@ -190,6 +193,18 @@ Global
|
||||||
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|Win32.ActiveCfg = Release|Win32
|
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|Win32.Build.0 = Release|Win32
|
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|Win32.Build.0 = Release|Win32
|
||||||
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|x64.ActiveCfg = Release|Win32
|
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|x64.ActiveCfg = Release|Win32
|
||||||
|
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||||
|
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||||
|
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||||
|
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Release|Mixed Platforms.Build.0 = Release|Win32
|
||||||
|
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Release|x64.Build.0 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
|
@ -0,0 +1,311 @@
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
// File: TemplateMain.cpp
|
||||||
|
//
|
||||||
|
// BTH-D3D-Template
|
||||||
|
//
|
||||||
|
// Copyright (c) Stefan Petersson 2011. All rights reserved.
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
#define NOMINMAX
|
||||||
|
#include <Windows.h>
|
||||||
|
|
||||||
|
#include "DllInterfaces/GFXAPI.h"
|
||||||
|
#include "IGame.h"
|
||||||
|
|
||||||
|
#include "L_inputClass.h"
|
||||||
|
|
||||||
|
// debug window include
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <io.h>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
// Global Variables
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
HINSTANCE g_hInst = NULL;
|
||||||
|
HWND g_hWnd = NULL;
|
||||||
|
|
||||||
|
GameLogic::IGame* game;
|
||||||
|
InputClass* inputObj;
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
// Forward declarations
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
HRESULT InitWindow( HINSTANCE hInstance, int nCmdShow );
|
||||||
|
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||||
|
HRESULT Render(float deltaTime);
|
||||||
|
HRESULT Update(float deltaTime);
|
||||||
|
HRESULT InitGame();
|
||||||
|
HRESULT CleanUp();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
// Entry point to the program. Initializes everything and goes into a message processing
|
||||||
|
// loop. Idle time is used to render the scene.
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void SetStdOutToNewConsole()
|
||||||
|
{
|
||||||
|
// allocate a console for this app
|
||||||
|
AllocConsole();
|
||||||
|
|
||||||
|
// redirect unbuffered STDOUT to the console
|
||||||
|
HANDLE consoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
|
int fileDescriptor = _open_osfhandle((intptr_t)consoleHandle, _O_TEXT);
|
||||||
|
FILE *fp = _fdopen( fileDescriptor, "w" );
|
||||||
|
*stdout = *fp;
|
||||||
|
setvbuf( stdout, NULL, _IONBF, 0 );
|
||||||
|
|
||||||
|
// give the console window a nicer title
|
||||||
|
|
||||||
|
SetConsoleTitle(L"Debug Output");
|
||||||
|
|
||||||
|
// give the console window a bigger buffer size
|
||||||
|
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||||
|
if ( GetConsoleScreenBufferInfo(consoleHandle, &csbi) )
|
||||||
|
{
|
||||||
|
COORD bufferSize;
|
||||||
|
bufferSize.X = csbi.dwSize.X;
|
||||||
|
bufferSize.Y = 50;
|
||||||
|
SetConsoleScreenBufferSize(consoleHandle, bufferSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow )
|
||||||
|
{
|
||||||
|
SetDllDirectory(L"..\\DLL\\");
|
||||||
|
typedef struct tagLOADPARMS32 {
|
||||||
|
LPSTR lpEnvAddress; // address of environment strings
|
||||||
|
LPSTR lpCmdLine; // address of command line
|
||||||
|
LPSTR lpCmdShow; // how to show new program
|
||||||
|
DWORD dwReserved; // must be zero
|
||||||
|
} LOADPARMS32;
|
||||||
|
LOADPARMS32 p;
|
||||||
|
memset(&p, 0, sizeof(LOADPARMS32));
|
||||||
|
p.lpEnvAddress = "";
|
||||||
|
p.lpCmdLine = "";
|
||||||
|
p.lpCmdShow = "";
|
||||||
|
p.dwReserved = 0;
|
||||||
|
DWORD ret = LoadModule("OysterGraphics_x86D.dll", &p);
|
||||||
|
ret = LoadModule("GameLogic_x86D.dll", &p);
|
||||||
|
|
||||||
|
|
||||||
|
if( FAILED( InitWindow( hInstance, nCmdShow ) ) )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if( FAILED( InitGame() ) )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
__int64 cntsPerSec = 0;
|
||||||
|
QueryPerformanceFrequency((LARGE_INTEGER*)&cntsPerSec);
|
||||||
|
float secsPerCnt = 1.0f / (float)cntsPerSec;
|
||||||
|
|
||||||
|
__int64 prevTimeStamp = 0;
|
||||||
|
QueryPerformanceCounter((LARGE_INTEGER*)&prevTimeStamp);
|
||||||
|
|
||||||
|
//debug window
|
||||||
|
//SetStdOutToNewConsole();
|
||||||
|
// Main message loop
|
||||||
|
MSG msg = {0};
|
||||||
|
while(WM_QUIT != msg.message)
|
||||||
|
{
|
||||||
|
if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE) )
|
||||||
|
{
|
||||||
|
TranslateMessage( &msg );
|
||||||
|
DispatchMessage( &msg );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
__int64 currTimeStamp = 0;
|
||||||
|
QueryPerformanceCounter((LARGE_INTEGER*)&currTimeStamp);
|
||||||
|
float dt = (currTimeStamp - prevTimeStamp) * secsPerCnt;
|
||||||
|
|
||||||
|
//render
|
||||||
|
Update(dt);
|
||||||
|
Render(dt);
|
||||||
|
|
||||||
|
prevTimeStamp = currTimeStamp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CleanUp();
|
||||||
|
return (int) msg.wParam;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
// Register class and create window
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
HRESULT InitWindow( HINSTANCE hInstance, int nCmdShow )
|
||||||
|
{
|
||||||
|
// Register class
|
||||||
|
WNDCLASSEX wcex;
|
||||||
|
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||||
|
wcex.style = CS_HREDRAW | CS_VREDRAW;
|
||||||
|
wcex.lpfnWndProc = WndProc;
|
||||||
|
wcex.cbClsExtra = 0;
|
||||||
|
wcex.cbWndExtra = 0;
|
||||||
|
wcex.hInstance = hInstance;
|
||||||
|
wcex.hIcon = 0;
|
||||||
|
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||||
|
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
|
||||||
|
wcex.lpszMenuName = NULL;
|
||||||
|
wcex.lpszClassName = L"BTH_D3D_Template";
|
||||||
|
wcex.hIconSm = 0;
|
||||||
|
if( !RegisterClassEx(&wcex) )
|
||||||
|
return E_FAIL;
|
||||||
|
|
||||||
|
// Adjust and create window
|
||||||
|
g_hInst = hInstance;
|
||||||
|
RECT rc = { 0, 0, 1024, 768 };
|
||||||
|
AdjustWindowRect( &rc, WS_OVERLAPPEDWINDOW, FALSE );
|
||||||
|
|
||||||
|
if(!(g_hWnd = CreateWindow(
|
||||||
|
L"BTH_D3D_Template",
|
||||||
|
L"BTH - Direct3D 11.0 Template",
|
||||||
|
WS_OVERLAPPEDWINDOW,
|
||||||
|
CW_USEDEFAULT,
|
||||||
|
CW_USEDEFAULT,
|
||||||
|
rc.right - rc.left,
|
||||||
|
rc.bottom - rc.top,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
hInstance,
|
||||||
|
NULL)))
|
||||||
|
{
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ShowWindow( g_hWnd, nCmdShow );
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT InitGame()
|
||||||
|
{
|
||||||
|
inputObj = new InputClass;
|
||||||
|
if(!inputObj->Initialize(g_hInst, g_hWnd, 1024, 768))
|
||||||
|
{
|
||||||
|
MessageBox(0, L"Could not initialize the input object.", L"Error", MB_OK);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(Oyster::Graphics::API::Init(g_hWnd, false, false, Oyster::Math::Float2( 1024, 768)) != Oyster::Graphics::API::Sucsess)
|
||||||
|
return E_FAIL;
|
||||||
|
|
||||||
|
|
||||||
|
game = new GameLogic::IGame();
|
||||||
|
game->Init();
|
||||||
|
game->StartGame();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
HRESULT Update(float deltaTime)
|
||||||
|
{
|
||||||
|
inputObj->Update();
|
||||||
|
GameLogic::keyInput key = GameLogic::keyInput_none;
|
||||||
|
|
||||||
|
if(inputObj->IsKeyPressed(DIK_W))
|
||||||
|
{
|
||||||
|
key = GameLogic::keyInput_W;
|
||||||
|
}
|
||||||
|
else if(inputObj->IsKeyPressed(DIK_A))
|
||||||
|
{
|
||||||
|
key = GameLogic::keyInput_A;
|
||||||
|
}
|
||||||
|
else if(inputObj->IsKeyPressed(DIK_S))
|
||||||
|
{
|
||||||
|
key = GameLogic::keyInput_S;
|
||||||
|
}
|
||||||
|
else if(inputObj->IsKeyPressed(DIK_D))
|
||||||
|
{
|
||||||
|
key = GameLogic::keyInput_D;
|
||||||
|
}
|
||||||
|
|
||||||
|
game->Update(key);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT Render(float deltaTime)
|
||||||
|
{
|
||||||
|
int isPressed = 0;
|
||||||
|
if(inputObj->IsKeyPressed(DIK_A))
|
||||||
|
{
|
||||||
|
isPressed = 1;
|
||||||
|
//std::cout<<"test";
|
||||||
|
}
|
||||||
|
|
||||||
|
// test view and projection matrix
|
||||||
|
Oyster::Math::Float3 dir = Oyster::Math::Float3(0,0,-1);
|
||||||
|
Oyster::Math::Float3 up =Oyster::Math::Float3(0,1,0);
|
||||||
|
Oyster::Math::Float3 pos = Oyster::Math::Float3(0, 0, 100);
|
||||||
|
|
||||||
|
Oyster::Math::Float4x4 view =Oyster::Math3D::OrientationMatrix_LookAtDirection(dir, up, pos);
|
||||||
|
view = view.GetInverse();
|
||||||
|
|
||||||
|
Oyster::Math::Float4x4 proj = Oyster::Math3D::ProjectionMatrix_Perspective(3.14f/2, 1024/768, 1, 1000);
|
||||||
|
|
||||||
|
Oyster::Graphics::API::NewFrame(view, proj);
|
||||||
|
|
||||||
|
game->Render();
|
||||||
|
wchar_t title[255];
|
||||||
|
swprintf(title, sizeof(title), L"| Pressing A: %d | \n", (int)(isPressed));
|
||||||
|
SetWindowText(g_hWnd, title);
|
||||||
|
|
||||||
|
Oyster::Graphics::API::EndFrame();
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT CleanUp()
|
||||||
|
{
|
||||||
|
|
||||||
|
if(game)
|
||||||
|
{
|
||||||
|
delete game;
|
||||||
|
game = NULL;
|
||||||
|
}
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
// Called every time the application receives a message
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
LRESULT CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
|
||||||
|
{
|
||||||
|
PAINTSTRUCT ps;
|
||||||
|
HDC hdc;
|
||||||
|
|
||||||
|
switch (message)
|
||||||
|
{
|
||||||
|
case WM_PAINT:
|
||||||
|
hdc = BeginPaint(hWnd, &ps);
|
||||||
|
EndPaint(hWnd, &ps);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_DESTROY:
|
||||||
|
PostQuitMessage(0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_KEYDOWN:
|
||||||
|
|
||||||
|
switch(wParam)
|
||||||
|
{
|
||||||
|
case VK_ESCAPE:
|
||||||
|
PostQuitMessage(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -28,6 +28,8 @@ void CollisionManager::ColisionEvent(Oyster::Physics::ICustomBody &obj1, Oyster:
|
||||||
PlayerVBox(*((Player*)realObj1),*((DynamicObject*)realObj2));
|
PlayerVBox(*((Player*)realObj1),*((DynamicObject*)realObj2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Object::OBJECT_TYPE_BOX:
|
case Object::OBJECT_TYPE_BOX:
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,12 @@ Game::Game(void)
|
||||||
|
|
||||||
Game::~Game(void)
|
Game::~Game(void)
|
||||||
{
|
{
|
||||||
SAFE_DELETE(player);
|
//SAFE_DELETE(player);
|
||||||
|
if(player)
|
||||||
|
{
|
||||||
|
delete player;
|
||||||
|
player = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::Init()
|
void Game::Init()
|
||||||
|
@ -20,11 +25,13 @@ void Game::StartGame()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
void Game::Update()
|
void Game::Update(keyInput keyPressed)
|
||||||
{
|
{
|
||||||
player->Update();
|
player->Update(keyPressed);
|
||||||
}
|
}
|
||||||
void Game::Render()
|
void Game::Render()
|
||||||
{
|
{
|
||||||
player->Render();
|
Oyster::Graphics::Model::Model* model_Arr;
|
||||||
|
model_Arr = player->Render();
|
||||||
|
Oyster::Graphics::API::RenderScene(model_Arr, 1);
|
||||||
}
|
}
|
|
@ -3,9 +3,12 @@
|
||||||
|
|
||||||
#include "Level.h"
|
#include "Level.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
|
#include "IGame.h"
|
||||||
|
|
||||||
namespace GameLogic
|
namespace GameLogic
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
class Game
|
class Game
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -14,7 +17,7 @@ namespace GameLogic
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
void StartGame();
|
void StartGame();
|
||||||
void Update();
|
void Update(keyInput keyPressed);
|
||||||
void Render();
|
void Render();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v110</PlatformToolset>
|
<PlatformToolset>v110</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
@ -33,21 +33,21 @@
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v110</PlatformToolset>
|
<PlatformToolset>v110</PlatformToolset>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v110</PlatformToolset>
|
<PlatformToolset>v110</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v110</PlatformToolset>
|
<PlatformToolset>v110</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
@ -69,25 +69,26 @@
|
||||||
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
|
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
|
||||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||||
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
||||||
<LibraryPath>C:\Users\Linda Andersson\Desktop\spel\git\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath)</LibraryPath>
|
<LibraryPath>$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath)</LibraryPath>
|
||||||
|
<TargetExt>.dll</TargetExt>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
|
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
|
||||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||||
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
||||||
<LibraryPath>$(SolutionDir)..\Bin\DLL;$(LibraryPath)</LibraryPath>
|
<LibraryPath>$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath)</LibraryPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
|
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
|
||||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||||
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
||||||
<LibraryPath>$(SolutionDir)..\Bin\DLL;$(LibraryPath)</LibraryPath>
|
<LibraryPath>$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath)</LibraryPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
|
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
|
||||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||||
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
||||||
<LibraryPath>$(SolutionDir)..\Bin\DLL;$(LibraryPath)</LibraryPath>
|
<LibraryPath>$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath)</LibraryPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
|
@ -99,7 +100,7 @@
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>Input_$(PlatformShortName)D.lib;GamePhysics_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;GamePhysics_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
@ -112,7 +113,7 @@
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>Input_$(PlatformShortName)D.lib;GamePhysics_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;GamePhysics_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
@ -129,7 +130,7 @@
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<AdditionalDependencies>Input_$(PlatformShortName).lib;GamePhysics_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;GamePhysics_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
@ -146,7 +147,7 @@
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<AdditionalDependencies>Input_$(PlatformShortName).lib;GamePhysics_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;GamePhysics_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -194,7 +195,6 @@
|
||||||
<ClCompile Include="Player.cpp" />
|
<ClCompile Include="Player.cpp" />
|
||||||
<ClCompile Include="RefManager.cpp" />
|
<ClCompile Include="RefManager.cpp" />
|
||||||
<ClCompile Include="StaticObject.cpp" />
|
<ClCompile Include="StaticObject.cpp" />
|
||||||
<ClCompile Include="TestGLMain.cpp" />
|
|
||||||
<ClCompile Include="Weapon.cpp" />
|
<ClCompile Include="Weapon.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
|
|
@ -68,9 +68,6 @@
|
||||||
<ClCompile Include="DynamicObject.cpp">
|
<ClCompile Include="DynamicObject.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="TestGLMain.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="RefManager.cpp">
|
<ClCompile Include="RefManager.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
|
@ -8,6 +8,7 @@ BOOL WINAPI DllMain(
|
||||||
_In_ LPVOID lpvReserved
|
_In_ LPVOID lpvReserved
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
using namespace GameLogic;
|
using namespace GameLogic;
|
||||||
|
@ -30,9 +31,9 @@ void IGame::StartGame()
|
||||||
{
|
{
|
||||||
gameModule->StartGame();
|
gameModule->StartGame();
|
||||||
}
|
}
|
||||||
void IGame::Update()
|
void IGame::Update(keyInput keyPressed)
|
||||||
{
|
{
|
||||||
gameModule->Update();
|
gameModule->Update(keyPressed);
|
||||||
}
|
}
|
||||||
void IGame::Render()
|
void IGame::Render()
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,6 +12,15 @@
|
||||||
namespace GameLogic
|
namespace GameLogic
|
||||||
{
|
{
|
||||||
class Game;
|
class Game;
|
||||||
|
|
||||||
|
enum keyInput
|
||||||
|
{
|
||||||
|
keyInput_W,
|
||||||
|
keyInput_A,
|
||||||
|
keyInput_S,
|
||||||
|
keyInput_D,
|
||||||
|
keyInput_none
|
||||||
|
};
|
||||||
|
|
||||||
class GAME_DLL_USAGE IGame
|
class GAME_DLL_USAGE IGame
|
||||||
{
|
{
|
||||||
|
@ -21,9 +30,13 @@ namespace GameLogic
|
||||||
IGame();
|
IGame();
|
||||||
~IGame();
|
~IGame();
|
||||||
|
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
void StartGame();
|
void StartGame();
|
||||||
void Update();
|
/************************************************************************/
|
||||||
|
/* Get key input to update the player */
|
||||||
|
/************************************************************************/
|
||||||
|
void Update(keyInput keyPressed);
|
||||||
void Render();
|
void Render();
|
||||||
Game* getGameModule();
|
Game* getGameModule();
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -5,15 +5,16 @@
|
||||||
using namespace GameLogic;
|
using namespace GameLogic;
|
||||||
|
|
||||||
using namespace Oyster::Math;
|
using namespace Oyster::Math;
|
||||||
using namespace Oyster::Graphics::Render;
|
using namespace Oyster::Graphics::Model;
|
||||||
|
|
||||||
using namespace Utility::DynamicMemory;
|
using namespace Utility::DynamicMemory;
|
||||||
|
|
||||||
Object::Object(void)
|
Object::Object(void)
|
||||||
{
|
{
|
||||||
model = new Model();
|
model = new Model();
|
||||||
|
model = Oyster::Graphics::API::CreateModel(L"bth.obj");
|
||||||
|
|
||||||
struct float4
|
/*struct float4
|
||||||
{
|
{
|
||||||
float x,y,z,w;
|
float x,y,z,w;
|
||||||
};
|
};
|
||||||
|
@ -46,18 +47,21 @@ Object::Object(void)
|
||||||
|
|
||||||
model->World = &matrix;
|
model->World = &matrix;
|
||||||
model->info = modelInfo;
|
model->info = modelInfo;
|
||||||
model->Visible = true;
|
model->Visible = true;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Object::~Object(void)
|
Object::~Object(void)
|
||||||
{
|
{
|
||||||
SAFE_DELETE(model->info);
|
//SAFE_DELETE(model->info);
|
||||||
|
|
||||||
|
Oyster::Graphics::API::DeleteModel(model);
|
||||||
}
|
}
|
||||||
void Object::Render()
|
Model* Object::Render()
|
||||||
{
|
{
|
||||||
model->info->Vertices.Apply(0);
|
//model->info->Vertices.Apply(0);
|
||||||
Oyster::Graphics::Core::deviceContext->Draw(model->info->VertexCount,0);
|
this->rigidBody->GetOrientation(model->WorldMatrix);
|
||||||
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object::OBJECT_TYPE Object::GetType()
|
Object::OBJECT_TYPE Object::GetType()
|
||||||
|
|
|
@ -1,20 +1,17 @@
|
||||||
#ifndef OBJECT_H
|
#ifndef OBJECT_H
|
||||||
#define OBJECT_H
|
#define OBJECT_H
|
||||||
|
|
||||||
#include "Model/Model.h"
|
|
||||||
#include "Render/Rendering/Render.h"
|
|
||||||
#include "Utilities.h"
|
|
||||||
#include "PhysicsAPI.h"
|
#include "PhysicsAPI.h"
|
||||||
|
#include "DllInterfaces/GFXAPI.h"
|
||||||
|
|
||||||
|
#include "Model/Model.h"
|
||||||
|
#include "Utilities.h"
|
||||||
|
|
||||||
|
|
||||||
namespace GameLogic
|
namespace GameLogic
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
class Object
|
class Object
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Object(void);
|
Object(void);
|
||||||
virtual ~Object(void);
|
virtual ~Object(void);
|
||||||
|
@ -25,7 +22,7 @@ namespace GameLogic
|
||||||
OBJECT_TYPE_BOX,
|
OBJECT_TYPE_BOX,
|
||||||
};
|
};
|
||||||
|
|
||||||
void Render();
|
Oyster::Graphics::Model::Model* Render();
|
||||||
|
|
||||||
OBJECT_TYPE GetType();
|
OBJECT_TYPE GetType();
|
||||||
|
|
||||||
|
@ -36,8 +33,8 @@ namespace GameLogic
|
||||||
//either a model pointer or an ID to an arraypos filled with models that are to be rendered
|
//either a model pointer or an ID to an arraypos filled with models that are to be rendered
|
||||||
//rigidBody
|
//rigidBody
|
||||||
|
|
||||||
Utility::DynamicMemory::UniquePointer<Oyster::Physics::ICustomBody> rigidBody;
|
Oyster::Physics::ICustomBody* rigidBody;
|
||||||
Utility::DynamicMemory::UniquePointer<Oyster::Graphics::Render::Model> model;
|
Oyster::Graphics::Model::Model* model;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,24 +13,52 @@ Player::Player(void)
|
||||||
:Object()
|
:Object()
|
||||||
{
|
{
|
||||||
life = 100;
|
life = 100;
|
||||||
|
|
||||||
rigidBody = API::Instance().CreateSimpleRigidBody();
|
Oyster::Physics::ICustomBody* temp = rigidBody = API::Instance().CreateSimpleRigidBody().Release();
|
||||||
API::Instance().AddObject(rigidBody);
|
|
||||||
|
rigidBody->SetCenter(Oyster::Math::Float3(50,0,0));
|
||||||
|
rigidBody->SetMass_KeepMomentum(30);
|
||||||
|
rigidBody->SetSize(Oyster::Math::Float3(2,2,2));
|
||||||
|
rigidBody->SetSubscription(true);
|
||||||
|
rigidBody->SetMomentOfInertiaTensor_KeepMomentum(Oyster::Math::Float4x4( Oyster::Physics::MomentOfInertia::CreateCuboidMatrix(30, 2, 2, 2)));
|
||||||
|
|
||||||
|
//API::Instance().AddObject(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Player::~Player(void)
|
Player::~Player(void)
|
||||||
{
|
{
|
||||||
|
delete this->rigidBody;
|
||||||
}
|
}
|
||||||
void Player::Update()
|
void Player::Update(keyInput keyPressed)
|
||||||
{
|
{
|
||||||
|
if(keyPressed != keyInput_none)
|
||||||
|
{
|
||||||
|
Move();
|
||||||
|
|
||||||
|
if(keyPressed == keyInput_A)
|
||||||
|
{
|
||||||
|
Oyster::Math::Float3 pos = this->rigidBody->GetCenter();
|
||||||
|
pos.x -= 0.1;
|
||||||
|
rigidBody->SetCenter(pos);
|
||||||
|
}
|
||||||
|
if(keyPressed == keyInput_D)
|
||||||
|
{
|
||||||
|
Oyster::Math::Float3 pos = this->rigidBody->GetCenter();
|
||||||
|
pos.x += 0.1;
|
||||||
|
rigidBody->SetCenter(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::Move()
|
void Player::Move()
|
||||||
{
|
{
|
||||||
|
//API::Instance().Update();
|
||||||
|
/*Oyster::Math::Float3 pos = this->rigidBody->GetCenter();
|
||||||
|
pos.x += 0.1;
|
||||||
|
rigidBody->SetCenter(pos);*/
|
||||||
|
//API::Instance().SetCenter(rigidBody, pos);
|
||||||
}
|
}
|
||||||
void Player::Shoot()
|
void Player::Shoot()
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,10 +3,12 @@
|
||||||
|
|
||||||
#include "Object.h"
|
#include "Object.h"
|
||||||
#include "Weapon.h"
|
#include "Weapon.h"
|
||||||
|
#include "IGame.h"
|
||||||
|
|
||||||
|
|
||||||
namespace GameLogic
|
namespace GameLogic
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
class Player : public Object
|
class Player : public Object
|
||||||
{
|
{
|
||||||
|
@ -15,7 +17,7 @@ namespace GameLogic
|
||||||
Player(void);
|
Player(void);
|
||||||
~Player(void);
|
~Player(void);
|
||||||
|
|
||||||
void Update();
|
void Update(keyInput keyPressed);
|
||||||
|
|
||||||
void Move();
|
void Move();
|
||||||
void Shoot();
|
void Shoot();
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
#include "Render\Preparations\Preparations.h"
|
#include "DllInterfaces/GFXAPI.h"
|
||||||
#include "IGame.h"
|
#include "IGame.h"
|
||||||
|
|
||||||
#include "L_inputClass.h"
|
#include "L_inputClass.h"
|
||||||
|
@ -94,7 +94,9 @@ int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdL
|
||||||
|
|
||||||
__int64 prevTimeStamp = 0;
|
__int64 prevTimeStamp = 0;
|
||||||
QueryPerformanceCounter((LARGE_INTEGER*)&prevTimeStamp);
|
QueryPerformanceCounter((LARGE_INTEGER*)&prevTimeStamp);
|
||||||
SetStdOutToNewConsole();
|
|
||||||
|
//debugwindow
|
||||||
|
//SetStdOutToNewConsole();
|
||||||
// Main message loop
|
// Main message loop
|
||||||
MSG msg = {0};
|
MSG msg = {0};
|
||||||
while(WM_QUIT != msg.message)
|
while(WM_QUIT != msg.message)
|
||||||
|
@ -176,7 +178,7 @@ HRESULT InitWindow( HINSTANCE hInstance, int nCmdShow )
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
HRESULT InitDirect3D()
|
HRESULT InitDirect3D()
|
||||||
{
|
{
|
||||||
HRESULT hr = S_OK;;
|
/*HRESULT hr = S_OK;;
|
||||||
|
|
||||||
Oyster::Graphics::Core::resolution = Oyster::Math::Float2( 1024, 768 );
|
Oyster::Graphics::Core::resolution = Oyster::Math::Float2( 1024, 768 );
|
||||||
|
|
||||||
|
@ -208,16 +210,16 @@ HRESULT InitDirect3D()
|
||||||
|
|
||||||
Oyster::Graphics::Render::Preparations::Basic::BindBackBufferRTV();
|
Oyster::Graphics::Render::Preparations::Basic::BindBackBufferRTV();
|
||||||
|
|
||||||
Oyster::Graphics::Render::Preparations::Basic::SetViewPort();
|
Oyster::Graphics::Render::Preparations::Basic::SetViewPort();*/
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT InitGame()
|
HRESULT InitGame()
|
||||||
{
|
{
|
||||||
game = new GameLogic::IGame();
|
|
||||||
game->Init();
|
if(Oyster::Graphics::API::Init(g_hWnd, false, false, Oyster::Math::Float2( 1024, 768)) != Oyster::Graphics::API::Sucsess)
|
||||||
game->StartGame();
|
return E_FAIL;
|
||||||
|
|
||||||
inputObj = new InputClass;
|
inputObj = new InputClass;
|
||||||
if(!inputObj->Initialize(g_hInst, g_hWnd, 1024, 768))
|
if(!inputObj->Initialize(g_hInst, g_hWnd, 1024, 768))
|
||||||
|
@ -225,6 +227,11 @@ HRESULT InitGame()
|
||||||
MessageBox(0, L"Could not initialize the input object.", L"Error", MB_OK);
|
MessageBox(0, L"Could not initialize the input object.", L"Error", MB_OK);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
game = new GameLogic::IGame();
|
||||||
|
game->Init();
|
||||||
|
game->StartGame();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -261,24 +268,27 @@ HRESULT Render(float deltaTime)
|
||||||
if(inputObj->IsKeyPressed(DIK_A))
|
if(inputObj->IsKeyPressed(DIK_A))
|
||||||
{
|
{
|
||||||
isPressed = 1;
|
isPressed = 1;
|
||||||
std::cout<<"knon";
|
//std::cout<<"test";
|
||||||
}
|
}
|
||||||
//Oyster::Graphics::Render::Rendering::Basic::NewFrame();
|
|
||||||
Oyster::Graphics::Render::Preparations::Basic::ClearBackBuffer(Oyster::Math::Float4(0,0,1,1));
|
// test view and projection matrix
|
||||||
|
Oyster::Math::Float3 dir = Oyster::Math::Float3(0,0,-1);
|
||||||
|
Oyster::Math::Float3 up =Oyster::Math::Float3(0,1,0);
|
||||||
|
Oyster::Math::Float3 pos = Oyster::Math::Float3(0, 0, 100);
|
||||||
|
|
||||||
|
Oyster::Math::Float4x4 view =Oyster::Math3D::OrientationMatrix_LookAtDirection(dir, up, pos);
|
||||||
|
view = view.GetInverse();
|
||||||
|
|
||||||
|
Oyster::Math::Float4x4 proj = Oyster::Math3D::ProjectionMatrix_Perspective(PI/2, 1024/768, 1, 1000);
|
||||||
|
|
||||||
|
Oyster::Graphics::API::NewFrame(view, proj);
|
||||||
|
|
||||||
game->Render();
|
game->Render();
|
||||||
//Oyster::Graphics::Core::deviceContext->Draw(3,0);
|
|
||||||
|
|
||||||
//Oyster::Graphics::Render::Rendering::Basic::EndFrame();
|
|
||||||
wchar_t title[255];
|
wchar_t title[255];
|
||||||
|
|
||||||
//swprintf(title, L"| FPS: %d \n",(int)(isPressed));
|
|
||||||
swprintf(title, sizeof(title), L"| Pressing A: %d | \n", (int)(isPressed));
|
swprintf(title, sizeof(title), L"| Pressing A: %d | \n", (int)(isPressed));
|
||||||
SetWindowText(g_hWnd, title);
|
SetWindowText(g_hWnd, title);
|
||||||
|
|
||||||
|
Oyster::Graphics::API::EndFrame();
|
||||||
Oyster::Graphics::Core::swapChain->Present(0,0);
|
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue