windows stuff

This commit is contained in:
Tropical 2026-04-10 14:42:45 -07:00
parent 5c248704ac
commit 69b749a844
6 changed files with 34 additions and 20 deletions

View file

@ -87,7 +87,7 @@ subdir('targets/platform')
# MARK: platform configuration
if host_machine.system() == 'linux'
if host_machine.system() in ['linux', 'windows']
platform_fs_dep = platform_fs_std_dep
platform_game_dep = platform_game_stub_dep
platform_input_dep = platform_input_sdl2_dep
@ -99,7 +99,7 @@ if host_machine.system() == 'linux'
platform_storage_dep = platform_storage_stub_dep
platform_thread_dep = platform_thread_dep # standardized backend (for now)
app_platform_sources = files('targets/app/linux/main.cpp')
app_platform_sources = files('targets/app/desktop/main.cpp')
endif
subdir('targets/resources')

View file

@ -1,5 +1,5 @@
#pragma once
#include <flat_map>
#include <unordered_map>
#include <memory>
#include "ByteArrayTag.h"
@ -16,14 +16,14 @@
class CompoundTag : public Tag {
private:
std::flat_map<std::string, std::unique_ptr<Tag>> tags;
std::unordered_map<std::string, std::unique_ptr<Tag>> tags;
public:
CompoundTag() : Tag("") {}
CompoundTag(const std::string& name) : Tag(name) {}
void write(DataOutput* dos) {
for (auto&& [key, value] : tags) {
for (auto& [key, value] : tags) {
Tag::writeNamedTag(value.get(), dos);
}
dos->writeByte(Tag::TAG_End);
@ -49,7 +49,7 @@ public:
std::vector<Tag*> getAllTags() {
std::vector<Tag*> ret;
ret.reserve(tags.size());
for (auto&& [key, value] : tags) {
for (auto& [key, value] : tags) {
ret.push_back(value.get());
}
return ret;
@ -228,7 +228,7 @@ public:
Tag* copy() {
CompoundTag* tag = new CompoundTag(getName());
for (auto&& [key, value] : tags) {
for (auto& [key, value] : tags) {
tag->put(key, value->copy());
}
return tag;
@ -239,7 +239,7 @@ public:
CompoundTag* o = (CompoundTag*)obj;
if (tags.size() == o->tags.size()) {
for (auto&& [key, value] : tags) {
for (auto& [key, value] : tags) {
auto itFind = o->tags.find(key);
if (itFind == o->tags.end() ||
!value->equals(itFind->second.get())) {

View file

@ -9,16 +9,16 @@
#include "../../PlatformTypes.h"
#include "../InputConstants.h"
#include "SDL2/SDL.h"
#include "SDL2/SDL_events.h"
#include "SDL2/SDL_gamecontroller.h"
#include "SDL2/SDL_joystick.h"
#include "SDL2/SDL_keyboard.h"
#include "SDL2/SDL_mouse.h"
#include "SDL2/SDL_scancode.h"
#include "SDL2/SDL_stdinc.h"
#include "SDL2/SDL_video.h"
#include "SDL2/begin_code.h"
#include "SDL.h"
#include "SDL_events.h"
#include "SDL_gamecontroller.h"
#include "SDL_joystick.h"
#include "SDL_keyboard.h"
#include "SDL_mouse.h"
#include "SDL_scancode.h"
#include "SDL_stdinc.h"
#include "SDL_video.h"
#include "begin_code.h"
namespace platform_internal {
IPlatformInput& PlatformInput_get() {

View file

@ -1,10 +1,17 @@
#pragma once
// windows hack: Windows SDK OpenGL headers include WINGDIAPI in their declarations,
// which can only be found in the Windows API
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
#ifndef GL_GLEXT_PROTOTYPES
#define GL_GLEXT_PROTOTYPES 1
#endif
#include <GL/gl.h>
#include <GL/glext.h>
#include <SDL2/SDL.h>
// #include <GL/glext.h>
#include <cstdio>
#ifndef GL_ARRAY_BUFFER

View file

@ -1,5 +1,12 @@
#pragma once
// windows hack: Windows SDK OpenGL headers include WINGDIAPI in their declarations,
// which can only be found in the Windows API
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
#include <GL/gl.h>
#include <string.h>