added command line, added basic character
This commit is contained in:
@@ -3,10 +3,12 @@
|
||||
#include "tier1/utlvector.h"
|
||||
#include "console.h"
|
||||
#include "tier1/commandline.h"
|
||||
#include "input.h"
|
||||
|
||||
#include "vulkan/vulkan.h"
|
||||
#include "SDL3/SDL.h"
|
||||
#include "vulkan/vulkan_core.h"
|
||||
#include <SDL3/SDL_keycode.h>
|
||||
#define SDL_MAIN_HANDLED
|
||||
#include "SDL3/SDL_main.h"
|
||||
#include "SDL3/SDL_vulkan.h"
|
||||
@@ -17,7 +19,9 @@
|
||||
|
||||
#define VMA_VULKAN_VERSION 1004000
|
||||
#define VMA_IMPLEMENTATION
|
||||
#include "tier0/minmax_off.h"
|
||||
#include "vk_mem_alloc.h"
|
||||
#include "tier0/minmax.h"
|
||||
|
||||
SDL_Window *g_window;
|
||||
|
||||
@@ -181,6 +185,51 @@ void IVideo_SwapchainDestroy()
|
||||
}
|
||||
};
|
||||
|
||||
EInputKey ISDL_KeyName(SDL_Keycode key)
|
||||
{
|
||||
switch(key)
|
||||
{
|
||||
case SDLK_1: return KEY_1;
|
||||
case SDLK_2: return KEY_2;
|
||||
case SDLK_3: return KEY_3;
|
||||
case SDLK_4: return KEY_4;
|
||||
case SDLK_5: return KEY_5;
|
||||
case SDLK_6: return KEY_6;
|
||||
case SDLK_7: return KEY_7;
|
||||
case SDLK_8: return KEY_8;
|
||||
case SDLK_9: return KEY_9;
|
||||
case SDLK_0: return KEY_0;
|
||||
|
||||
case SDLK_A: return KEY_A;
|
||||
case SDLK_B: return KEY_B;
|
||||
case SDLK_C: return KEY_C;
|
||||
case SDLK_D: return KEY_D;
|
||||
case SDLK_E: return KEY_E;
|
||||
case SDLK_F: return KEY_F;
|
||||
case SDLK_G: return KEY_G;
|
||||
case SDLK_H: return KEY_H;
|
||||
case SDLK_I: return KEY_I;
|
||||
case SDLK_J: return KEY_J;
|
||||
case SDLK_K: return KEY_K;
|
||||
case SDLK_L: return KEY_L;
|
||||
case SDLK_M: return KEY_M;
|
||||
case SDLK_N: return KEY_N;
|
||||
case SDLK_O: return KEY_O;
|
||||
case SDLK_P: return KEY_P;
|
||||
case SDLK_Q: return KEY_Q;
|
||||
case SDLK_R: return KEY_R;
|
||||
case SDLK_S: return KEY_S;
|
||||
case SDLK_T: return KEY_T;
|
||||
case SDLK_U: return KEY_U;
|
||||
case SDLK_V: return KEY_V;
|
||||
case SDLK_W: return KEY_W;
|
||||
case SDLK_X: return KEY_X;
|
||||
case SDLK_Y: return KEY_Y;
|
||||
case SDLK_Z: return KEY_Z;
|
||||
}
|
||||
return KEY_NONE;
|
||||
};
|
||||
|
||||
void IVideo::Init()
|
||||
{
|
||||
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS);
|
||||
@@ -276,16 +325,9 @@ void IVideo::Init()
|
||||
.extendedDynamicState3ColorWriteMask = VK_TRUE,
|
||||
};
|
||||
|
||||
VkPhysicalDeviceExtendedDynamicState2FeaturesEXT pdeds2fe = {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_2_FEATURES_EXT,
|
||||
.pNext = &pdeds3fe,
|
||||
.extendedDynamicState2LogicOp = VK_TRUE,
|
||||
.extendedDynamicState2PatchControlPoints = VK_TRUE,
|
||||
};
|
||||
|
||||
VkPhysicalDeviceVulkan13Features pdv13f = {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES,
|
||||
.pNext = &pdeds2fe,
|
||||
.pNext = &pdeds3fe,
|
||||
.synchronization2 = VK_TRUE,
|
||||
.dynamicRendering = VK_TRUE,
|
||||
};
|
||||
@@ -346,12 +388,22 @@ void IVideo_HandleEvents()
|
||||
SDL_Event event;
|
||||
while (SDL_PollEvent(&event))
|
||||
{
|
||||
SDL_KeyboardEvent *key = &event.key;
|
||||
switch (event.type)
|
||||
{
|
||||
case SDL_EVENT_WINDOW_RESIZED:
|
||||
g_nWindowWidth = event.window.data1;
|
||||
g_nWindowHeight = event.window.data2;
|
||||
g_bConfigNotify = 2;
|
||||
break;
|
||||
case SDL_EVENT_KEY_DOWN:
|
||||
if (!key->repeat)
|
||||
IInput::KeyEvent(ISDL_KeyName(key->key),KEY_EVENT_TYPE_UP);
|
||||
break;
|
||||
case SDL_EVENT_KEY_UP:
|
||||
key = &event.key;
|
||||
SDL_Log("Key Up: %s", SDL_GetKeyName(key->key));
|
||||
break;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user