Day 31 complete

This commit is contained in:
2023-10-07 02:33:39 -04:00
parent cb3c71705f
commit dd00713c9e
29 changed files with 340 additions and 159 deletions

View File

@ -1,5 +1,4 @@
#include "platform.hpp"
#pragma once
struct Context
{

View File

@ -0,0 +1,47 @@
#pragma once
#if INTELLISENSE_DIRECTIVES
#include <math.h>
#endif
// TODO(Ed) : Convert all of these to platform-efficient versions
inline
s32 floor_f32_to_s32( f32 value )
{
s32 result = scast(s32, floorf( value ));
return result;
}
inline
s32 round_f32_to_s32( f32 value )
{
s32 result = scast(s32, value + 0.5f);
return result;
}
inline
s32 truncate_f32_to_s32( f32 value )
{
s32 result = scast(s32, value);
return result;
}
inline
f32 sine( f32 angle )
{
f32 result = sinf( angle );
return result;
}
f32 cosine( f32 angle )
{
f32 result = cosf( angle );
return result;
}
f32 arc_tangent( f32 Y, f32 X )
{
f32 result = atan2f( Y, X );
return result;
}

View File

@ -1,8 +1,8 @@
#pragma once
// Joyshock grime wrapper
#include "grime.hpp"
// JoyShock does not provide a proper c-linkage definition for its structs, so we have to push this warning ignore.
#ifdef COMPILER_CLANG
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wreturn-type-c-linkage"

View File

@ -1,5 +1,7 @@
#pragma once
// TODO(Ed) : Make a constant per type?
# define EPSILON 1.19209290e-7f
# define ZERO 0.0f
# define ONE 1.0f

View File

@ -8,7 +8,8 @@
#pragma once
// TODO(Ed) : REMOVE THESE WHEN HE GETS TO THEM
#if INTELLISENSE_DIRECTIVES
// TODO(Ed) : REMOVE THESE WHEN CASEY GETS TO THEM
#include <math.h> // TODO : Implement math ourselves
#include <stdio.h> // TODO : Implement output logging ourselves
@ -17,8 +18,10 @@
#include "generics.hpp"
#include "math_constants.hpp"
#include "types.hpp"
#include "intrinsics.hpp"
#include "strings.hpp"
#include "context.hpp"
#endif
#define NS_PLATFORM_BEGIN namespace platform {
#define NS_PLATFORM_END }

View File

@ -1,5 +1,4 @@
#include "macros.hpp"
#include "types.hpp"
#pragma once
void str_append( u32 dest_len, char* dest, u32 src_len, char const* src );
void str_concat( u32 dest_size, char* dest

View File

@ -35,11 +35,6 @@
// # define CONST const
// #endif
// SAL BS
#ifndef _In_
# define _In_
#endif
#define NS_WIN32_BEGIN namespace win32 {
#define NS_WIN32_END }
@ -130,18 +125,6 @@ ProcSignature* get_procedure_from_library( HMODULE library_module, char const* s
}
#pragma region XInput
WIN_LIB_API DWORD WINAPI XInputGetState
(
DWORD dwUserIndex, // Index of the gamer associated with the device
XINPUT_STATE* pState // Receives the current state
);
WIN_LIB_API DWORD WINAPI XInputSetState
(
DWORD dwUserIndex, // Index of the gamer associated with the device
XINPUT_VIBRATION* pVibration // The vibration information to send to the controller
);
DWORD WINAPI xinput_get_state_stub( DWORD dwUserIndex, XINPUT_STATE* pVibration ) {
do_once_start
OutputDebugStringA( "xinput_get_state stubbed!\n");

View File

@ -1,7 +1,11 @@
#include "platform/platform.hpp"
#if INTELLISENSE_DIRECTIVES
#include "platform.hpp"
#include "engine/engine.hpp"
#include "win32.hpp"
#endif
NS_PLATFORM_BEGIN
using namespace win32;
// TODO : This will def need to be looked over.
struct DirectSoundBuffer

View File

@ -1,15 +1,19 @@
#include "platform/platform.hpp"
#include "platform/jsl.hpp"
#if INTELLISENSE_DIRECTIVES
#include "platform.hpp"
#include "engine/engine.hpp"
#include "jsl.hpp"
#include "win32.hpp"
#endif
NS_PLATFORM_BEGIN
using namespace win32;
// Max controllers for the platform layer and thus for all other layers is 4. (Sanity and xinput limit)
constexpr u32 Max_Controllers = 4;
using JSL_DeviceHandle = int;
using JSL_DeviceHandle = int;
using EngineXInputPadStates = engine::XInputPadState[ Max_Controllers ];
using EngineDSPadStates = engine::DualsensePadState[Max_Controllers];
using EngineDSPadStates = engine::DualsensePadState[Max_Controllers];
internal void
input_process_digital_btn( engine::DigitalBtn* old_state, engine::DigitalBtn* new_state, u32 raw_btns, u32 btn_flag )

View File

@ -1,3 +1,11 @@
#if INTELLISENSE_DIRECTIVES
#include "platform/platform.hpp"
#include "engine/engine.hpp"
#include "engine/engine_to_platform_api.hpp"
#include "gen/engine_symbol_table.hpp"
#include "win32.hpp"
#include "jsl.hpp"
#endif
/*
TODO : This is not a final platform layer
@ -17,17 +25,6 @@
- GetKeyboardLayout (for French keyboards, international WASD support)
*/
// Platform Layer headers
#include "platform/platform.hpp"
#include "platform/jsl.hpp" // Using this to get dualsense controllers
#include "win32.hpp"
// Engine layer headers
#include "engine/engine.hpp"
#include "engine/engine_to_platform_api.hpp"
#include "gen/engine_symbol_table.hpp"
NS_PLATFORM_BEGIN
using namespace win32;

View File

@ -1,6 +1,8 @@
#include "platform/platform.hpp"
#include "platform/jsl.hpp"
#if INTELLISENSE_DIRECTIVES
#include "platform.hpp"
#include "jsl.hpp"
#include "win32.hpp"
#endif
NS_PLATFORM_BEGIN