mirror of
https://github.com/Relintai/sfw.git
synced 2024-12-20 21:06:49 +01:00
Fixed build on windows + mingw.
This commit is contained in:
parent
aee8f305f3
commit
f72f2a57df
1
.gitignore
vendored
1
.gitignore
vendored
@ -28,4 +28,5 @@ compile_commands.json
|
||||
*.o
|
||||
|
||||
game
|
||||
game.exe
|
||||
|
||||
|
141
compile_windows.sh
Normal file
141
compile_windows.sh
Normal file
@ -0,0 +1,141 @@
|
||||
|
||||
|
||||
#clang++ main.cpp -Wall -o3 -o ./bin/game -Ilibs/SDL2-linux/include -Llibs/SDL2-linux/lib -lSDL2 -lSDL2main
|
||||
|
||||
#g++ main.cpp -Wall -o3 -o ./bin/game -Ilibs/SDL2-linux/include -Llibs/SDL2-linux/lib -lSDL2 -lSDL2main
|
||||
|
||||
#g++ main.cpp shader.cpp material.cpp mesh.cpp mesh_instance.cpp mesh_utils.cpp texture.cpp camera.cpp render_core.cpp scene.cpp game_scene.cpp object_2d.cpp tile_map.cpp sprite.cpp \
|
||||
# -g -Wall -o3 -o ./bin/game $(pkg-config --cflags --libs sdl2 glew)
|
||||
|
||||
#g++ -Wall -fexceptions -I/usr/include/SDL2 -D_REENTRANT -g -Isfw -c sfw/core/aabb.cpp -o sfw/core/aabb.o
|
||||
|
||||
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/aabb.cpp -o sfw/core/aabb.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/basis.cpp -o sfw/core/basis.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/color.cpp -o sfw/core/color.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/face3.cpp -o sfw/core/face3.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/logger.cpp -o sfw/core/logger.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/math_funcs.cpp -o sfw/core/math_funcs.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/memory.cpp -o sfw/core/memory.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/pcg.cpp -o sfw/core/pcg.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/plane.cpp -o sfw/core/plane.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/projection.cpp -o sfw/core/projection.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/quaternion.cpp -o sfw/core/quaternion.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/random_pcg.cpp -o sfw/core/random_pcg.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/rect2.cpp -o sfw/core/rect2.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/rect2i.cpp -o sfw/core/rect2i.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/safe_refcount.cpp -o sfw/core/safe_refcount.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/transform_2d.cpp -o sfw/core/transform_2d.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/transform.cpp -o sfw/core/transform.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/ustring.cpp -o sfw/core/ustring.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/string_name.cpp -o sfw/core/string_name.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/vector2.cpp -o sfw/core/vector2.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/vector2i.cpp -o sfw/core/vector2i.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/vector3.cpp -o sfw/core/vector3.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/vector3i.cpp -o sfw/core/vector3i.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/vector4.cpp -o sfw/core/vector4.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/vector4i.cpp -o sfw/core/vector4i.o
|
||||
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/file_access.cpp -o sfw/core/file_access.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/dir_access.cpp -o sfw/core/dir_access.o
|
||||
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/pool_vector.cpp -o sfw/core/pool_vector.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/pool_allocator.cpp -o sfw/core/pool_allocator.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/mutex.cpp -o sfw/core/mutex.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/sfw_time.cpp -o sfw/core/SFWTime.o
|
||||
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/sfw_core.cpp -o sfw/core/sfw_core.o
|
||||
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/object/object.cpp -o sfw/object/object.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/object/reference.cpp -o sfw/object/reference.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/object/core_string_names.cpp -o sfw/object/core_string_names.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/object/variant.cpp -o sfw/object/variant.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/object/variant_op.cpp -o sfw/object/variant_op.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/object/psignal.cpp -o sfw/object/psignal.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/object/array.cpp -o sfw/object/array.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/object/dictionary.cpp -o sfw/object/dictionary.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/object/ref_ptr.cpp -o sfw/object/ref_ptr.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/object/resource.cpp -o sfw/object/resource.o
|
||||
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_core/application.cpp -o sfw/render_core/application.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_core/scene.cpp -o sfw/render_core/scene.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_core/app_window.cpp -o sfw/render_core/window.o
|
||||
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_core/shader.cpp -o sfw/render_core/shader.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_core/material.cpp -o sfw/render_core/material.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_core/mesh.cpp -o sfw/render_core/mesh.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_core/mesh_utils.cpp -o sfw/render_core/mesh_utils.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_core/texture.cpp -o sfw/render_core/texture.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_core/image.cpp -o sfw/render_core/image.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_core/render_state.cpp -o sfw/render_core/render_state.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_core/keyboard.cpp -o sfw/render_core/keyboard.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_core/input_event.cpp -o sfw/render_core/input_event.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_core/input_map.cpp -o sfw/render_core/input_map.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_core/input.cpp -o sfw/render_core/input.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_core/shortcut.cpp -o sfw/render_core/shortcut.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_core/font.cpp -o sfw/render_core/font.o
|
||||
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_core/color_material_2d.cpp -o sfw/render_core/color_material_2d.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_core/color_material.cpp -o sfw/render_core/color_material.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_core/colored_material.cpp -o sfw/render_core/colored_material.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_core/font_material.cpp -o sfw/render_core/font_material.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_core/texture_material_2d.cpp -o sfw/render_core/texture_material_2d.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_core/texture_material.cpp -o sfw/render_core/texture_material.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_core/transparent_texture_material.cpp -o sfw/render_core/transparent_texture_material.o
|
||||
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_immediate/renderer.cpp -o sfw/render_immediate/renderer.o
|
||||
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_objects/camera_3d.cpp -o sfw/render_objects/camera_3d.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_objects/object_3d.cpp -o sfw/render_objects/object_3d.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_objects/mesh_instance_3d.cpp -o sfw/render_objects/mesh_instance_3d.o
|
||||
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_objects/camera_2d.cpp -o sfw/render_objects/camera_2d.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_objects/mesh_instance_2d.cpp -o sfw/render_objects/mesh_instance_2d.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_objects/object_2d.cpp -o sfw/render_objects/object_2d.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_objects/sprite.cpp -o sfw/render_objects/sprite.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_objects/tile_map.cpp -o sfw/render_objects/tile_map.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_objects/text_2d.cpp -o sfw/render_objects/text_2d.o
|
||||
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/game_scene.cpp -o sfw/game_scene.o
|
||||
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/main.cpp -o sfw/main.o
|
||||
|
||||
|
||||
ccache g++ -Wall \
|
||||
-D_REENTRANT -g sfw/core/aabb.o sfw/core/basis.o sfw/core/color.o \
|
||||
sfw/core/face3.o sfw/core/logger.o sfw/core/math_funcs.o \
|
||||
sfw/core/memory.o sfw/core/pcg.o sfw/core/plane.o sfw/core/projection.o sfw/core/quaternion.o sfw/core/random_pcg.o \
|
||||
sfw/core/rect2.o sfw/core/rect2i.o sfw/core/safe_refcount.o sfw/core/transform_2d.o sfw/core/transform.o \
|
||||
sfw/core/ustring.o sfw/core/string_name.o \
|
||||
sfw/core/vector2.o sfw/core/vector2i.o sfw/core/vector3.o \
|
||||
sfw/core/vector3i.o sfw/core/vector4.o sfw/core/vector4i.o \
|
||||
sfw/core/pool_vector.o sfw/core/pool_allocator.o sfw/core/mutex.o sfw/core/SFWTime.o \
|
||||
sfw/core/dir_access.o sfw/core/file_access.o \
|
||||
sfw/core/sfw_core.o \
|
||||
sfw/object/object.o sfw/object/reference.o sfw/object/core_string_names.o \
|
||||
sfw/object/variant.o sfw/object/variant_op.o sfw/object/psignal.o \
|
||||
sfw/object/array.o sfw/object/dictionary.o sfw/object/ref_ptr.o \
|
||||
sfw/object/resource.o \
|
||||
sfw/render_core/image.o sfw/render_core/render_state.o \
|
||||
sfw/render_core/application.o sfw/render_core/scene.o sfw/render_core/window.o \
|
||||
sfw/render_core/shader.o sfw/render_core/material.o sfw/render_core/mesh.o \
|
||||
sfw/render_core/mesh_utils.o sfw/render_core/texture.o \
|
||||
sfw/render_core/input_event.o sfw/render_core/input_map.o \
|
||||
sfw/render_core/input.o sfw/render_core/shortcut.o \
|
||||
sfw/render_core/keyboard.o sfw/render_core/font.o \
|
||||
sfw/render_core/color_material_2d.o sfw/render_core/color_material.o \
|
||||
sfw/render_core/colored_material.o sfw/render_core/font_material.o \
|
||||
sfw/render_core/texture_material_2d.o sfw/render_core/texture_material.o \
|
||||
sfw/render_core/transparent_texture_material.o \
|
||||
sfw/render_immediate/renderer.o \
|
||||
sfw/render_objects/camera_3d.o sfw/render_objects/object_3d.o sfw/render_objects/mesh_instance_3d.o \
|
||||
sfw/render_objects/object_2d.o \
|
||||
sfw/render_objects/sprite.o sfw/render_objects/tile_map.o \
|
||||
sfw/render_objects/camera_2d.o sfw/render_objects/mesh_instance_2d.o \
|
||||
sfw/render_objects/text_2d.o \
|
||||
sfw/game_scene.o sfw/main.o \
|
||||
-lm -lpthread -lwinmm -lopengl32 -lkernel32 -lole32 -loleaut32 -luser32 \
|
||||
-lgdi32 -lIPHLPAPI -lShlwapi -lwsock32 -lWs2_32 -lshell32 -ladvapi32 -ldinput8 -ldxguid \
|
||||
-limm32 -lbcrypt -lAvrt -ldwmapi \
|
||||
-o game
|
||||
|
||||
#export args="-lm -ldl -lpthread -lX11 -w -Iengine/ $args"
|
@ -78,9 +78,10 @@ struct DirAccessWindowsPrivate {
|
||||
|
||||
// CreateFolderAsync
|
||||
|
||||
Error DirAccessWindows::list_dir_begin() {
|
||||
Error DirAccess::list_dir_begin(bool skip_specials) {
|
||||
_cisdir = false;
|
||||
_cishidden = false;
|
||||
_skip_specials = skip_specials;
|
||||
|
||||
list_dir_end();
|
||||
p->h = FindFirstFileExW((LPCWSTR)(String(current_dir + "\\*").utf16().get_data()), FindExInfoStandard, &p->fu, FindExSearchNameMatch, NULL, 0);
|
||||
@ -88,7 +89,7 @@ Error DirAccessWindows::list_dir_begin() {
|
||||
return (p->h == INVALID_HANDLE_VALUE) ? ERR_CANT_OPEN : OK;
|
||||
}
|
||||
|
||||
String DirAccessWindows::get_next() {
|
||||
String DirAccess::get_next() {
|
||||
if (p->h == INVALID_HANDLE_VALUE) {
|
||||
return "";
|
||||
}
|
||||
@ -106,24 +107,32 @@ String DirAccessWindows::get_next() {
|
||||
return name;
|
||||
}
|
||||
|
||||
bool DirAccessWindows::current_is_dir() const {
|
||||
bool DirAccess::current_is_dir() const {
|
||||
return _cisdir;
|
||||
}
|
||||
|
||||
bool DirAccessWindows::current_is_hidden() const {
|
||||
bool DirAccess::current_is_hidden() const {
|
||||
return _cishidden;
|
||||
}
|
||||
|
||||
void DirAccessWindows::list_dir_end() {
|
||||
bool DirAccess::current_is_file() const {
|
||||
return !_cisdir;
|
||||
}
|
||||
|
||||
bool DirAccess::current_is_special_dir() const {
|
||||
return _cisspecial;
|
||||
}
|
||||
|
||||
void DirAccess::list_dir_end() {
|
||||
if (p->h != INVALID_HANDLE_VALUE) {
|
||||
FindClose(p->h);
|
||||
p->h = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
}
|
||||
int DirAccessWindows::get_drive_count() {
|
||||
int DirAccess::get_drive_count() {
|
||||
return drive_count;
|
||||
}
|
||||
String DirAccessWindows::get_drive(int p_drive) {
|
||||
String DirAccess::get_drive(int p_drive) {
|
||||
if (p_drive < 0 || p_drive >= drive_count) {
|
||||
return "";
|
||||
}
|
||||
@ -131,11 +140,9 @@ String DirAccessWindows::get_drive(int p_drive) {
|
||||
return String::chr(drives[p_drive]) + ":";
|
||||
}
|
||||
|
||||
Error DirAccessWindows::change_dir(String p_dir) {
|
||||
Error DirAccess::change_dir(String p_dir) {
|
||||
GLOBAL_LOCK_FUNCTION
|
||||
|
||||
p_dir = fix_path(p_dir);
|
||||
|
||||
WCHAR real_current_dir_name[2048];
|
||||
GetCurrentDirectoryW(2048, real_current_dir_name);
|
||||
String prev_dir = String::utf16((const char16_t *)real_current_dir_name);
|
||||
@ -143,7 +150,7 @@ Error DirAccessWindows::change_dir(String p_dir) {
|
||||
SetCurrentDirectoryW((LPCWSTR)(current_dir.utf16().get_data()));
|
||||
bool worked = (SetCurrentDirectoryW((LPCWSTR)(p_dir.utf16().get_data())) != 0);
|
||||
|
||||
String base = _get_root_path();
|
||||
String base;
|
||||
if (base != "") {
|
||||
GetCurrentDirectoryW(2048, real_current_dir_name);
|
||||
String new_dir = String::utf16((const char16_t *)real_current_dir_name).replace("\\", "/");
|
||||
@ -163,11 +170,9 @@ Error DirAccessWindows::change_dir(String p_dir) {
|
||||
return worked ? OK : ERR_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Error DirAccessWindows::make_dir(String p_dir) {
|
||||
Error DirAccess::make_dir(String p_dir) {
|
||||
GLOBAL_LOCK_FUNCTION
|
||||
|
||||
p_dir = fix_path(p_dir);
|
||||
|
||||
if (p_dir.is_rel_path()) {
|
||||
p_dir = current_dir.plus_file(p_dir);
|
||||
}
|
||||
@ -197,42 +202,38 @@ Error DirAccessWindows::make_dir(String p_dir) {
|
||||
return ERR_CANT_CREATE;
|
||||
}
|
||||
|
||||
String DirAccessWindows::get_current_dir() {
|
||||
String base = _get_root_path();
|
||||
String DirAccess::get_current_dir() {
|
||||
String base;
|
||||
if (base != "") {
|
||||
String bd = current_dir.replace("\\", "/").replace_first(base, "");
|
||||
if (bd.begins_with("/")) {
|
||||
return _get_root_string() + bd.substr(1, bd.length());
|
||||
return bd.substr(1, bd.length());
|
||||
} else {
|
||||
return _get_root_string() + bd;
|
||||
return bd;
|
||||
}
|
||||
}
|
||||
|
||||
return current_dir;
|
||||
}
|
||||
|
||||
String DirAccessWindows::get_current_dir_without_drive() {
|
||||
String DirAccess::get_current_dir_without_drive() {
|
||||
String dir = get_current_dir();
|
||||
|
||||
if (_get_root_string() == "") {
|
||||
int p = current_dir.find(":");
|
||||
if (p != -1) {
|
||||
dir = dir.right(p + 1);
|
||||
}
|
||||
int p = current_dir.find(":");
|
||||
if (p != -1) {
|
||||
dir = dir.right(p + 1);
|
||||
}
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
||||
bool DirAccessWindows::file_exists(String p_file) {
|
||||
bool DirAccess::file_exists(String p_file) {
|
||||
GLOBAL_LOCK_FUNCTION
|
||||
|
||||
if (!p_file.is_abs_path()) {
|
||||
p_file = get_current_dir().plus_file(p_file);
|
||||
}
|
||||
|
||||
p_file = fix_path(p_file);
|
||||
|
||||
DWORD fileAttr;
|
||||
|
||||
fileAttr = GetFileAttributesW((LPCWSTR)(p_file.utf16().get_data()));
|
||||
@ -243,13 +244,12 @@ bool DirAccessWindows::file_exists(String p_file) {
|
||||
return !(fileAttr & FILE_ATTRIBUTE_DIRECTORY);
|
||||
}
|
||||
|
||||
bool DirAccessWindows::dir_exists(String p_dir) {
|
||||
bool DirAccess::dir_exists(String p_dir) {
|
||||
GLOBAL_LOCK_FUNCTION
|
||||
|
||||
if (p_dir.is_rel_path())
|
||||
if (p_dir.is_rel_path()) {
|
||||
p_dir = get_current_dir().plus_file(p_dir);
|
||||
|
||||
p_dir = fix_path(p_dir);
|
||||
}
|
||||
|
||||
DWORD fileAttr;
|
||||
|
||||
@ -261,19 +261,15 @@ bool DirAccessWindows::dir_exists(String p_dir) {
|
||||
return (fileAttr & FILE_ATTRIBUTE_DIRECTORY);
|
||||
}
|
||||
|
||||
Error DirAccessWindows::rename(String p_path, String p_new_path) {
|
||||
Error DirAccess::rename(String p_path, String p_new_path) {
|
||||
if (p_path.is_rel_path()) {
|
||||
p_path = get_current_dir().plus_file(p_path);
|
||||
}
|
||||
|
||||
p_path = fix_path(p_path);
|
||||
|
||||
if (p_new_path.is_rel_path()) {
|
||||
p_new_path = get_current_dir().plus_file(p_new_path);
|
||||
}
|
||||
|
||||
p_new_path = fix_path(p_new_path);
|
||||
|
||||
// If we're only changing file name case we need to do a little juggling
|
||||
if (p_path.to_lower() == p_new_path.to_lower()) {
|
||||
if (dir_exists(p_path)) {
|
||||
@ -284,7 +280,7 @@ Error DirAccessWindows::rename(String p_path, String p_new_path) {
|
||||
// The path is a file; juggle
|
||||
WCHAR tmpfile[MAX_PATH];
|
||||
|
||||
if (!GetTempFileNameW((LPCWSTR)(fix_path(get_current_dir()).utf16().get_data()), NULL, 0, tmpfile)) {
|
||||
if (!GetTempFileNameW((LPCWSTR)(get_current_dir().utf16().get_data()), NULL, 0, tmpfile)) {
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
@ -306,13 +302,11 @@ Error DirAccessWindows::rename(String p_path, String p_new_path) {
|
||||
}
|
||||
}
|
||||
|
||||
Error DirAccessWindows::remove(String p_path) {
|
||||
Error DirAccess::remove(String p_path) {
|
||||
if (p_path.is_rel_path()) {
|
||||
p_path = get_current_dir().plus_file(p_path);
|
||||
}
|
||||
|
||||
p_path = fix_path(p_path);
|
||||
|
||||
DWORD fileAttr;
|
||||
|
||||
fileAttr = GetFileAttributesW((LPCWSTR)(p_path.utf16().get_data()));
|
||||
@ -328,7 +322,7 @@ Error DirAccessWindows::remove(String p_path) {
|
||||
}
|
||||
/*
|
||||
|
||||
FileType DirAccessWindows::get_file_type(const String& p_file) const {
|
||||
FileType DirAccess::get_file_type(const String& p_file) const {
|
||||
WCHAR real_current_dir_name[2048];
|
||||
GetCurrentDirectoryW(2048, real_current_dir_name);
|
||||
String prev_dir = Strong::utf16((const char16_t *)real_current_dir_name);
|
||||
@ -351,7 +345,7 @@ FileType DirAccessWindows::get_file_type(const String& p_file) const {
|
||||
}
|
||||
*/
|
||||
|
||||
uint64_t DirAccessWindows::get_space_left() {
|
||||
uint64_t DirAccess::get_space_left() {
|
||||
uint64_t bytes = 0;
|
||||
|
||||
if (!GetDiskFreeSpaceEx(NULL, (PULARGE_INTEGER)&bytes, NULL, NULL)) {
|
||||
@ -362,8 +356,8 @@ uint64_t DirAccessWindows::get_space_left() {
|
||||
return bytes;
|
||||
}
|
||||
|
||||
String DirAccessWindows::get_filesystem_type() const {
|
||||
String path = fix_path(const_cast<DirAccessWindows *>(this)->get_current_dir());
|
||||
String DirAccess::get_filesystem_type() const {
|
||||
String path = const_cast<DirAccess *>(this)->get_current_dir();
|
||||
|
||||
if (path.is_network_share_path()) {
|
||||
return "Network Share";
|
||||
@ -393,7 +387,27 @@ String DirAccessWindows::get_filesystem_type() const {
|
||||
ERR_FAIL_V("");
|
||||
}
|
||||
|
||||
DirAccessWindows::DirAccessWindows() {
|
||||
int DirAccess::get_current_drive() {
|
||||
String path = get_current_dir().to_lower();
|
||||
for (int i = 0; i < get_drive_count(); i++) {
|
||||
String d = get_drive(i).to_lower();
|
||||
if (path.begins_with(d)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool DirAccess::drives_are_shortcuts() {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint64_t DirAccess::get_modified_time(String p_file) {
|
||||
return 0;
|
||||
};
|
||||
|
||||
DirAccess::DirAccess() {
|
||||
p = memnew(DirAccessWindowsPrivate);
|
||||
p->h = INVALID_HANDLE_VALUE;
|
||||
current_dir = ".";
|
||||
@ -420,7 +434,7 @@ DirAccessWindows::DirAccessWindows() {
|
||||
#endif
|
||||
}
|
||||
|
||||
DirAccessWindows::~DirAccessWindows() {
|
||||
DirAccess::~DirAccess() {
|
||||
list_dir_end();
|
||||
|
||||
memdelete(p);
|
||||
@ -836,6 +850,10 @@ bool DirAccess::is_hidden(const String &p_name) {
|
||||
return p_name != "." && p_name != ".." && p_name.begins_with(".");
|
||||
}
|
||||
|
||||
String DirAccess::get_current_dir_without_drive() {
|
||||
return get_current_dir();
|
||||
}
|
||||
|
||||
DirAccess::DirAccess() {
|
||||
dir_stream = NULL;
|
||||
_cisdir = false;
|
||||
@ -864,28 +882,6 @@ DirAccess::~DirAccess() {
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
int DirAccess::get_current_drive() {
|
||||
String path = get_current_dir().to_lower();
|
||||
for (int i = 0; i < get_drive_count(); i++) {
|
||||
String d = get_drive(i).to_lower();
|
||||
if (path.begins_with(d)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool DirAccess::drives_are_shortcuts() {
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
String DirAccess::get_current_dir_without_drive() {
|
||||
return get_current_dir();
|
||||
}
|
||||
|
||||
static Error _erase_recursive(DirAccess *da) {
|
||||
List<String> dirs;
|
||||
List<String> files;
|
||||
@ -960,11 +956,7 @@ Error DirAccess::make_dir_recursive(String p_dir) {
|
||||
|
||||
String base;
|
||||
|
||||
if (full_dir.begins_with("res://")) {
|
||||
base = "res://";
|
||||
} else if (full_dir.begins_with("user://")) {
|
||||
base = "user://";
|
||||
} else if (full_dir.is_network_share_path()) {
|
||||
if (full_dir.is_network_share_path()) {
|
||||
int pos = full_dir.find("/", 2);
|
||||
ERR_FAIL_COND_V(pos < 0, ERR_INVALID_PARAMETER);
|
||||
pos = full_dir.find("/", pos + 1);
|
||||
|
@ -101,6 +101,7 @@ protected:
|
||||
|
||||
bool _cisdir;
|
||||
bool _cishidden;
|
||||
bool _cisspecial;
|
||||
#else
|
||||
String current_dir;
|
||||
DIR *dir_stream;
|
||||
|
@ -29,6 +29,8 @@
|
||||
#define S_ISREG(m) ((m)&_S_IFREG)
|
||||
#endif
|
||||
|
||||
#include "core/sfw_time.h"
|
||||
|
||||
#else
|
||||
|
||||
#include <stdio.h>
|
||||
@ -57,7 +59,7 @@
|
||||
|
||||
#if defined(_WIN64) || defined(_WIN32)
|
||||
|
||||
void FileAccessWindows::check_errors() const {
|
||||
void FileAccess::check_errors() const {
|
||||
ERR_FAIL_COND(!f);
|
||||
|
||||
if (feof(f)) {
|
||||
@ -65,7 +67,7 @@ void FileAccessWindows::check_errors() const {
|
||||
}
|
||||
}
|
||||
|
||||
Error FileAccessWindows::_open(const String &p_path, int p_mode_flags) {
|
||||
Error FileAccess::_open(const String &p_path, int p_mode_flags) {
|
||||
path_src = p_path;
|
||||
path = fix_path(p_path);
|
||||
|
||||
@ -145,7 +147,7 @@ Error FileAccessWindows::_open(const String &p_path, int p_mode_flags) {
|
||||
}
|
||||
}
|
||||
|
||||
void FileAccessWindows::close() {
|
||||
void FileAccess::close() {
|
||||
if (!f) {
|
||||
return;
|
||||
}
|
||||
@ -178,7 +180,7 @@ void FileAccessWindows::close() {
|
||||
}
|
||||
if (rename_error) {
|
||||
attempts--;
|
||||
OS::get_singleton()->delay_usec(100000); // wait 100msec and try again
|
||||
SFWTime::sleep_us(100000); // wait 100msec and try again
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,19 +196,19 @@ void FileAccessWindows::close() {
|
||||
}
|
||||
}
|
||||
|
||||
String FileAccessWindows::get_path() const {
|
||||
String FileAccess::get_path() const {
|
||||
return path_src;
|
||||
}
|
||||
|
||||
String FileAccessWindows::get_path_absolute() const {
|
||||
String FileAccess::get_path_absolute() const {
|
||||
return path;
|
||||
}
|
||||
|
||||
bool FileAccessWindows::is_open() const {
|
||||
bool FileAccess::is_open() const {
|
||||
return (f != NULL);
|
||||
}
|
||||
|
||||
void FileAccessWindows::seek(uint64_t p_position) {
|
||||
void FileAccess::seek(uint64_t p_position) {
|
||||
ERR_FAIL_COND(!f);
|
||||
|
||||
last_error = OK;
|
||||
@ -218,7 +220,7 @@ void FileAccessWindows::seek(uint64_t p_position) {
|
||||
prev_op = 0;
|
||||
}
|
||||
|
||||
void FileAccessWindows::seek_end(int64_t p_position) {
|
||||
void FileAccess::seek_end(int64_t p_position) {
|
||||
ERR_FAIL_COND(!f);
|
||||
|
||||
if (_fseeki64(f, p_position, SEEK_END)) {
|
||||
@ -228,7 +230,7 @@ void FileAccessWindows::seek_end(int64_t p_position) {
|
||||
prev_op = 0;
|
||||
}
|
||||
|
||||
uint64_t FileAccessWindows::get_position() const {
|
||||
uint64_t FileAccess::get_position() const {
|
||||
int64_t aux_position = _ftelli64(f);
|
||||
|
||||
if (aux_position < 0) {
|
||||
@ -238,7 +240,7 @@ uint64_t FileAccessWindows::get_position() const {
|
||||
return aux_position;
|
||||
}
|
||||
|
||||
uint64_t FileAccessWindows::get_len() const {
|
||||
uint64_t FileAccess::get_len() const {
|
||||
ERR_FAIL_COND_V(!f, 0);
|
||||
|
||||
uint64_t pos = get_position();
|
||||
@ -249,12 +251,12 @@ uint64_t FileAccessWindows::get_len() const {
|
||||
return size;
|
||||
}
|
||||
|
||||
bool FileAccessWindows::eof_reached() const {
|
||||
bool FileAccess::eof_reached() const {
|
||||
check_errors();
|
||||
return last_error == ERR_FILE_EOF;
|
||||
}
|
||||
|
||||
uint8_t FileAccessWindows::get_8() const {
|
||||
uint8_t FileAccess::get_8() const {
|
||||
ERR_FAIL_COND_V(!f, 0);
|
||||
if (flags == READ_WRITE || flags == WRITE_READ) {
|
||||
if (prev_op == WRITE) {
|
||||
@ -271,7 +273,7 @@ uint8_t FileAccessWindows::get_8() const {
|
||||
return b;
|
||||
}
|
||||
|
||||
uint64_t FileAccessWindows::get_buffer(uint8_t *p_dst, uint64_t p_length) const {
|
||||
uint64_t FileAccess::get_buffer(uint8_t *p_dst, uint64_t p_length) const {
|
||||
ERR_FAIL_COND_V(!p_dst && p_length > 0, -1);
|
||||
ERR_FAIL_COND_V(!f, -1);
|
||||
|
||||
@ -286,11 +288,11 @@ uint64_t FileAccessWindows::get_buffer(uint8_t *p_dst, uint64_t p_length) const
|
||||
return read;
|
||||
};
|
||||
|
||||
Error FileAccessWindows::get_error() const {
|
||||
Error FileAccess::get_error() const {
|
||||
return last_error;
|
||||
}
|
||||
|
||||
void FileAccessWindows::flush() {
|
||||
void FileAccess::flush() {
|
||||
ERR_FAIL_COND(!f);
|
||||
fflush(f);
|
||||
|
||||
@ -299,7 +301,7 @@ void FileAccessWindows::flush() {
|
||||
}
|
||||
}
|
||||
|
||||
void FileAccessWindows::store_8(uint8_t p_dest) {
|
||||
void FileAccess::store_8(uint8_t p_dest) {
|
||||
ERR_FAIL_COND(!f);
|
||||
if (flags == READ_WRITE || flags == WRITE_READ) {
|
||||
if (prev_op == READ) {
|
||||
@ -312,7 +314,7 @@ void FileAccessWindows::store_8(uint8_t p_dest) {
|
||||
fwrite(&p_dest, 1, 1, f);
|
||||
}
|
||||
|
||||
void FileAccessWindows::store_buffer(const uint8_t *p_src, uint64_t p_length) {
|
||||
void FileAccess::store_buffer(const uint8_t *p_src, uint64_t p_length) {
|
||||
ERR_FAIL_COND(!f);
|
||||
ERR_FAIL_COND(!p_src && p_length > 0);
|
||||
|
||||
@ -327,7 +329,7 @@ void FileAccessWindows::store_buffer(const uint8_t *p_src, uint64_t p_length) {
|
||||
ERR_FAIL_COND(fwrite(p_src, 1, p_length, f) != (size_t)p_length);
|
||||
}
|
||||
|
||||
bool FileAccessWindows::file_exists(const String &p_name) {
|
||||
bool FileAccess::file_exists(const String &p_name) {
|
||||
String filename = fix_path(p_name);
|
||||
|
||||
FILE *g = _wfsopen((LPCWSTR)(filename.utf16().get_data()), L"rb", _SH_DENYNO);
|
||||
@ -340,7 +342,7 @@ bool FileAccessWindows::file_exists(const String &p_name) {
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t FileAccessWindows::_get_modified_time(const String &p_file) {
|
||||
uint64_t FileAccess::_get_modified_time(const String &p_file) {
|
||||
String file = fix_path(p_file);
|
||||
if (file.ends_with("/") && file != "/")
|
||||
file = file.substr(0, file.length() - 1);
|
||||
@ -351,26 +353,26 @@ uint64_t FileAccessWindows::_get_modified_time(const String &p_file) {
|
||||
if (rv == 0) {
|
||||
return st.st_mtime;
|
||||
} else {
|
||||
print_verbose("Failed to get modified time for: " + p_file + "");
|
||||
LOG_TRACE("Failed to get modified time for: " + p_file + "");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t FileAccessWindows::_get_unix_permissions(const String &p_file) {
|
||||
uint32_t FileAccess::_get_unix_permissions(const String &p_file) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Error FileAccessWindows::_set_unix_permissions(const String &p_file, uint32_t p_permissions) {
|
||||
Error FileAccess::_set_unix_permissions(const String &p_file, uint32_t p_permissions) {
|
||||
return ERR_UNAVAILABLE;
|
||||
}
|
||||
|
||||
FileAccessWindows::FileAccessWindows() :
|
||||
FileAccess::FileAccess() :
|
||||
f(NULL),
|
||||
flags(0),
|
||||
prev_op(0),
|
||||
last_error(OK) {
|
||||
}
|
||||
FileAccessWindows::~FileAccessWindows() {
|
||||
FileAccess::~FileAccess() {
|
||||
close();
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,10 @@
|
||||
//--STRIP
|
||||
|
||||
#if defined(_WIN64) || defined(_WIN32)
|
||||
|
||||
// Mingw
|
||||
struct _iobuf;
|
||||
typedef struct _iobuf FILE;
|
||||
#else
|
||||
struct _IO_FILE;
|
||||
typedef struct _IO_FILE FILE;
|
||||
|
0
sfw/core/inet_address.cpp
Executable file → Normal file
0
sfw/core/inet_address.cpp
Executable file → Normal file
2
sfw/core/inet_address.h
Executable file → Normal file
2
sfw/core/inet_address.h
Executable file → Normal file
@ -42,8 +42,8 @@ using uint16_t = unsigned short;
|
||||
#endif
|
||||
|
||||
//--STRIP
|
||||
#include "int_types.h"
|
||||
#include "core/ustring.h"
|
||||
#include "int_types.h"
|
||||
//--STRIP
|
||||
|
||||
class InetAddress {
|
||||
|
@ -10,6 +10,12 @@
|
||||
#include <ctime>
|
||||
//--STRIP
|
||||
|
||||
#if defined(_WIN64) || defined(_WIN32)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <winnt.h>
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
uint64_t SFWTime::time_gpu() {
|
||||
GLint64 t = 123456789;
|
||||
|
0
sfw/core/socket.cpp
Executable file → Normal file
0
sfw/core/socket.cpp
Executable file → Normal file
0
sfw/core/socket.h
Executable file → Normal file
0
sfw/core/socket.h
Executable file → Normal file
@ -18678,7 +18678,7 @@ WCHAR* _glfwCreateWideStringFromUTF8Win32(const char* source)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
target = calloc(count, sizeof(WCHAR));
|
||||
target = (WCHAR*)calloc(count, sizeof(WCHAR));
|
||||
|
||||
if (!MultiByteToWideChar(CP_UTF8, 0, source, -1, target, count))
|
||||
{
|
||||
@ -18706,7 +18706,7 @@ char* _glfwCreateUTF8FromWideStringWin32(const WCHAR* source)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
target = calloc(size, 1);
|
||||
target = (char*)calloc(size, 1);
|
||||
|
||||
if (!WideCharToMultiByte(CP_UTF8, 0, source, -1, target, size, NULL, NULL))
|
||||
{
|
||||
@ -19095,8 +19095,8 @@ static const char* getDeviceDescription(const XINPUT_CAPABILITIES* xic)
|
||||
//
|
||||
static int compareJoystickObjects(const void* first, const void* second)
|
||||
{
|
||||
const _GLFWjoyobjectWin32* fo = first;
|
||||
const _GLFWjoyobjectWin32* so = second;
|
||||
const _GLFWjoyobjectWin32* fo = (const _GLFWjoyobjectWin32*)first;
|
||||
const _GLFWjoyobjectWin32* so = (const _GLFWjoyobjectWin32*)second;
|
||||
|
||||
if (fo->type != so->type)
|
||||
return fo->type - so->type;
|
||||
@ -19116,7 +19116,7 @@ static GLFWbool supportsXInput(const GUID* guid)
|
||||
if (GetRawInputDeviceList(NULL, &count, sizeof(RAWINPUTDEVICELIST)) != 0)
|
||||
return GLFW_FALSE;
|
||||
|
||||
ridl = calloc(count, sizeof(RAWINPUTDEVICELIST));
|
||||
ridl = (RAWINPUTDEVICELIST*)calloc(count, sizeof(RAWINPUTDEVICELIST));
|
||||
|
||||
if (GetRawInputDeviceList(ridl, &count, sizeof(RAWINPUTDEVICELIST)) == (UINT) -1)
|
||||
{
|
||||
@ -19191,7 +19191,7 @@ static void closeJoystick(_GLFWjoystick* js)
|
||||
static BOOL CALLBACK deviceObjectCallback(const DIDEVICEOBJECTINSTANCEW* doi,
|
||||
void* user)
|
||||
{
|
||||
_GLFWobjenumWin32* data = user;
|
||||
_GLFWobjenumWin32* data = (_GLFWobjenumWin32*)user;
|
||||
_GLFWjoyobjectWin32* object = data->objects + data->objectCount;
|
||||
|
||||
if (DIDFT_GETTYPE(doi->dwType) & DIDFT_AXIS)
|
||||
@ -19285,7 +19285,7 @@ static BOOL CALLBACK deviceCallback(const DIDEVICEINSTANCE* di, void* user)
|
||||
return DIENUM_CONTINUE;
|
||||
|
||||
if (FAILED(IDirectInput8_CreateDevice(_glfw.win32.dinput8.api,
|
||||
&di->guidInstance,
|
||||
di->guidInstance,
|
||||
&device,
|
||||
NULL)))
|
||||
{
|
||||
@ -19333,7 +19333,7 @@ static BOOL CALLBACK deviceCallback(const DIDEVICEINSTANCE* di, void* user)
|
||||
|
||||
memset(&data, 0, sizeof(data));
|
||||
data.device = device;
|
||||
data.objects = calloc(dc.dwAxes + (size_t) dc.dwButtons + dc.dwPOVs,
|
||||
data.objects = (_GLFWjoyobjectWin32*)calloc(dc.dwAxes + (size_t) dc.dwButtons + dc.dwPOVs,
|
||||
sizeof(_GLFWjoyobjectWin32));
|
||||
|
||||
if (FAILED(IDirectInputDevice8_EnumObjects(device,
|
||||
@ -19416,7 +19416,7 @@ void _glfwInitJoysticksWin32(void)
|
||||
{
|
||||
if (FAILED(DirectInput8Create(GetModuleHandleW(NULL),
|
||||
DIRECTINPUT_VERSION,
|
||||
&IID_IDirectInput8W,
|
||||
IID_IDirectInput8W,
|
||||
(void**) &_glfw.win32.dinput8.api,
|
||||
NULL)))
|
||||
{
|
||||
@ -19827,7 +19827,7 @@ void _glfwPollMonitorsWin32(void)
|
||||
disconnectedCount = _glfw.monitorCount;
|
||||
if (disconnectedCount)
|
||||
{
|
||||
disconnected = calloc(_glfw.monitorCount, sizeof(_GLFWmonitor*));
|
||||
disconnected = (_GLFWmonitor**)calloc(_glfw.monitorCount, sizeof(_GLFWmonitor*));
|
||||
memcpy(disconnected,
|
||||
_glfw.monitors,
|
||||
_glfw.monitorCount * sizeof(_GLFWmonitor*));
|
||||
@ -20145,7 +20145,7 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count)
|
||||
if (!*count)
|
||||
{
|
||||
// HACK: Report the current mode if no valid modes were found
|
||||
result = calloc(1, sizeof(GLFWvidmode));
|
||||
result = (GLFWvidmode*)calloc(1, sizeof(GLFWvidmode));
|
||||
_glfwPlatformGetVideoMode(monitor, result);
|
||||
*count = 1;
|
||||
}
|
||||
@ -20954,7 +20954,7 @@ static void maximizeWindowManually(_GLFWwindow* window)
|
||||
static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
||||
WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
_GLFWwindow* window = GetPropW(hWnd, L"GLFW");
|
||||
_GLFWwindow* window = (_GLFWwindow*)GetPropW(hWnd, L"GLFW");
|
||||
if (!window)
|
||||
{
|
||||
// This is the message handling for the hidden helper window
|
||||
@ -20967,7 +20967,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
||||
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
|
||||
{
|
||||
const CREATESTRUCTW* cs = (const CREATESTRUCTW*) lParam;
|
||||
const _GLFWwndconfig* wndconfig = cs->lpCreateParams;
|
||||
const _GLFWwndconfig* wndconfig = (const _GLFWwndconfig*)cs->lpCreateParams;
|
||||
|
||||
// On per-monitor DPI aware V1 systems, only enable
|
||||
// non-client scaling for windows that scale the client area
|
||||
@ -21338,7 +21338,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
||||
if (size > (UINT) _glfw.win32.rawInputSize)
|
||||
{
|
||||
free(_glfw.win32.rawInput);
|
||||
_glfw.win32.rawInput = calloc(size, 1);
|
||||
_glfw.win32.rawInput = (RAWINPUT*)calloc(size, 1);
|
||||
_glfw.win32.rawInputSize = size;
|
||||
}
|
||||
|
||||
@ -21638,7 +21638,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
||||
int i;
|
||||
|
||||
const int count = DragQueryFileW(drop, 0xffffffff, NULL, 0);
|
||||
char** paths = calloc(count, sizeof(char*));
|
||||
char** paths = (char**)calloc(count, sizeof(char*));
|
||||
|
||||
// Move the mouse to the position of the drop
|
||||
DragQueryPoint(drop, &pt);
|
||||
@ -21647,7 +21647,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
const UINT length = DragQueryFileW(drop, i, NULL, 0);
|
||||
WCHAR* buffer = calloc((size_t) length + 1, sizeof(WCHAR));
|
||||
WCHAR* buffer = (WCHAR*)calloc((size_t) length + 1, sizeof(WCHAR));
|
||||
|
||||
DragQueryFileW(drop, i, buffer, length + 1);
|
||||
paths[i] = _glfwCreateUTF8FromWideStringWin32(buffer);
|
||||
@ -21836,13 +21836,13 @@ GLFWbool _glfwRegisterWindowClassWin32(void)
|
||||
wc.lpszClassName = _GLFW_WNDCLASSNAME;
|
||||
|
||||
// Load user-provided icon if available
|
||||
wc.hIcon = LoadImageW(GetModuleHandleW(NULL),
|
||||
wc.hIcon = (HICON)LoadImageW(GetModuleHandleW(NULL),
|
||||
L"GLFW_ICON", IMAGE_ICON,
|
||||
0, 0, LR_DEFAULTSIZE | LR_SHARED);
|
||||
if (!wc.hIcon)
|
||||
{
|
||||
// No user-provided icon found, load default icon
|
||||
wc.hIcon = LoadImageW(NULL,
|
||||
wc.hIcon = (HICON)LoadImageW(NULL,
|
||||
IDI_APPLICATION, IMAGE_ICON,
|
||||
0, 0, LR_DEFAULTSIZE | LR_SHARED);
|
||||
}
|
||||
@ -22137,7 +22137,7 @@ void _glfwPlatformGetWindowContentScale(_GLFWwindow* window,
|
||||
{
|
||||
const HANDLE handle = MonitorFromWindow(window->win32.handle,
|
||||
MONITOR_DEFAULTTONEAREST);
|
||||
_glfwGetMonitorContentScaleWin32(handle, xscale, yscale);
|
||||
_glfwGetMonitorContentScaleWin32((HMONITOR)handle, xscale, yscale);
|
||||
}
|
||||
|
||||
void _glfwPlatformIconifyWindow(_GLFWwindow* window)
|
||||
@ -22446,7 +22446,7 @@ void _glfwPlatformPollEvents(void)
|
||||
handle = GetActiveWindow();
|
||||
if (handle)
|
||||
{
|
||||
window = GetPropW(handle, L"GLFW");
|
||||
window = (_GLFWwindow*)GetPropW(handle, L"GLFW");
|
||||
if (window)
|
||||
{
|
||||
int i;
|
||||
@ -22596,7 +22596,7 @@ int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
||||
else
|
||||
return GLFW_FALSE;
|
||||
|
||||
cursor->win32.handle = LoadImageW(NULL,
|
||||
cursor->win32.handle = (HCURSOR)LoadImageW(NULL,
|
||||
MAKEINTRESOURCEW(id), IMAGE_CURSOR, 0, 0,
|
||||
LR_DEFAULTSIZE | LR_SHARED);
|
||||
if (!cursor->win32.handle)
|
||||
@ -22639,7 +22639,7 @@ void _glfwPlatformSetClipboardString(const char* string)
|
||||
return;
|
||||
}
|
||||
|
||||
buffer = GlobalLock(object);
|
||||
buffer = (WCHAR*)GlobalLock(object);
|
||||
if (!buffer)
|
||||
{
|
||||
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
|
||||
@ -22685,7 +22685,7 @@ const char* _glfwPlatformGetClipboardString(void)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
buffer = GlobalLock(object);
|
||||
buffer = (WCHAR*)GlobalLock(object);
|
||||
if (!buffer)
|
||||
{
|
||||
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
|
||||
|
@ -18,6 +18,8 @@
|
||||
#define STB_IMAGE_WRITE_IMPLEMENTATION // stbi_write
|
||||
#define STB_SPRINTF_IMPLEMENTATION // stb_sprintf
|
||||
#define STB_SPRINTF_NOUNALIGNED // stb_sprintf
|
||||
//#define STBI_WINDOWS_UTF8
|
||||
//#define STBIW_WINDOWS_UTF8
|
||||
|
||||
#include "3rd_stb_image.h"
|
||||
#include "3rd_stb_image_write.h"
|
||||
@ -1411,6 +1413,8 @@ void Image::load_from_file(const String &file_name, Format p_format) {
|
||||
|
||||
FILE *fp = fopen(file_name.utf8().get_data(), "r");
|
||||
|
||||
ERR_FAIL_COND_MSG(!fp, "Couldn't open file! " + file_name);
|
||||
|
||||
//case FORMAT_RF:
|
||||
//case FORMAT_RGF:
|
||||
//case FORMAT_RGBF:
|
||||
|
Loading…
Reference in New Issue
Block a user