#pragma once
#define WIN32_LEAN_AND_MEAN// 从 Windows 头文件中排除极少使用的内容
#include <Windows.h>
#include <stdio.h>
// C++库
#include <format>
#include <mutex>
#include <vector>
#include <string>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
// TinyXML库
#include <tinyxml2.h>
// lua库
#include <lua.hpp>
// MyDXRenderer
#include <MyDX11Renderer.h>
#include "MySDLInput.h"
#include "JoystickInput.h"
#include "MusicPlayer.h"
void UTF16ToUTF8(const wchar_t* wstr, std::vector<char>* outData, int* outLen = nullptr);
void UTF8ToUTF16(const char* str, std::vector<wchar_t>* outData, int* outLen = nullptr);
//压缩函数
void InitZLib();
void ZLibCompressData(std::vector<BYTE>* outData, size_t* outLen, const void* source, size_t sourceLen);//压缩数据
void ZLibUncompressData(std::vector<BYTE>* outData, size_t* outLen, const void* source, size_t sourceLen);//解压数据

void LoadResourceTexture(MyDX11Renderer* pRenderer, UINT res, ID3D11Texture2D** outTexture, ID3D11ShaderResourceView** outSRV, int* outW = nullptr, int* outH = nullptr);
float MyFar(float myFar);//计算随距离增加，眼睛中物体移动比例
//全局类
struct MyTextureAndSRV
{
	ID3D11Texture2D* pTexture = nullptr;
	ID3D11ShaderResourceView* pSRV = nullptr;
	int w = 0;
	int h = 0;
};
extern const float deg2rad;

int Random(int min, int max);
bool ParseInts(const wchar_t* str, std::vector<int>& outArr);
void Base64Encode(std::string& out, const void* data, size_t dataSize);
bool Base64Decode(std::vector<BYTE>& out, const char* base64Str);
float lerp(float start, float end, float t);

int GetSafePxa(int X, int Y, std::vector<LONG>& pxmData, std::vector<int>& pxaData, int pxmArr_w, int pxmArr_h);