mirror of
https://github.com/Ed94/HandmadeHero.git
synced 2025-06-16 11:41:47 -07:00
Day 31 complete
This commit is contained in:
25
project/Readme.md
Normal file
25
project/Readme.md
Normal file
@ -0,0 +1,25 @@
|
||||
# Project Documentation
|
||||
|
||||
Currently the project is split into two modules:
|
||||
|
||||
* Platform
|
||||
* Engine
|
||||
|
||||
This project takes the approach of doing all includes for a module in a single translation unit.
|
||||
Any includes within the project files outside of the translation unit files used for builds are for intellisense purposes.
|
||||
They are wrapped in `INTELLISENSE_DIRECTIVES` preprocessor conditional, and are necessary for most editors as they do not parse the project directories properly.
|
||||
(They do a rudimentary parse on a per-file basis on includes ussually)
|
||||
|
||||
## Platform
|
||||
|
||||
Translation Unit: `handmade_win32.cpp` for Windows
|
||||
|
||||
Deals with providing the core library for the project along with dealing with th platform specific grime.
|
||||
Only supports Windows at the momment. May add suport for macos or Ubuntu/SteamOS(linux) in the future.
|
||||
|
||||
## Engine
|
||||
|
||||
Translation Unit: `handmade_engine.cpp`
|
||||
|
||||
Currently deals with both *engine* and *game* code until I see a point where I can segment the two into separate modules.
|
||||
The the "proto-code" for the game module is within `handmade.hpp` & `handmade.cpp`
|
@ -15,7 +15,13 @@
|
||||
#undef do_once_end
|
||||
using namespace gen;
|
||||
|
||||
#include "platform/grime.hpp"
|
||||
#include "platform/macros.hpp"
|
||||
#include "platform/types.hpp"
|
||||
#include "platform/strings.hpp"
|
||||
#include "platform/platform.hpp"
|
||||
|
||||
#include "engine/engine.hpp"
|
||||
#include "engine/engine_to_platform_api.hpp"
|
||||
|
||||
constexpr StrC fname_handmade_engine_symbols = txt("handmade_engine.symbols");
|
||||
|
@ -1,14 +1,15 @@
|
||||
//#include "win32.h"
|
||||
#if INTELLISENSE_DIRECTIVES
|
||||
#include "engine.hpp"
|
||||
#include "engine_to_platform_api.hpp"
|
||||
#include "handmade.hpp"
|
||||
#endif
|
||||
|
||||
NS_ENGINE_BEGIN
|
||||
|
||||
#define pressed( btn ) (btn.ended_down && btn.half_transitions > 0)
|
||||
|
||||
// Used to determine if analog input is at move threshold
|
||||
constexpr f32 analog__move_threshold = 0.5f;
|
||||
constexpr f32 analog_move_threshold = 0.5f;
|
||||
|
||||
struct EngineActions
|
||||
{
|
||||
@ -58,41 +59,9 @@ struct EngineState
|
||||
hh::Memory game_memory;
|
||||
};
|
||||
|
||||
NS_ENGINE_END
|
||||
#include "test_samples.cpp"
|
||||
|
||||
internal void
|
||||
render_player( OffscreenBuffer* buffer, s32 pos_x, s32 pos_y )
|
||||
{
|
||||
u8* end_of_buffer = rcast(u8*, buffer->memory)
|
||||
- buffer->bytes_per_pixel * buffer->width
|
||||
+ buffer->pitch * buffer->height;
|
||||
|
||||
s32 top = pos_y;
|
||||
s32 bottom = pos_y + 10;
|
||||
|
||||
u32 color = 0xFFFFFFFF;
|
||||
|
||||
for ( s32 coord_x = pos_x; coord_x < (pos_x+ 10); ++ coord_x )
|
||||
{
|
||||
u8*
|
||||
pixel_byte = rcast(u8*, buffer->memory);
|
||||
pixel_byte += coord_x * buffer->bytes_per_pixel;
|
||||
pixel_byte += top * buffer->pitch;
|
||||
|
||||
for ( s32 coord_y = top; coord_y < bottom; ++ coord_y )
|
||||
{
|
||||
if ( pixel_byte < buffer->memory || pixel_byte >= end_of_buffer )
|
||||
continue;
|
||||
|
||||
s32* pixel = rcast(s32*, pixel_byte);
|
||||
*pixel = color;
|
||||
|
||||
|
||||
|
||||
pixel_byte += buffer->pitch;
|
||||
}
|
||||
}
|
||||
}
|
||||
NS_ENGINE_BEGIN
|
||||
|
||||
#if Build_Development
|
||||
using SnapshotFn = void ( Memory* memory, platform::ModuleAPI* platform_api );
|
||||
@ -382,26 +351,6 @@ output_sound( EngineState* state, AudioBuffer* sound_buffer, GetSoundSampleValue
|
||||
}
|
||||
}
|
||||
|
||||
inline
|
||||
s32 floor_f32_to_s32( f32 value )
|
||||
{
|
||||
// TODO : Casey wants to use an intrinsic
|
||||
return scast(s32, floorf( value ));
|
||||
}
|
||||
|
||||
inline
|
||||
s32 round_f32_to_s32( f32 value )
|
||||
{
|
||||
// TODO(Ed) : Casey wants to use an intrinsic
|
||||
return scast(s32, value + 0.5f);
|
||||
}
|
||||
|
||||
inline
|
||||
s32 truncate_f32_to_s32( f32 value )
|
||||
{
|
||||
return scast(s32, value);
|
||||
}
|
||||
|
||||
internal
|
||||
void draw_rectangle( OffscreenBuffer* buffer
|
||||
, f32 min_x, f32 min_y
|
||||
@ -522,17 +471,19 @@ CanonPosition get_cannonical_position( World* world, RawPosition raw_pos )
|
||||
|
||||
f32 pos_x = ( raw_pos.x - world->tile_upper_left_x );
|
||||
f32 pos_y = ( raw_pos.y - world->tile_upper_left_y );
|
||||
|
||||
f32 tile_size = scast(f32, world->tile_size_in_pixels);
|
||||
|
||||
s32 tile_x = floor_f32_to_s32( pos_x / world->tile_width );
|
||||
s32 tile_y = floor_f32_to_s32( pos_y / world->tile_height );
|
||||
s32 tile_x = floor_f32_to_s32( pos_x / tile_size );
|
||||
s32 tile_y = floor_f32_to_s32( pos_y / tile_size );
|
||||
|
||||
f32 tile_rel_x = pos_x - scast(f32, tile_x) * world->tile_width;
|
||||
f32 tile_rel_y = pos_y - scast(f32, tile_y) * world->tile_height;
|
||||
f32 tile_rel_x = pos_x - scast(f32, tile_x) * tile_size;
|
||||
f32 tile_rel_y = pos_y - scast(f32, tile_y) * tile_size;
|
||||
|
||||
assert( tile_rel_x >= 0.f );
|
||||
assert( tile_rel_y >= 0.f );
|
||||
assert( tile_rel_x < world->tile_width );
|
||||
assert( tile_rel_y < world->tile_height );
|
||||
assert( tile_rel_x < tile_size );
|
||||
assert( tile_rel_y < tile_size );
|
||||
|
||||
/*
|
||||
The puprpose of this is to be able to detect if the point is outside of the tilemap,
|
||||
@ -820,16 +771,18 @@ void update_and_render( f32 delta_time, InputState* input, OffscreenBuffer* back
|
||||
tile_maps[1][1].tiles = rcast(u32*, tiles_11);
|
||||
|
||||
World world;
|
||||
world.tile_size_in_meters = 1.4f;
|
||||
world.tile_size_in_pixels = 85;
|
||||
|
||||
f32 tile_size_in_pixels = scast(f32, world.tile_size_in_pixels);
|
||||
|
||||
world.num_tiles_x = tile_map_num_x;
|
||||
world.num_tiles_y = tile_map_num_y;
|
||||
|
||||
f32 scale = 85;
|
||||
|
||||
world.tile_width = scale;
|
||||
world.tile_height = scale * 1.05f;
|
||||
|
||||
world.tile_upper_left_x = -(world.tile_width * 0.5f);
|
||||
world.tile_upper_left_y = -(world.tile_height * 0.5f);
|
||||
world.tile_upper_left_x = -( tile_size_in_pixels * 0.5f);
|
||||
world.tile_upper_left_y = -( tile_size_in_pixels * 0.25f);
|
||||
|
||||
world.tilemaps_num_x = 2;
|
||||
world.tilemaps_num_y = 2;
|
||||
@ -839,8 +792,8 @@ void update_and_render( f32 delta_time, InputState* input, OffscreenBuffer* back
|
||||
TileMap* current_tile_map = world_get_tilemap( & world, game_state->tile_map_x, game_state->tile_map_y );
|
||||
assert( current_tile_map != nullptr );
|
||||
|
||||
player->width = world.tile_width * 0.75f;
|
||||
player->height = world.tile_height;
|
||||
player->width = tile_size_in_pixels * 0.70f;
|
||||
player->height = tile_size_in_pixels * 0.9f;
|
||||
|
||||
f32 player_half_width = player->width / 2.f;
|
||||
f32 player_quarter_height = player->height / 4.f;
|
||||
@ -865,18 +818,21 @@ void update_and_render( f32 delta_time, InputState* input, OffscreenBuffer* back
|
||||
|
||||
b32 valid_new_pos = true;
|
||||
{
|
||||
RawPosition test_pos = { new_player_pos_x - player_half_width, new_player_pos_y - player_quarter_height, game_state->tile_map_x, game_state->tile_map_y };
|
||||
RawPosition test_pos = {
|
||||
new_player_pos_x - player_half_width, new_player_pos_y - player_quarter_height,
|
||||
game_state->tile_map_x, game_state->tile_map_y
|
||||
};
|
||||
|
||||
valid_new_pos &= world_is_point_empty( & world, test_pos );
|
||||
|
||||
test_pos.x = new_player_pos_x + player_half_width;
|
||||
test_pos.x = new_player_pos_x + player_half_width;
|
||||
valid_new_pos &= world_is_point_empty( & world, test_pos );
|
||||
|
||||
test_pos.x = new_player_pos_x - player_half_width;
|
||||
test_pos.y = new_player_pos_y;
|
||||
test_pos.x = new_player_pos_x - player_half_width;
|
||||
test_pos.y = new_player_pos_y;
|
||||
valid_new_pos &= world_is_point_empty( & world, test_pos );
|
||||
|
||||
test_pos.x = new_player_pos_x + player_half_width;
|
||||
test_pos.x = new_player_pos_x + player_half_width;
|
||||
valid_new_pos &= world_is_point_empty( & world, test_pos );
|
||||
}
|
||||
|
||||
@ -890,8 +846,8 @@ void update_and_render( f32 delta_time, InputState* input, OffscreenBuffer* back
|
||||
|
||||
// current_tile_map = world_get_tilemap( & world, game_state->tile_map_x, game_state->tile_map_y );
|
||||
|
||||
player->pos_x = world.tile_upper_left_x + world.tile_width * scast(f32, canon_pos.tile_x) + canon_pos.x;
|
||||
player->pos_y = world.tile_upper_left_y + world.tile_height * scast(f32, canon_pos.tile_y) + canon_pos.y;
|
||||
player->pos_x = world.tile_upper_left_x + tile_size_in_pixels * scast(f32, canon_pos.tile_x) + canon_pos.x;
|
||||
player->pos_y = world.tile_upper_left_y + tile_size_in_pixels * scast(f32, canon_pos.tile_y) + canon_pos.y;
|
||||
}
|
||||
|
||||
// player_tile_x
|
||||
@ -934,10 +890,10 @@ void update_and_render( f32 delta_time, InputState* input, OffscreenBuffer* back
|
||||
grey[2] = 0.22f;
|
||||
}
|
||||
|
||||
f32 min_x = world.tile_upper_left_x + scast(f32, col) * world.tile_width;
|
||||
f32 min_y = world.tile_upper_left_y + scast(f32, row) * world.tile_height;
|
||||
f32 max_x = min_x + world.tile_width;
|
||||
f32 max_y = min_y + world.tile_height;
|
||||
f32 min_x = world.tile_upper_left_x + scast(f32, col) * tile_size_in_pixels;
|
||||
f32 min_y = world.tile_upper_left_y + scast(f32, row) * tile_size_in_pixels;
|
||||
f32 max_x = min_x + tile_size_in_pixels;
|
||||
f32 max_y = min_y + tile_size_in_pixels;
|
||||
|
||||
draw_rectangle( back_buffer
|
||||
, min_x, min_y
|
||||
|
@ -4,7 +4,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if INTELLISENSE_DIRECTIVES
|
||||
#include "platform/platform.hpp"
|
||||
#endif
|
||||
|
||||
#define NS_ENGINE_BEGIN namespace engine {
|
||||
#define NS_ENGINE_END }
|
||||
@ -282,12 +284,12 @@ struct TileMap
|
||||
|
||||
struct World
|
||||
{
|
||||
f32 tile_size_in_meters;
|
||||
s32 tile_size_in_pixels;
|
||||
|
||||
f32 tile_upper_left_x;
|
||||
f32 tile_upper_left_y;
|
||||
|
||||
f32 tile_width;
|
||||
f32 tile_height;
|
||||
|
||||
s32 num_tiles_x; // Number of tiles on the x-axis for a tilemap.
|
||||
s32 num_tiles_y; // Number of tiles on the y-axis for a tilemap.
|
||||
|
||||
@ -300,11 +302,16 @@ struct World
|
||||
|
||||
struct CanonPosition
|
||||
{
|
||||
// TODO(Ed): Convert these to resolution-indenpent rep of world units (a proper vector space?))
|
||||
// Note: Tile-Relative position
|
||||
// TODO(Ed) : These are still in pixels
|
||||
f32 x;
|
||||
f32 y;
|
||||
|
||||
/* TODO(Ed) :
|
||||
Take the tile map x & y and the tile x & y
|
||||
where there is some low bits for the tile index
|
||||
and the high bits are the tile "page".
|
||||
*/
|
||||
s32 tile_map_x;
|
||||
s32 tile_map_y;
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
This represents the API only accessible to the platform layer to fullfill for the engine layer.
|
||||
*/
|
||||
#pragma once
|
||||
#include "engine/engine.hpp"
|
||||
|
||||
#ifndef Engine_API
|
||||
# define Engine_API
|
||||
@ -16,12 +15,16 @@ using ShutdownFn = void( Memory* memory, platform::ModuleAPI* platform_api
|
||||
|
||||
// Needs a contextual reference to four things:
|
||||
// Timing, Input, Bitmap Buffer
|
||||
using UpdateAndRenderFn = void ( f32 delta_time, InputState* input, OffscreenBuffer* back_buffer, Memory* memory, platform::ModuleAPI* platform_api, ThreadContext* thread );
|
||||
using UpdateAndRenderFn = void ( f32 delta_time
|
||||
, InputState* input, OffscreenBuffer* back_buffer
|
||||
, Memory* memory, platform::ModuleAPI* platform_api, ThreadContext* thread );
|
||||
|
||||
// Audio timing is complicated, processing samples must be done at a different period from the rest of the engine's usual update.
|
||||
// IMPORTANT: This has very tight timing, and cannot be more than a millisecond in execution.
|
||||
// TODO(Ed) : Reduce timing pressure on performance by measuring it or pinging its time.
|
||||
using UpdateAudioFn = void ( f32 delta_time, AudioBuffer* audio_buffer, Memory* memory, platform::ModuleAPI* platform_api, ThreadContext* thread );
|
||||
using UpdateAudioFn = void ( f32 delta_time
|
||||
, AudioBuffer* audio_buffer
|
||||
, Memory* memory, platform::ModuleAPI* platform_api, ThreadContext* thread );
|
||||
|
||||
struct ModuleAPI
|
||||
{
|
||||
|
@ -1,3 +1,9 @@
|
||||
#if INTELLISENSE_DIRECTIVES
|
||||
#include "engine.hpp"
|
||||
#endif
|
||||
|
||||
NS_ENGINE_BEGIN
|
||||
|
||||
using GetSoundSampleValueFn = s16( EngineState* state, AudioBuffer* sound_buffer );
|
||||
|
||||
internal s16
|
||||
@ -76,3 +82,39 @@ render_weird_graident(OffscreenBuffer* buffer, u32 x_offset, u32 y_offset )
|
||||
row += buffer->pitch;
|
||||
}
|
||||
}
|
||||
|
||||
internal
|
||||
void render_player( OffscreenBuffer* buffer, s32 pos_x, s32 pos_y )
|
||||
{
|
||||
u8* end_of_buffer = rcast(u8*, buffer->memory)
|
||||
- buffer->bytes_per_pixel * buffer->width
|
||||
+ buffer->pitch * buffer->height;
|
||||
|
||||
s32 top = pos_y;
|
||||
s32 bottom = pos_y + 10;
|
||||
|
||||
u32 color = 0xFFFFFFFF;
|
||||
|
||||
for ( s32 coord_x = pos_x; coord_x < (pos_x+ 10); ++ coord_x )
|
||||
{
|
||||
u8*
|
||||
pixel_byte = rcast(u8*, buffer->memory);
|
||||
pixel_byte += coord_x * buffer->bytes_per_pixel;
|
||||
pixel_byte += top * buffer->pitch;
|
||||
|
||||
for ( s32 coord_y = top; coord_y < bottom; ++ coord_y )
|
||||
{
|
||||
if ( pixel_byte < buffer->memory || pixel_byte >= end_of_buffer )
|
||||
continue;
|
||||
|
||||
s32* pixel = rcast(s32*, pixel_byte);
|
||||
*pixel = color;
|
||||
|
||||
|
||||
|
||||
pixel_byte += buffer->pitch;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_ENGINE_END
|
||||
|
@ -1,8 +1,13 @@
|
||||
/*
|
||||
Hnadmade Hero game code layer.
|
||||
Hnadmade Hero game code layer.
|
||||
|
||||
Note:
|
||||
There is not enough code yet in the engine layer to do this separation
|
||||
to a game module.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if INTELLISENSE_DIRECTIVES
|
||||
#include "engine/engine.hpp"
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#if INTELLISENSE_DIRECTIVES
|
||||
#include "engine/engine.hpp"
|
||||
#endif
|
||||
|
||||
#define NS_HANDMADE_BEGIN namespace hh {
|
||||
#define NS_HANDMADE_END }
|
||||
@ -100,3 +101,4 @@ struct GameState
|
||||
};
|
||||
|
||||
NS_HANDMADE_END
|
||||
|
||||
|
@ -1,6 +1,26 @@
|
||||
#include "platform/compiler_ignores.hpp"
|
||||
#include "platform/grime.hpp"
|
||||
/*
|
||||
Handmade Engine Translation Unit
|
||||
*/
|
||||
|
||||
#if Build_Unity
|
||||
# include "engine/engine.cpp"
|
||||
#endif
|
||||
#include "platform/compiler_ignores.hpp"
|
||||
|
||||
#include <math.h> // TEMP
|
||||
#include <stdio.h> // TEMP
|
||||
|
||||
#include "platform/grime.hpp"
|
||||
#include "platform/macros.hpp"
|
||||
#include "platform/generics.hpp"
|
||||
#include "platform/math_constants.hpp"
|
||||
#include "platform/types.hpp"
|
||||
#include "platform/intrinsics.hpp"
|
||||
#include "platform/strings.hpp"
|
||||
#include "platform/context.hpp"
|
||||
#include "platform/platform.hpp"
|
||||
|
||||
#include "engine.hpp"
|
||||
#include "engine_to_platform_api.hpp"
|
||||
|
||||
// Game layer headers
|
||||
#include "handmade.hpp"
|
||||
|
||||
#include "engine.cpp"
|
||||
|
@ -1,5 +1,27 @@
|
||||
#include "platform/compiler_ignores.hpp"
|
||||
/*
|
||||
Handmade Win32 Platform Translation Unit
|
||||
*/
|
||||
|
||||
#if Build_Unity
|
||||
#include "platform/win32/win32_platform.cpp"
|
||||
#endif
|
||||
#include "compiler_ignores.hpp"
|
||||
|
||||
#include <math.h> // TEMP
|
||||
#include <stdio.h> // TEMP
|
||||
|
||||
#include "grime.hpp"
|
||||
#include "macros.hpp"
|
||||
#include "generics.hpp"
|
||||
#include "math_constants.hpp"
|
||||
#include "types.hpp"
|
||||
#include "intrinsics.hpp"
|
||||
#include "strings.hpp"
|
||||
#include "context.hpp"
|
||||
#include "platform.hpp"
|
||||
|
||||
// Engine layer headers
|
||||
#include "engine/engine.hpp"
|
||||
#include "engine/engine_to_platform_api.hpp"
|
||||
#include "gen/engine_symbol_table.hpp"
|
||||
|
||||
#include "jsl.hpp" // Using this to get dualsense controllers
|
||||
#include "win32/win32.hpp"
|
||||
#include "win32/win32_platform.cpp"
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include "platform.hpp"
|
||||
|
||||
#pragma once
|
||||
|
||||
struct Context
|
||||
{
|
||||
|
47
project/platform/intrinsics.hpp
Normal file
47
project/platform/intrinsics.hpp
Normal 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;
|
||||
}
|
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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 }
|
||||
|
@ -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
|
||||
|
@ -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");
|
||||
|
@ -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
|
||||
|
@ -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 )
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user