diff --git a/armorpaint/plugins/proc_xatlas/xatlas.cpp b/armorpaint/plugins/proc_xatlas/xatlas.cpp index 3cfa31d6..6b4fbc1c 100644 --- a/armorpaint/plugins/proc_xatlas/xatlas.cpp +++ b/armorpaint/plugins/proc_xatlas/xatlas.cpp @@ -10126,7 +10126,7 @@ void proc_xatlas_unwrap(raw_mesh_t *mesh) { free(pa); free(na); - kinc_log(KINC_LOG_LEVEL_INFO, "Unwrapped in %fs.\n", kinc_time() - t); + kinc_log("Unwrapped in %fs.\n", kinc_time() - t); } #ifdef __cplusplus diff --git a/base/sources/backends/android_system.c b/base/sources/backends/android_system.c index b1ef59ab..1831a78b 100644 --- a/base/sources/backends/android_system.c +++ b/base/sources/backends/android_system.c @@ -956,7 +956,7 @@ void KincAndroidKeyboardInit() { int failure = (*env)->RegisterNatives(env, clazz, methodTable, methodTableSize); if (failure != 0) { - kinc_log(KINC_LOG_LEVEL_WARNING, "Failed to register KincActivity.nativeKincKeyPress"); + kinc_log("Failed to register KincActivity.nativeKincKeyPress"); } (*activity->vm)->DetachCurrentThread(activity->vm); @@ -1239,7 +1239,7 @@ const char *kinc_gamepad_product_name(int gamepad) { void initAndroidFileReader(void) { if (activity == NULL) { - kinc_log(KINC_LOG_LEVEL_ERROR, "Android activity is NULL"); + kinc_error("Android activity is NULL"); return; } diff --git a/base/sources/backends/android_video.c b/base/sources/backends/android_video.c index 0c88e03e..3f0d7fd8 100644 --- a/base/sources/backends/android_video.c +++ b/base/sources/backends/android_video.c @@ -52,7 +52,7 @@ // int failure = (*env)->RegisterNatives(env, clazz, methodTable, methodTableSize); // if (failure != 0) { -// kinc_log(KINC_LOG_LEVEL_WARNING, "Failed to register KincMoviePlayer.nativeCreate"); +// kinc_log("Failed to register KincMoviePlayer.nativeCreate"); // } // (*kinc_android_get_activity()->vm)->DetachCurrentThread(kinc_android_get_activity()->vm); diff --git a/base/sources/backends/apple_video.m b/base/sources/backends/apple_video.m index 6ce00fa0..a09abf52 100644 --- a/base/sources/backends/apple_video.m +++ b/base/sources/backends/apple_video.m @@ -41,19 +41,19 @@ // float *kinc_internal_video_sound_stream_next_frame(kinc_internal_video_sound_stream_t *stream) { // ++stream->read; // if (stream->written <= stream->read) { -// kinc_log(KINC_LOG_LEVEL_WARNING, "Out of audio\n"); +// kinc_log("Out of audio\n"); // return 0; // } // if (stream->bufferReadPosition >= stream->bufferSize) { // stream->bufferReadPosition = 0; -// kinc_log(KINC_LOG_LEVEL_INFO, "buffer read back - %i\n", (int)(stream->written - stream->read)); +// kinc_log("buffer read back - %i\n", (int)(stream->written - stream->read)); // } // samples[0] = stream->buffer[stream->bufferReadPosition++]; // if (stream->bufferReadPosition >= stream->bufferSize) { // stream->bufferReadPosition = 0; -// kinc_log(KINC_LOG_LEVEL_INFO, "buffer read back - %i\n", (int)(stream->written - stream->read)); +// kinc_log("buffer read back - %i\n", (int)(stream->written - stream->read)); // } // samples[1] = stream->buffer[stream->bufferReadPosition++]; @@ -115,7 +115,7 @@ // if (video->impl.myHeight < 0) // video->impl.myHeight = [videoTrack naturalSize].height; // int framerate = [videoTrack nominalFrameRate]; -// kinc_log(KINC_LOG_LEVEL_INFO, "Framerate: %i\n", framerate); +// kinc_log("Framerate: %i\n", framerate); // video->impl.next = video->impl.videoStart; // video->impl.audioTime = video->impl.videoStart * 44100; // } diff --git a/base/sources/backends/direct3d12_gpu.c b/base/sources/backends/direct3d12_gpu.c index db25805b..b1f5d6ca 100644 --- a/base/sources/backends/direct3d12_gpu.c +++ b/base/sources/backends/direct3d12_gpu.c @@ -1175,7 +1175,7 @@ void kinc_g5_compute_shader_init(kinc_g5_compute_shader *shader, void *_data, in HRESULT hr = device->lpVtbl->CreateComputePipelineState(device , &desc, &IID_ID3D12PipelineState, &shader->impl.pso); if (hr != S_OK) { - kinc_log(KINC_LOG_LEVEL_WARNING, "Could not initialize compute shader."); + kinc_log("Could not initialize compute shader."); return; } @@ -1224,7 +1224,7 @@ kinc_g5_constant_location_t kinc_g5_compute_shader_get_constant_location(kinc_g5 } if (location.impl.computeSize == 0) { - kinc_log(KINC_LOG_LEVEL_WARNING, "Uniform %s not found.", name); + kinc_log("Uniform %s not found.", name); } return location; @@ -1253,11 +1253,11 @@ kinc_g5_texture_unit_t kinc_g5_compute_shader_get_texture_unit(kinc_g5_compute_s #ifndef NDEBUG static int notFoundCount = 0; if (notFoundCount < 10) { - kinc_log(KINC_LOG_LEVEL_WARNING, "Sampler %s not found.", unitName); + kinc_log("Sampler %s not found.", unitName); ++notFoundCount; } else if (notFoundCount == 10) { - kinc_log(KINC_LOG_LEVEL_WARNING, "Giving up on sampler not found messages.", unitName); + kinc_log("Giving up on sampler not found messages.", unitName); ++notFoundCount; } #endif @@ -1728,7 +1728,7 @@ void kinc_g5_pipeline_compile(kinc_g5_pipeline_t *pipe) { hr = device->lpVtbl->CreateGraphicsPipelineState(device , &psoDesc, &IID_ID3D12PipelineState, &pipe->impl.pso); if (hr != S_OK) { - kinc_log(KINC_LOG_LEVEL_WARNING, "Could not create pipeline."); + kinc_log("Could not create pipeline."); } } diff --git a/base/sources/backends/linux_system.c b/base/sources/backends/linux_system.c index e80025f6..b104316f 100644 --- a/base/sources/backends/linux_system.c +++ b/base/sources/backends/linux_system.c @@ -51,7 +51,7 @@ void kinc_display_init() { for (int i = 0; i < screen_resources->noutput; i++) { if (i >= MAXIMUM_DISPLAYS) { - kinc_log(KINC_LOG_LEVEL_ERROR, "Too many screens (maximum %i)", MAXIMUM_DISPLAYS); + kinc_error("Too many screens (maximum %i)", MAXIMUM_DISPLAYS); break; } @@ -104,14 +104,14 @@ kinc_display_mode_t kinc_display_available_mode(int display_index, int mode_inde XRROutputInfo *output_info = xlib.XRRGetOutputInfo(x11_ctx.display, screen_resources, screen_resources->outputs[display->index]); if (output_info->connection != RR_Connected || output_info->crtc == None) { - kinc_log(KINC_LOG_LEVEL_ERROR, "Display %i not connected.", display_index); + kinc_error("Display %i not connected.", display_index); xlib.XRRFreeOutputInfo(output_info); xlib.XRRFreeScreenResources(screen_resources); return mode; } if (mode_index >= output_info->nmode) { - kinc_log(KINC_LOG_LEVEL_ERROR, "Invalid mode index %i.", mode_index); + kinc_error("Invalid mode index %i.", mode_index); } RRMode rr_mode = output_info->modes[mode_index]; @@ -154,7 +154,7 @@ int kinc_display_count_available_modes(int display_index) { XRROutputInfo *output_info = xlib.XRRGetOutputInfo(x11_ctx.display, screen_resources, screen_resources->outputs[display->index]); if (output_info->connection != RR_Connected || output_info->crtc == None) { - kinc_log(KINC_LOG_LEVEL_ERROR, "Display %i not connected.", display_index); + kinc_error("Display %i not connected.", display_index); xlib.XRRFreeOutputInfo(output_info); xlib.XRRFreeScreenResources(screen_resources); return 0; @@ -198,7 +198,7 @@ kinc_display_mode_t kinc_display_current_mode(int display_index) { XRROutputInfo *output_info = xlib.XRRGetOutputInfo(x11_ctx.display, screen_resources, screen_resources->outputs[display->index]); if (output_info->connection != RR_Connected || output_info->crtc == None) { - kinc_log(KINC_LOG_LEVEL_ERROR, "Display %i not connected.", display_index); + kinc_error("Display %i not connected.", display_index); xlib.XRRFreeOutputInfo(output_info); xlib.XRRFreeScreenResources(screen_resources); return mode; @@ -497,7 +497,7 @@ static void load_lib(void **lib, const char *name) { int kinc_x11_error_handler(Display *display, XErrorEvent *error_event) { xlib.XGetErrorText(display, error_event->error_code, buffer, 1024); - kinc_log(KINC_LOG_LEVEL_ERROR, "X Error: %s", buffer); + kinc_error("X Error: %s", buffer); return 0; } @@ -509,7 +509,7 @@ bool kinc_x11_init() { load_lib(&x11_ctx.libs.name, #name); \ \ if (x11_ctx.libs.name == NULL) { \ - kinc_log(KINC_LOG_LEVEL_ERROR, "Failed to load lib%s.so", #name); \ + kinc_error("Failed to load lib%s.so", #name); \ return false; \ } \ } \ @@ -528,7 +528,7 @@ bool kinc_x11_init() { #define LOAD_FUN(lib, symbol) \ xlib.symbol = dlsym(x11_ctx.libs.lib, #symbol); \ if (xlib.symbol == NULL) { \ - kinc_log(KINC_LOG_LEVEL_ERROR, "Did not find symbol %s in library %s.", #symbol, #lib); \ + kinc_error("Did not find symbol %s in library %s.", #symbol, #lib); \ } LOAD_FUN(X11, XOpenDisplay) LOAD_FUN(X11, XCloseDisplay) @@ -1352,7 +1352,7 @@ void kinc_load_url(const char *url) { snprintf(openUrlCommand, MAX_COMMAND_BUFFER_SIZE, "xdg-open %s", url); int err = system(openUrlCommand); if (err != 0) { - kinc_log(KINC_LOG_LEVEL_WARNING, "Error opening url %s", url); + kinc_log("Error opening url %s", url); } } #undef HTTPS @@ -1405,7 +1405,7 @@ const char *kinc_internal_save_path() { strcat(save, "/"); int res = mkdir(save, 0700); if (res != 0 && errno != EEXIST) { - kinc_log(KINC_LOG_LEVEL_ERROR, "Could not create save directory '%s'. Error %d", save, errno); + kinc_error("Could not create save directory '%s'. Error %d", save, errno); } } @@ -1441,7 +1441,7 @@ void kinc_init(const char *name, int width, int height, kinc_window_options_t *w kinc_x11_init(); kinc_display_init(); - kinc_set_application_name(name); + kinc_set_app_name(name); kinc_g5_internal_init(); diff --git a/base/sources/backends/macos_audio.c b/base/sources/backends/macos_audio.c index db8f5a55..d739a0a4 100644 --- a/base/sources/backends/macos_audio.c +++ b/base/sources/backends/macos_audio.c @@ -20,7 +20,7 @@ void macStopVideoSoundStream(void) { static void affirm(OSStatus err) { if (err != kAudioHardwareNoError) { - kinc_log(KINC_LOG_LEVEL_ERROR, "Error: %i\n", err); + kinc_error("Error: %i\n", err); } } @@ -102,7 +102,7 @@ void kinc_a2_init(void) { address.mScope = kAudioDevicePropertyScopeOutput; affirm(AudioObjectGetPropertyData(device, &address, 0, NULL, &size, &deviceBufferSize)); - kinc_log(KINC_LOG_LEVEL_INFO, "deviceBufferSize = %i\n", deviceBufferSize); + kinc_log("deviceBufferSize = %i\n", deviceBufferSize); size = sizeof(AudioStreamBasicDescription); address.mSelector = kAudioDevicePropertyStreamFormat; @@ -111,12 +111,12 @@ void kinc_a2_init(void) { affirm(AudioObjectGetPropertyData(device, &address, 0, NULL, &size, &deviceFormat)); if (deviceFormat.mFormatID != kAudioFormatLinearPCM) { - kinc_log(KINC_LOG_LEVEL_ERROR, "mFormatID != kAudioFormatLinearPCM\n"); + kinc_error("mFormatID != kAudioFormatLinearPCM\n"); return; } if (!(deviceFormat.mFormatFlags & kLinearPCMFormatFlagIsFloat)) { - kinc_log(KINC_LOG_LEVEL_ERROR, "Only works with float format.\n"); + kinc_error("Only works with float format.\n"); return; } @@ -127,13 +127,13 @@ void kinc_a2_init(void) { initialized = true; - kinc_log(KINC_LOG_LEVEL_INFO, "mSampleRate = %g\n", deviceFormat.mSampleRate); - kinc_log(KINC_LOG_LEVEL_INFO, "mFormatFlags = %08X\n", (unsigned int)deviceFormat.mFormatFlags); - kinc_log(KINC_LOG_LEVEL_INFO, "mBytesPerPacket = %d\n", (unsigned int)deviceFormat.mBytesPerPacket); - kinc_log(KINC_LOG_LEVEL_INFO, "mFramesPerPacket = %d\n", (unsigned int)deviceFormat.mFramesPerPacket); - kinc_log(KINC_LOG_LEVEL_INFO, "mChannelsPerFrame = %d\n", (unsigned int)deviceFormat.mChannelsPerFrame); - kinc_log(KINC_LOG_LEVEL_INFO, "mBytesPerFrame = %d\n", (unsigned int)deviceFormat.mBytesPerFrame); - kinc_log(KINC_LOG_LEVEL_INFO, "mBitsPerChannel = %d\n", (unsigned int)deviceFormat.mBitsPerChannel); + kinc_log("mSampleRate = %g\n", deviceFormat.mSampleRate); + kinc_log("mFormatFlags = %08X\n", (unsigned int)deviceFormat.mFormatFlags); + kinc_log("mBytesPerPacket = %d\n", (unsigned int)deviceFormat.mBytesPerPacket); + kinc_log("mFramesPerPacket = %d\n", (unsigned int)deviceFormat.mFramesPerPacket); + kinc_log("mChannelsPerFrame = %d\n", (unsigned int)deviceFormat.mChannelsPerFrame); + kinc_log("mBytesPerFrame = %d\n", (unsigned int)deviceFormat.mBytesPerFrame); + kinc_log("mBitsPerChannel = %d\n", (unsigned int)deviceFormat.mBitsPerChannel); if (soundPlaying) return; diff --git a/base/sources/backends/macos_system.m b/base/sources/backends/macos_system.m index 03118409..e490aa4c 100644 --- a/base/sources/backends/macos_system.m +++ b/base/sources/backends/macos_system.m @@ -443,63 +443,63 @@ static bool debugButtonInput = false; static void logButton(int buttonIndex, bool pressed) { switch (buttonIndex) { case 0: - kinc_log(KINC_LOG_LEVEL_INFO, "A Pressed %i", pressed); + kinc_log("A Pressed %i", pressed); break; case 1: - kinc_log(KINC_LOG_LEVEL_INFO, "B Pressed %i", pressed); + kinc_log("B Pressed %i", pressed); break; case 2: - kinc_log(KINC_LOG_LEVEL_INFO, "X Pressed %i", pressed); + kinc_log("X Pressed %i", pressed); break; case 3: - kinc_log(KINC_LOG_LEVEL_INFO, "Y Pressed %i", pressed); + kinc_log("Y Pressed %i", pressed); break; case 4: - kinc_log(KINC_LOG_LEVEL_INFO, "Lb Pressed %i", pressed); + kinc_log("Lb Pressed %i", pressed); break; case 5: - kinc_log(KINC_LOG_LEVEL_INFO, "Rb Pressed %i", pressed); + kinc_log("Rb Pressed %i", pressed); break; case 6: - kinc_log(KINC_LOG_LEVEL_INFO, "Left Stick Pressed %i", pressed); + kinc_log("Left Stick Pressed %i", pressed); break; case 7: - kinc_log(KINC_LOG_LEVEL_INFO, "Right Stick Pressed %i", pressed); + kinc_log("Right Stick Pressed %i", pressed); break; case 8: - kinc_log(KINC_LOG_LEVEL_INFO, "Start Pressed %i", pressed); + kinc_log("Start Pressed %i", pressed); break; case 9: - kinc_log(KINC_LOG_LEVEL_INFO, "Back Pressed %i", pressed); + kinc_log("Back Pressed %i", pressed); break; case 10: - kinc_log(KINC_LOG_LEVEL_INFO, "Home Pressed %i", pressed); + kinc_log("Home Pressed %i", pressed); break; case 11: - kinc_log(KINC_LOG_LEVEL_INFO, "Up Pressed %i", pressed); + kinc_log("Up Pressed %i", pressed); break; case 12: - kinc_log(KINC_LOG_LEVEL_INFO, "Down Pressed %i", pressed); + kinc_log("Down Pressed %i", pressed); break; case 13: - kinc_log(KINC_LOG_LEVEL_INFO, "Left Pressed %i", pressed); + kinc_log("Left Pressed %i", pressed); break; case 14: - kinc_log(KINC_LOG_LEVEL_INFO, "Right Pressed %i", pressed); + kinc_log("Right Pressed %i", pressed); break; default: @@ -512,27 +512,27 @@ static bool debugAxisInput = false; static void logAxis(int axisIndex) { switch (axisIndex) { case 0: - kinc_log(KINC_LOG_LEVEL_INFO, "Left stick X"); + kinc_log("Left stick X"); break; case 1: - kinc_log(KINC_LOG_LEVEL_INFO, "Left stick Y"); + kinc_log("Left stick Y"); break; case 2: - kinc_log(KINC_LOG_LEVEL_INFO, "Right stick X"); + kinc_log("Right stick X"); break; case 3: - kinc_log(KINC_LOG_LEVEL_INFO, "Right stick Y"); + kinc_log("Right stick Y"); break; case 4: - kinc_log(KINC_LOG_LEVEL_INFO, "Left trigger"); + kinc_log("Left trigger"); break; case 5: - kinc_log(KINC_LOG_LEVEL_INFO, "Right trigger"); + kinc_log("Right trigger"); break; default: @@ -564,12 +564,6 @@ void HIDGamepad_destroy(struct HIDGamepad *gamepad) { } void HIDGamepad_bind(struct HIDGamepad *gamepad, IOHIDDeviceRef inDeviceRef, int inPadIndex) { - kinc_affirm(inDeviceRef != NULL); - kinc_affirm(inPadIndex >= 0); - kinc_affirm(gamepad->hidDeviceRef == NULL); - kinc_affirm(gamepad->hidQueueRef == NULL); - kinc_affirm(gamepad->padIndex == -1); - // Set device and device index gamepad->hidDeviceRef = inDeviceRef; gamepad->padIndex = inPadIndex; @@ -609,12 +603,11 @@ void HIDGamepad_bind(struct HIDGamepad *gamepad, IOHIDDeviceRef inDeviceRef, int cstringFromCFStringRef(productRef, gamepad->hidDeviceProduct, sizeof(gamepad->hidDeviceProduct)); } - kinc_log(KINC_LOG_LEVEL_INFO, "HIDGamepad.bind: <%p> idx:%d [0x%x:0x%x] [%s] [%s]", inDeviceRef, gamepad->padIndex, gamepad->hidDeviceVendorID, + kinc_log("HIDGamepad.bind: <%p> idx:%d [0x%x:0x%x] [%s] [%s]", inDeviceRef, gamepad->padIndex, gamepad->hidDeviceVendorID, gamepad->hidDeviceProductID, gamepad->hidDeviceVendor, gamepad->hidDeviceProduct); } static void initDeviceElements(struct HIDGamepad *gamepad, CFArrayRef elements) { - kinc_affirm(elements != NULL); for (CFIndex i = 0, count = CFArrayGetCount(elements); i < count; ++i) { IOHIDElementRef elementRef = (IOHIDElementRef)CFArrayGetValueAtIndex(elements, i); @@ -671,7 +664,7 @@ static void initDeviceElements(struct HIDGamepad *gamepad, CFArrayRef elements) } void HIDGamepad_unbind(struct HIDGamepad *gamepad) { - kinc_log(KINC_LOG_LEVEL_INFO, "HIDGamepad.unbind: idx:%d [0x%x:0x%x] [%s] [%s]", gamepad->padIndex, gamepad->hidDeviceVendorID, gamepad->hidDeviceProductID, + kinc_log("HIDGamepad.unbind: idx:%d [0x%x:0x%x] [%s] [%s]", gamepad->padIndex, gamepad->hidDeviceVendorID, gamepad->hidDeviceProductID, gamepad->hidDeviceVendor, gamepad->hidDeviceProduct); if (gamepad->hidQueueRef) { @@ -815,7 +808,7 @@ static int initHIDManager(struct HIDManager *manager) { addMatchingArray(manager, matchingCFArrayRef, matchingCFDictRef); } else { - kinc_log(KINC_LOG_LEVEL_ERROR, "%s: CFArrayCreateMutable failed.", __PRETTY_FUNCTION__); + kinc_error("%s: CFArrayCreateMutable failed.", __PRETTY_FUNCTION__); return -1; } @@ -866,17 +859,17 @@ CFMutableDictionaryRef createDeviceMatchingDictionary(struct HIDManager *manager CFRelease(usageCFNumberRef); } else { - kinc_log(KINC_LOG_LEVEL_ERROR, "%s: CFNumberCreate(usage) failed.", __PRETTY_FUNCTION__); + kinc_error("%s: CFNumberCreate(usage) failed.", __PRETTY_FUNCTION__); } } } else { - kinc_log(KINC_LOG_LEVEL_ERROR, "%s: CFNumberCreate(usage page) failed.", __PRETTY_FUNCTION__); + kinc_error("%s: CFNumberCreate(usage page) failed.", __PRETTY_FUNCTION__); } } } else { - kinc_log(KINC_LOG_LEVEL_ERROR, "%s: CFDictionaryCreateMutable failed.", __PRETTY_FUNCTION__); + kinc_error("%s: CFDictionaryCreateMutable failed.", __PRETTY_FUNCTION__); } return result; } diff --git a/base/sources/backends/metal_gpu.m b/base/sources/backends/metal_gpu.m index 73eeba18..3e792dda 100644 --- a/base/sources/backends/metal_gpu.m +++ b/base/sources/backends/metal_gpu.m @@ -885,7 +885,7 @@ void kinc_g5_pipeline_compile(kinc_g5_pipeline_t *pipeline) { int index = findAttributeIndex(renderPipelineDesc.vertexFunction.vertexAttributes, pipeline->input_layout->elements[i].name); if (index < 0) { - kinc_log(KINC_LOG_LEVEL_WARNING, "Could not find vertex attribute %s\n", pipeline->input_layout->elements[i].name); + kinc_log("Could not find vertex attribute %s\n", pipeline->input_layout->elements[i].name); } if (index >= 0) { @@ -1249,7 +1249,7 @@ void kinc_g5_shader_init(kinc_g5_shader_t *shader, const void *source, size_t le NSError *error = nil; library = [device newLibraryWithSource:[[NSString alloc] initWithBytes:data length:length encoding:NSUTF8StringEncoding] options:nil error:&error]; if (library == nil) { - kinc_log(KINC_LOG_LEVEL_ERROR, "%s", error.localizedDescription.UTF8String); + kinc_error("%s", error.localizedDescription.UTF8String); } } shader->impl.mtlFunction = (__bridge_retained void *)[library newFunctionWithName:[NSString stringWithCString:shader->impl.name @@ -1325,7 +1325,7 @@ void kinc_g5_raytrace_pipeline_init(kinc_g5_raytrace_pipeline_t *pipeline, kinc_ options:nil error:&error]; if (library == nil) { - kinc_log(KINC_LOG_LEVEL_ERROR, "%s", error.localizedDescription.UTF8String); + kinc_error("%s", error.localizedDescription.UTF8String); } MTLComputePipelineDescriptor *descriptor = [[MTLComputePipelineDescriptor alloc] init]; diff --git a/base/sources/backends/vulkan_gpu.c b/base/sources/backends/vulkan_gpu.c index 7b916c48..c76eaff3 100644 --- a/base/sources/backends/vulkan_gpu.c +++ b/base/sources/backends/vulkan_gpu.c @@ -44,7 +44,7 @@ void kinc_g5_internal_resize(int, int); { \ vk.fp##entrypoint = (PFN_vk##entrypoint)vkGetInstanceProcAddr(instance, "vk" #entrypoint); \ if (vk.fp##entrypoint == NULL) { \ - kinc_error_message("vkGetInstanceProcAddr failed to find vk" #entrypoint); \ + kinc_error("vkGetInstanceProcAddr failed to find vk" #entrypoint); \ } \ } @@ -88,10 +88,10 @@ static VkBool32 vkDebugUtilsMessengerCallbackEXT( void *puser_data) { if (message_severity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT) { - kinc_log(KINC_LOG_LEVEL_ERROR, "Vulkan ERROR: Code %d : %s", pcallback_data->messageIdNumber, pcallback_data->pMessage); + kinc_error("Vulkan ERROR: Code %d : %s", pcallback_data->messageIdNumber, pcallback_data->pMessage); } else if (message_severity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT) { - kinc_log(KINC_LOG_LEVEL_WARNING, "Vulkan WARNING: Code %d : %s", pcallback_data->messageIdNumber, pcallback_data->pMessage); + kinc_log("Vulkan WARNING: Code %d : %s", pcallback_data->messageIdNumber, pcallback_data->pMessage); } return VK_FALSE; } @@ -245,7 +245,7 @@ void create_swapchain() { swapchain_info.compositeAlpha = VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR; } else { - kinc_log(KINC_LOG_LEVEL_ERROR, "No supported composite alpha, this should not happen.\nPlease go complain to the writers of your Vulkan driver."); + kinc_error("No supported composite alpha, this should not happen.\nPlease go complain to the writers of your Vulkan driver."); exit(1); } @@ -579,7 +579,7 @@ static bool check_extensions(const char **wanted_extensions, int wanted_extensio for (int i = 0; i < wanted_extension_count; i++) { if (!found_extensions[i]) { - kinc_log(KINC_LOG_LEVEL_ERROR, "Failed to find extension %s", wanted_extensions[i]); + kinc_error("Failed to find extension %s", wanted_extensions[i]); missing_extensions = true; } } @@ -617,7 +617,7 @@ void kinc_g5_internal_init() { #ifdef VALIDATE vk_ctx.validation_found = find_layer(instance_layers, instance_layer_count, "VK_LAYER_KHRONOS_validation"); if (vk_ctx.validation_found) { - kinc_log(KINC_LOG_LEVEL_INFO, "Running with Vulkan validation layers enabled."); + kinc_log("Running with Vulkan validation layers enabled."); wanted_instance_layers[wanted_instance_layer_count++] = "VK_LAYER_KHRONOS_validation"; } #endif @@ -643,7 +643,7 @@ void kinc_g5_internal_init() { check_extensions(wanted_instance_extensions, wanted_instance_extension_count, instance_extensions, instance_extension_count); if (missing_instance_extensions) { - kinc_error(); + kinc_error(""); } #ifdef VALIDATE @@ -689,13 +689,13 @@ void kinc_g5_internal_init() { err = vkCreateInstance(&info, NULL, &vk_ctx.instance); if (err == VK_ERROR_INCOMPATIBLE_DRIVER) { - kinc_error_message("Vulkan driver is incompatible"); + kinc_error("Vulkan driver is incompatible"); } else if (err == VK_ERROR_EXTENSION_NOT_PRESENT) { - kinc_error_message("Vulkan extension not found"); + kinc_error("Vulkan extension not found"); } else if (err) { - kinc_error_message("Can not create Vulkan instance"); + kinc_error("Can not create Vulkan instance"); } uint32_t gpu_count; @@ -765,16 +765,16 @@ void kinc_g5_internal_init() { } if (vk_ctx.gpu == VK_NULL_HANDLE) { - kinc_error_message("No Vulkan device that supports presentation found"); + kinc_error("No Vulkan device that supports presentation found"); } VkPhysicalDeviceProperties properties; vkGetPhysicalDeviceProperties(vk_ctx.gpu, &properties); - kinc_log(KINC_LOG_LEVEL_INFO, "Chosen Vulkan device: %s", properties.deviceName); + kinc_log("Chosen Vulkan device: %s", properties.deviceName); free(physical_devices); } else { - kinc_error_message("No Vulkan device found"); + kinc_error("No Vulkan device found"); } static const char *wanted_device_layers[64]; @@ -908,11 +908,11 @@ void kinc_g5_internal_init() { // Generate error if could not find both a graphics and a present queue if (graphicsQueueNodeIndex == UINT32_MAX || presentQueueNodeIndex == UINT32_MAX) { - kinc_error_message("Graphics or present queue not found"); + kinc_error("Graphics or present queue not found"); } if (graphicsQueueNodeIndex != presentQueueNodeIndex) { - kinc_error_message("Graphics and present queue do not match"); + kinc_error("Graphics and present queue do not match"); } graphics_queue_node_index = graphicsQueueNodeIndex; diff --git a/base/sources/backends/windows_audio.c b/base/sources/backends/windows_audio.c index e8f7d186..5bc178ed 100644 --- a/base/sources/backends/windows_audio.c +++ b/base/sources/backends/windows_audio.c @@ -102,7 +102,7 @@ static bool initDefaultDevice() { bufferEndEvent = 0; } - kinc_log(KINC_LOG_LEVEL_INFO, "Initializing a new default audio device."); + kinc_log("Initializing a new default audio device."); HRESULT hr = deviceEnumerator->lpVtbl->GetDefaultAudioEndpoint(deviceEnumerator, eRender, eConsole, &device); if (hr == S_OK) { @@ -124,7 +124,7 @@ static bool initDefaultDevice() { HRESULT supported = audioClient->lpVtbl->IsFormatSupported(audioClient, AUDCLNT_SHAREMODE_SHARED, format, &closestFormat); if (supported == S_FALSE) { - kinc_log(KINC_LOG_LEVEL_WARNING, "Falling back to the system's preferred WASAPI mix format.", supported); + kinc_log("Falling back to the system's preferred WASAPI mix format.", supported); if (closestFormat != NULL) { format = closestFormat; } @@ -135,7 +135,7 @@ static bool initDefaultDevice() { HRESULT result = audioClient->lpVtbl->Initialize(audioClient, AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_EVENTCALLBACK, 40 * 1000 * 10, 0, format, 0); if (result != S_OK) { - kinc_log(KINC_LOG_LEVEL_WARNING, "Could not initialize WASAPI audio, going silent (error code 0x%x).", result); + kinc_log("Could not initialize WASAPI audio, going silent (error code 0x%x).", result); return false; } @@ -151,14 +151,13 @@ static bool initDefaultDevice() { kinc_microsoft_affirm(audioClient->lpVtbl->GetService(audioClient, &IID_IAudioRenderClient, (void **)&renderClient)); bufferEndEvent = CreateEvent(0, FALSE, FALSE, 0); - kinc_affirm(bufferEndEvent != 0); kinc_microsoft_affirm(audioClient->lpVtbl->SetEventHandle(audioClient, bufferEndEvent)); return true; } else { - kinc_log(KINC_LOG_LEVEL_WARNING, "Could not initialize WASAPI audio."); + kinc_log("Could not initialize WASAPI audio."); return false; } } @@ -276,7 +275,6 @@ void kinc_a2_init() { a2_buffer.channels[1] = (float *)malloc(a2_buffer.data_size * sizeof(float)); audioProcessingDoneEvent = CreateEvent(0, FALSE, FALSE, 0); - kinc_affirm(audioProcessingDoneEvent != 0); kinc_windows_co_initialize(); kinc_microsoft_affirm(CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, &IID_IMMDeviceEnumerator, (void **)&deviceEnumerator)); diff --git a/base/sources/backends/windows_net.c b/base/sources/backends/windows_net.c index 9efdf977..e2d915cd 100644 --- a/base/sources/backends/windows_net.c +++ b/base/sources/backends/windows_net.c @@ -63,14 +63,14 @@ void kinc_http_request(const char *url, const char *path, const char *data, int do { dwSize = 0; if (!WinHttpQueryDataAvailable(hRequest, &dwSize)) { - kinc_log(KINC_LOG_LEVEL_ERROR, "Error %d in WinHttpQueryDataAvailable.\n", GetLastError()); + kinc_error("Error %d in WinHttpQueryDataAvailable.\n", GetLastError()); } if ((int)dwSize + 1 > returnDataSize - returnDataIndex) { int newReturnDataSize = (returnDataIndex + dwSize + 1) * 2; char *newReturnData = (char *)malloc(newReturnDataSize); if (newReturnData == 0) { - kinc_log(KINC_LOG_LEVEL_ERROR, "Out of memory\n"); + kinc_error("Out of memory\n"); } memcpy(newReturnData, returnData, returnDataSize); returnDataSize = newReturnDataSize; @@ -79,7 +79,7 @@ void kinc_http_request(const char *url, const char *path, const char *data, int DWORD dwDownloaded = 0; if (!WinHttpReadData(hRequest, (LPVOID)(&returnData[returnDataIndex]), dwSize, &dwDownloaded)) { - kinc_log(KINC_LOG_LEVEL_ERROR, "Error %d in WinHttpReadData.\n", GetLastError()); + kinc_error("Error %d in WinHttpReadData.\n", GetLastError()); } returnDataIndex += dwSize; } while (dwSize > 0); @@ -92,7 +92,7 @@ void kinc_http_request(const char *url, const char *path, const char *data, int returnData[returnDataIndex] = 0; if (!bResults) { - kinc_log(KINC_LOG_LEVEL_ERROR, "Error %d has occurred.\n", GetLastError()); + kinc_error("Error %d has occurred.\n", GetLastError()); } if (hRequest) { diff --git a/base/sources/backends/windows_system.c b/base/sources/backends/windows_system.c index 15cd774e..4bb8a51e 100644 --- a/base/sources/backends/windows_system.c +++ b/base/sources/backends/windows_system.c @@ -146,11 +146,11 @@ static void winerror(HRESULT result) { FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&buffer, 0, NULL); - kinc_error_message("Error: %s", buffer); + kinc_error("Error: %s", buffer); } else { - kinc_error_message("Unknown Windows error, return value was 0x%x.", result); + kinc_error("Unknown Windows error, return value was 0x%x.", result); } } @@ -162,10 +162,7 @@ void kinc_microsoft_affirm(HRESULT result) { } void kinc_microsoft_affirm_message(HRESULT result, const char *format, ...) { - va_list args; - va_start(args, format); - kinc_affirm_args(result == S_OK, format, args); - va_end(args); + } void kinc_microsoft_format(const char *format, va_list args, wchar_t *buffer) { @@ -175,35 +172,22 @@ void kinc_microsoft_format(const char *format, va_list args, wchar_t *buffer) { } #ifdef KINC_NO_CLIB - #ifndef NDEBUG void _wassert(wchar_t const *message, wchar_t const *filename, unsigned line) { __debugbreak(); } - void _RTC_CheckStackVars(void) {} - void _RTC_InitBase(void) {} - void _RTC_Shutdown(void) {} - void _RTC_AllocaHelper(void) {} - void _RTC_CheckStackVars2(void) {} - void __GSHandlerCheck(void) {} - void __fastcall __security_check_cookie(_In_ uintptr_t _StackCookie) {} - uintptr_t __security_cookie; - int _fltused = 1; - void __report_rangecheckfailure(void) {} - void __chkstk(void) {} #endif - #endif #undef RegisterClass @@ -299,7 +283,7 @@ int kinc_windows_get_display_for_monitor(struct HMONITOR__ *monitor) { } } - kinc_error_message("Display for monitor not found"); + kinc_error("Display for monitor not found"); return -1; } @@ -316,7 +300,7 @@ int kinc_primary_display() { } } - kinc_error_message("No primary display defined"); + kinc_error("No primary display defined"); return -1; } @@ -1235,7 +1219,7 @@ static BOOL CALLBACK enumerateJoystickAxesCallback(LPCDIDEVICEOBJECTINSTANCEW dd HRESULT hr = di_pads[padCount]->lpVtbl->SetProperty(di_pads[padCount], DIPROP_RANGE, &propertyRange.diph); if (FAILED(hr)) { - kinc_log(KINC_LOG_LEVEL_WARNING, "DirectInput8 / Pad%i / SetProperty() failed (HRESULT=0x%x)", padCount, hr); + kinc_log("DirectInput8 / Pad%i / SetProperty() failed (HRESULT=0x%x)", padCount, hr); return DIENUM_STOP; } @@ -1268,29 +1252,29 @@ static BOOL CALLBACK enumerateJoysticksCallback(LPCDIDEVICEINSTANCEW ddi, LPVOID hr = di_pads[padCount]->lpVtbl->GetDeviceState(di_pads[padCount], sizeof(DIJOYSTATE2), &di_padState[padCount]); if (SUCCEEDED(hr)) { - kinc_log(KINC_LOG_LEVEL_INFO, "DirectInput8 / Pad%i / initialized", padCount); + kinc_log("DirectInput8 / Pad%i / initialized", padCount); } else { - kinc_log(KINC_LOG_LEVEL_WARNING, "DirectInput8 / Pad%i / GetDeviceState() failed (HRESULT=0x%x)", padCount, hr); + kinc_log("DirectInput8 / Pad%i / GetDeviceState() failed (HRESULT=0x%x)", padCount, hr); } } else { - kinc_log(KINC_LOG_LEVEL_WARNING, "DirectInput8 / Pad%i / Acquire() failed (HRESULT=0x%x)", padCount, hr); + kinc_log("DirectInput8 / Pad%i / Acquire() failed (HRESULT=0x%x)", padCount, hr); cleanupPad(padCount); } } else { - kinc_log(KINC_LOG_LEVEL_WARNING, "DirectInput8 / Pad%i / EnumObjects(DIDFT_AXIS) failed (HRESULT=0x%x)", padCount, hr); + kinc_log("DirectInput8 / Pad%i / EnumObjects(DIDFT_AXIS) failed (HRESULT=0x%x)", padCount, hr); cleanupPad(padCount); } } else { - kinc_log(KINC_LOG_LEVEL_WARNING, "DirectInput8 / Pad%i / GetCapabilities() failed (HRESULT=0x%x)", padCount, hr); + kinc_log("DirectInput8 / Pad%i / GetCapabilities() failed (HRESULT=0x%x)", padCount, hr); cleanupPad(padCount); } } else { - kinc_log(KINC_LOG_LEVEL_WARNING, "DirectInput8 / Pad%i / SetDataFormat() failed (HRESULT=0x%x)", padCount, hr); + kinc_log("DirectInput8 / Pad%i / SetDataFormat() failed (HRESULT=0x%x)", padCount, hr); cleanupPad(padCount); } @@ -1324,7 +1308,7 @@ static void initializeDirectInput() { } } else { - kinc_log(KINC_LOG_LEVEL_WARNING, "DirectInput8Create failed (HRESULT=0x%x)", hr); + kinc_log("DirectInput8Create failed (HRESULT=0x%x)", hr); } } @@ -1540,7 +1524,7 @@ void kinc_load_url(const char *url) { INT_PTR ret = (INT_PTR)ShellExecuteW(NULL, L"open", wurl, NULL, NULL, SW_SHOWNORMAL); // According to ShellExecuteW's documentation return values > 32 indicate a success. if (ret <= 32) { - kinc_log(KINC_LOG_LEVEL_WARNING, "Error opening url %s", url); + kinc_log("Error opening url %s", url); } } #undef HTTPS @@ -1715,7 +1699,7 @@ void kinc_init(const char *name, int width, int height, kinc_window_options_t *w keyPressed[i] = false; } - kinc_set_application_name(name); + kinc_set_app_name(name); kinc_window_options_t defaultWin; if (win == NULL) { kinc_window_options_set_defaults(&defaultWin); diff --git a/base/sources/iron.h b/base/sources/iron.h index 08904bea..bff3b798 100644 --- a/base/sources/iron.h +++ b/base/sources/iron.h @@ -446,19 +446,16 @@ void _update(void *data) { } char *_copy(void *data) { - // strcpy(temp_string, iron_copy()); strcpy(temp_string, ui_copy()); return temp_string; } char *_cut(void *data) { - // strcpy(temp_string, iron_cut()); strcpy(temp_string, ui_cut()); return temp_string; } void _paste(char *text, void *data) { - // iron_paste(text); ui_paste(text); } @@ -846,23 +843,6 @@ void iron_init(string_t *title, i32 width, i32 height, bool vsync, i32 window_mo #endif } -void iron_set_app_name(string_t *name) { - kinc_set_application_name(name); -} - -void iron_log(string_t *value) { - if (value != NULL) { - kinc_log(KINC_LOG_LEVEL_INFO, value); - } - else { - kinc_log(KINC_LOG_LEVEL_INFO, "null"); - } -} - -void iron_g4_clear(i32 flags, i32 color, f32 depth) { - kinc_g5_clear(flags, color, depth); -} - void iron_set_update_callback(void (*callback)(void)) { iron_update = callback; kinc_set_update_callback(_update, NULL); @@ -970,26 +950,6 @@ void iron_set_gamepad_button_callback(void (*callback)(int, int, float)) { kinc_gamepad_set_button_callback(_gamepad_button, NULL); } -void iron_lock_mouse() { - kinc_mouse_lock(); -} - -void iron_unlock_mouse() { - kinc_mouse_unlock(); -} - -bool iron_can_lock_mouse() { - return kinc_mouse_can_lock(); -} - -bool iron_is_mouse_locked() { - return kinc_mouse_is_locked(); -} - -void iron_set_mouse_position(i32 x, i32 y) { - kinc_mouse_set_position(x, y); -} - void iron_show_mouse(bool show) { show ? kinc_mouse_show() : kinc_mouse_hide(); } @@ -998,7 +958,6 @@ void iron_show_keyboard(bool show) { show ? kinc_keyboard_show() : kinc_keyboard_hide(); } - any iron_g4_create_index_buffer(i32 count) { kinc_g5_index_buffer_t *buffer = (kinc_g5_index_buffer_t *)malloc(sizeof(kinc_g5_index_buffer_t)); kinc_g5_index_buffer_init(buffer, count, KINC_G4_USAGE_STATIC); @@ -1018,14 +977,6 @@ u32_array_t *iron_g4_lock_index_buffer(kinc_g5_index_buffer_t *buffer) { return ar; } -void iron_g4_unlock_index_buffer(kinc_g5_index_buffer_t *buffer) { - kinc_g4_index_buffer_unlock_all(buffer); -} - -void iron_g4_set_index_buffer(kinc_g5_index_buffer_t *buffer) { - kinc_g4_set_index_buffer(buffer); -} - typedef struct kinc_vertex_elem { char *name; int data; // vertex_data_t @@ -1059,14 +1010,6 @@ buffer_t *iron_g4_lock_vertex_buffer(kinc_g4_vertex_buffer_t *buffer) { return b; } -void iron_g4_unlock_vertex_buffer(kinc_g4_vertex_buffer_t *buffer) { - kinc_g4_vertex_buffer_unlock_all(buffer); -} - -void iron_g4_set_vertex_buffer(kinc_g4_vertex_buffer_t *buffer) { - kinc_g4_set_vertex_buffer(buffer); -} - void iron_g4_draw_indexed_vertices(i32 start, i32 count) { #ifdef KINC_DIRECT3D12 // TODO: Prevent heapIndex overflow in g5_texture.c.h/kinc_g5_internal_set_textures @@ -1097,7 +1040,7 @@ kinc_g5_shader_t *iron_g4_create_vertex_shader_from_source(string_t *source) { UINT flags = D3DCOMPILE_SKIP_OPTIMIZATION | D3DCOMPILE_SKIP_VALIDATION;// D3DCOMPILE_OPTIMIZATION_LEVEL0 HRESULT hr = D3DCompile(temp_string_vs, strlen(source) + 1, NULL, NULL, NULL, "main", "vs_5_0", flags, 0, &shader_buffer, &error_message); if (hr != S_OK) { - kinc_log(KINC_LOG_LEVEL_INFO, "%s", (char *)error_message->lpVtbl->GetBufferPointer(error_message)); + kinc_log("%s", (char *)error_message->lpVtbl->GetBufferPointer(error_message)); return NULL; } @@ -1245,7 +1188,7 @@ kinc_g5_shader_t *iron_g4_create_fragment_shader_from_source(string_t *source) { UINT flags = D3DCOMPILE_SKIP_OPTIMIZATION | D3DCOMPILE_SKIP_VALIDATION;// D3DCOMPILE_OPTIMIZATION_LEVEL0 HRESULT hr = D3DCompile(temp_string_fs, strlen(source) + 1, NULL, NULL, NULL, "main", "ps_5_0", flags, 0, &shader_buffer, &error_message); if (hr != S_OK) { - kinc_log(KINC_LOG_LEVEL_INFO, "%s", (char *)error_message->lpVtbl->GetBufferPointer(error_message)); + kinc_log("%s", (char *)error_message->lpVtbl->GetBufferPointer(error_message)); return NULL; } @@ -1356,10 +1299,6 @@ kinc_g5_shader_t *iron_g4_create_fragment_shader_from_source(string_t *source) { return shader; } -void iron_g4_delete_shader(kinc_g5_shader_t *shader) { - kinc_g5_shader_destroy(shader); -} - kinc_g5_pipeline_t *iron_g4_create_pipeline() { kinc_g5_pipeline_t *pipeline = (kinc_g5_pipeline_t *)malloc(sizeof(kinc_g5_pipeline_t)); kinc_g5_pipeline_init(pipeline); @@ -1437,10 +1376,6 @@ void iron_g4_compile_pipeline(kinc_g5_pipeline_t *pipeline, vertex_struct_t *str kinc_g5_pipeline_compile(pipeline); } -void iron_g4_set_pipeline(kinc_g5_pipeline_t *pipeline) { - kinc_g5_set_pipeline(pipeline); -} - bool _load_image(kinc_file_reader_t *reader, const char *filename, unsigned char **output, int *width, int *height, kinc_image_format_t *format) { *format = KINC_IMAGE_FORMAT_RGBA32; int size = (int)kinc_file_reader_size(reader); @@ -1491,7 +1426,7 @@ bool _load_image(kinc_file_reader_t *reader, const char *filename, unsigned char int comp; *output = (unsigned char *)stbi_loadf_from_memory(data, size, width, height, &comp, 4); if (*output == NULL) { - kinc_log(KINC_LOG_LEVEL_ERROR, stbi_failure_reason()); + kinc_error(stbi_failure_reason()); success = false; } *format = KINC_IMAGE_FORMAT_RGBA128; @@ -1500,7 +1435,7 @@ bool _load_image(kinc_file_reader_t *reader, const char *filename, unsigned char int comp; *output = stbi_load_from_memory(data, size, width, height, &comp, 4); if (*output == NULL) { - kinc_log(KINC_LOG_LEVEL_ERROR, stbi_failure_reason()); + kinc_error(stbi_failure_reason()); success = false; } } @@ -1557,29 +1492,11 @@ void iron_unload_image(image_t *image) { #ifdef WITH_AUDIO -typedef kinc_a1_channel_t audio_channel_t; - any iron_load_sound(string_t *file) { kinc_a1_sound_t *sound = kinc_a1_sound_create(file); return sound; } -void iron_unload_sound(kinc_a1_sound_t *sound) { - kinc_a1_sound_destroy(sound); -} - -audio_channel_t *iron_play_sound(kinc_a1_sound_t *sound, bool loop, float pitch, bool unique) { - return kinc_a1_play_sound(sound, loop, pitch, unique); -} - -void iron_stop_sound(kinc_a1_sound_t *sound) { - kinc_a1_stop_sound(sound); -} - -void iron_sound_set_pitch(audio_channel_t *channel, float pitch) { - kinc_a1_channel_set_pitch(channel, pitch); -} - #endif buffer_t *iron_load_blob(string_t *file) { @@ -1601,15 +1518,6 @@ buffer_t *iron_load_blob(string_t *file) { return buffer; } -void iron_load_url(string_t *url) { - kinc_load_url(url); -} - -void iron_copy_to_clipboard(string_t *text) { - kinc_copy_to_clipboard(text); -} - - kinc_g5_constant_location_t *iron_g4_get_constant_location(kinc_g5_pipeline_t *pipeline, string_t *name) { kinc_g5_constant_location_t location = kinc_g5_pipeline_get_constant_location(pipeline, name); kinc_g5_constant_location_t *location_copy = (kinc_g5_constant_location_t *)malloc(sizeof(kinc_g5_constant_location_t)); @@ -1680,19 +1588,6 @@ void iron_g4_set_matrix3(kinc_g5_constant_location_t *location, mat3_t m) { kinc_g4_set_matrix3(*location, &m); } - -f32 iron_get_time() { - return kinc_time(); -} - -i32 iron_window_width() { - return kinc_window_width(); -} - -i32 iron_window_height() { - return kinc_window_height(); -} - void iron_set_window_title(string_t *title) { kinc_window_set_title(title); #if defined(KINC_IOS) || defined(KINC_ANDROID) @@ -1700,30 +1595,14 @@ void iron_set_window_title(string_t *title) { #endif } -i32 iron_get_window_mode() { - return kinc_window_get_mode(); -} - void iron_set_window_mode(i32 mode) { kinc_window_change_mode((kinc_window_mode_t)mode); } -void iron_resize_window(i32 width, i32 height) { - kinc_window_resize(width, height); -} - -void iron_move_window(i32 x, i32 y) { - kinc_window_move(x, y); -} - i32 iron_screen_dpi() { return kinc_display_current_mode(kinc_primary_display()).pixels_per_inch; } -string_t *iron_system_id() { - return kinc_system_id(); -} - void iron_request_shutdown() { kinc_stop(); @@ -1732,10 +1611,6 @@ void iron_request_shutdown() { #endif } -i32 iron_display_count() { - return kinc_count_displays(); -} - i32 iron_display_width(i32 index) { return kinc_display_current_mode(index).width; } @@ -1764,26 +1639,6 @@ bool iron_display_is_primary(i32 index) { #endif } -void iron_write_storage(string_t *name, buffer_t *data) { - kinc_file_writer_t writer; - kinc_file_writer_open(&writer, name); - kinc_file_writer_write(&writer, data->buffer, data->length); - kinc_file_writer_close(&writer); -} - -buffer_t *iron_read_storage(string_t *name) { - kinc_file_reader_t reader; - if (!kinc_file_reader_open(&reader, name, KINC_FILE_TYPE_SAVE)) { - return NULL; - } - int reader_size = (int)kinc_file_reader_size(&reader); - buffer_t *buffer = buffer_create(reader_size); - kinc_file_reader_read(&reader, buffer->buffer, reader_size); - kinc_file_reader_close(&reader); - return buffer; -} - - kinc_g5_render_target_t *iron_g4_create_render_target(i32 width, i32 height, i32 format, i32 depth_buffer_bits) { kinc_g5_render_target_t *render_target = (kinc_g5_render_target_t *)malloc(sizeof(kinc_g5_render_target_t)); kinc_g5_render_target_init(render_target, width, height, (kinc_image_format_t)format, depth_buffer_bits); @@ -1917,18 +1772,6 @@ buffer_t *iron_g4_lock_texture(kinc_g5_texture_t *texture, i32 level) { return buffer; } -void iron_g4_unlock_texture(kinc_g5_texture_t *texture) { - kinc_g5_texture_unlock(texture); -} - -void iron_g4_generate_texture_mipmaps(kinc_g5_texture_t *texture, i32 levels) { - kinc_g5_texture_generate_mipmaps(texture, levels); -} - -void iron_g4_generate_render_target_mipmaps(kinc_g5_render_target_t *render_target, i32 levels) { - kinc_g5_render_target_generate_mipmaps(render_target, levels); -} - void iron_g4_set_mipmaps(kinc_g5_texture_t *texture, any_array_t *mipmaps) { for (int32_t i = 0; i < mipmaps->length; ++i) { image_t *img = mipmaps->buffer[i]; @@ -1937,10 +1780,6 @@ void iron_g4_set_mipmaps(kinc_g5_texture_t *texture, any_array_t *mipmaps) { } } -void iron_g4_set_depth_from(kinc_g5_render_target_t *target, kinc_g5_render_target_t *source) { - kinc_g5_render_target_set_depth_from(target, source); -} - void iron_g4_viewport(i32 x, i32 y, i32 width, i32 height) { kinc_g4_viewport(x, y, width, height); } @@ -2560,7 +2399,7 @@ buffer_t *iron_ml_inference(buffer_t *model, any_array_t *tensors, any_array_t * #endif if (onnx_status != NULL) { const char *msg = ort->GetErrorMessage(onnx_status); - kinc_log(KINC_LOG_LEVEL_ERROR, "%s", msg); + kinc_error("%s", msg); ort->ReleaseStatus(onnx_status); } } @@ -2575,7 +2414,7 @@ buffer_t *iron_ml_inference(buffer_t *model, any_array_t *tensors, any_array_t * onnx_status = ort->CreateSessionFromArray(ort_env, model->buffer, (int)model->length, ort_session_options, &session); if (onnx_status != NULL) { const char* msg = ort->GetErrorMessage(onnx_status); - kinc_log(KINC_LOG_LEVEL_ERROR, "%s", msg); + kinc_error("%s", msg); ort->ReleaseStatus(onnx_status); } } @@ -2626,7 +2465,7 @@ buffer_t *iron_ml_inference(buffer_t *model, any_array_t *tensors, any_array_t * onnx_status = ort->Run(session, NULL, input_node_names, input_tensors, length, &output_node_name, 1, &output_tensor); if (onnx_status != NULL) { const char* msg = ort->GetErrorMessage(onnx_status); - kinc_log(KINC_LOG_LEVEL_ERROR, "%s", msg); + kinc_error("%s", msg); ort->ReleaseStatus(onnx_status); } float *float_array; @@ -2676,11 +2515,7 @@ void iron_ml_unload() { #endif bool iron_raytrace_supported() { - #ifdef KINC_METAL return kinc_g5_raytrace_supported(); - #else - return true; - #endif } void iron_raytrace_init(buffer_t *shader) { diff --git a/base/sources/iron_audio.c b/base/sources/iron_audio.c index 6bdd7b7d..8596315b 100644 --- a/base/sources/iron_audio.c +++ b/base/sources/iron_audio.c @@ -253,7 +253,6 @@ struct WaveData { static void checkFOURCC(uint8_t **data, const char *fourcc) { for (int i = 0; i < 4; ++i) { - kinc_affirm(**data == fourcc[i]); ++*data; } } @@ -282,7 +281,6 @@ static void readChunk(uint8_t **data, struct WaveData *wave) { else if (strcmp(fourcc, "data") == 0) { wave->dataSize = chunksize; wave->data = (uint8_t *)malloc(chunksize * sizeof(uint8_t)); - kinc_affirm(wave->data != NULL); memcpy(wave->data, *data, chunksize); *data += chunksize; } @@ -410,9 +408,6 @@ kinc_a1_sound_t *kinc_a1_sound_create(const char *filename) { sound->right = (int16_t *)malloc(sound->size * sizeof(int16_t)); splitMono16((int16_t *)data, sound->size, sound->left, sound->right); } - else { - kinc_affirm(false); - } } else { // Left and right channel are in s16 audio stream, alternating. @@ -428,9 +423,6 @@ kinc_a1_sound_t *kinc_a1_sound_create(const char *filename) { sound->right = (int16_t *)malloc(sound->size * sizeof(int16_t)); splitStereo16((int16_t *)data, sound->size, sound->left, sound->right); } - else { - kinc_affirm(false); - } } sound->sample_rate_pos = 44100 / (float)sound->samples_per_second; free(data); diff --git a/base/sources/iron_file.c b/base/sources/iron_file.c index 84cd6baf..9bc0bb33 100644 --- a/base/sources/iron_file.c +++ b/base/sources/iron_file.c @@ -298,7 +298,7 @@ bool kinc_file_writer_open(kinc_file_writer_t *writer, const char *filepath) { writer->file = fopen(path, "wb"); #endif if (writer->file == NULL) { - kinc_log(KINC_LOG_LEVEL_WARNING, "Could not open file %s.", filepath); + kinc_log("Could not open file %s.", filepath); return false; } return true; diff --git a/base/sources/iron_net.h b/base/sources/iron_net.h index 99abf1c8..5e8120e9 100644 --- a/base/sources/iron_net.h +++ b/base/sources/iron_net.h @@ -172,7 +172,7 @@ void kinc_http_request(const char *url, const char *path, const char *data, int // address.sin_addr.s_addr = sock->host; // address.sin_port = sock->port; // if (bind(sock->handle, (const struct sockaddr *)&address, sizeof(struct sockaddr_in)) < 0) { -// kinc_log(KINC_LOG_LEVEL_ERROR, "Could not bind socket: %s", strerror(errno)); +// kinc_error("Could not bind socket: %s", strerror(errno)); // return false; // } // return true; @@ -217,66 +217,66 @@ void kinc_http_request(const char *url, const char *path, const char *data, int // sock->handle = socket(sock->family == KINC_SOCKET_FAMILY_IP4 ? AF_INET : AF_INET6, SOCK_STREAM, IPPROTO_TCP); // break; // default: -// kinc_log(KINC_LOG_LEVEL_ERROR, "Unsupported socket protocol."); +// kinc_error("Unsupported socket protocol."); // return false; // } // if (sock->handle <= 0) { -// kinc_log(KINC_LOG_LEVEL_ERROR, "Could not create socket."); +// kinc_error("Could not create socket."); // #if defined(KINC_WINDOWS) // int errorCode = WSAGetLastError(); // switch (errorCode) { // case (WSANOTINITIALISED): -// kinc_log(KINC_LOG_LEVEL_ERROR, "A successful WSAStartup call must occur before using this function."); +// kinc_error("A successful WSAStartup call must occur before using this function."); // break; // case (WSAENETDOWN): -// kinc_log(KINC_LOG_LEVEL_ERROR, "The network subsystem or the associated service provider has failed."); +// kinc_error("The network subsystem or the associated service provider has failed."); // break; // case (WSAEAFNOSUPPORT): -// kinc_log(KINC_LOG_LEVEL_ERROR, +// kinc_error( // "The specified address family is not supported.For example, an application tried to create a socket for the AF_IRDA address " // "family but an infrared adapter and device driver is not installed on the local computer."); // break; // case (WSAEINPROGRESS): -// kinc_log(KINC_LOG_LEVEL_ERROR, +// kinc_error( // "A blocking Windows Sockets 1.1 call is in progress, or the service provider is still processing a callback function."); // break; // case (WSAEMFILE): -// kinc_log(KINC_LOG_LEVEL_ERROR, "No more socket descriptors are available."); +// kinc_error("No more socket descriptors are available."); // break; // case (WSAEINVAL): -// kinc_log(KINC_LOG_LEVEL_ERROR, +// kinc_error( // "An invalid argument was supplied.This error is returned if the af parameter is set to AF_UNSPEC and the type and protocol " // "parameter are unspecified."); // break; // case (WSAENOBUFS): -// kinc_log(KINC_LOG_LEVEL_ERROR, "No buffer space is available.The socket cannot be created."); +// kinc_error("No buffer space is available.The socket cannot be created."); // break; // case (WSAEPROTONOSUPPORT): -// kinc_log(KINC_LOG_LEVEL_ERROR, "The specified protocol is not supported."); +// kinc_error("The specified protocol is not supported."); // break; // case (WSAEPROTOTYPE): -// kinc_log(KINC_LOG_LEVEL_ERROR, "The specified protocol is the wrong type for this socket."); +// kinc_error("The specified protocol is the wrong type for this socket."); // break; // case (WSAEPROVIDERFAILEDINIT): -// kinc_log(KINC_LOG_LEVEL_ERROR, +// kinc_error( // "The service provider failed to initialize.This error is returned if a layered service provider(LSP) or namespace provider was " // "improperly installed or the provider fails to operate correctly."); // break; // case (WSAESOCKTNOSUPPORT): -// kinc_log(KINC_LOG_LEVEL_ERROR, "The specified socket type is not supported in this address family."); +// kinc_error("The specified socket type is not supported in this address family."); // break; // case (WSAEINVALIDPROVIDER): -// kinc_log(KINC_LOG_LEVEL_ERROR, "The service provider returned a version other than 2.2."); +// kinc_error("The service provider returned a version other than 2.2."); // break; // case (WSAEINVALIDPROCTABLE): -// kinc_log(KINC_LOG_LEVEL_ERROR, "The service provider returned an invalid or incomplete procedure table to the WSPStartup."); +// kinc_error("The service provider returned an invalid or incomplete procedure table to the WSPStartup."); // break; // default: -// kinc_log(KINC_LOG_LEVEL_ERROR, "Unknown error."); +// kinc_error("Unknown error."); // } // #elif defined(KINC_POSIX) -// kinc_log(KINC_LOG_LEVEL_ERROR, "%s", strerror(errno)); +// kinc_error("%s", strerror(errno)); // #endif // return false; // } @@ -287,13 +287,13 @@ void kinc_http_request(const char *url, const char *path, const char *data, int // #if defined(KINC_WINDOWS) // DWORD value = 1; // if (ioctlsocket(sock->handle, FIONBIO, &value) != 0) { -// kinc_log(KINC_LOG_LEVEL_ERROR, "Could not set non-blocking mode."); +// kinc_error("Could not set non-blocking mode."); // return false; // } // #elif defined(KINC_POSIX) // int value = 1; // if (fcntl(sock->handle, F_SETFL, O_NONBLOCK, value) == -1) { -// kinc_log(KINC_LOG_LEVEL_ERROR, "Could not set non-blocking mode."); +// kinc_error("Could not set non-blocking mode."); // return false; // } // #endif @@ -303,7 +303,7 @@ void kinc_http_request(const char *url, const char *path, const char *data, int // #if defined(KINC_WINDOWS) || defined(KINC_POSIX) // int value = 1; // if (setsockopt(sock->handle, SOL_SOCKET, SO_BROADCAST, (const char *)&value, sizeof(value)) < 0) { -// kinc_log(KINC_LOG_LEVEL_ERROR, "Could not set broadcast mode."); +// kinc_error("Could not set broadcast mode."); // return false; // } // #endif @@ -313,7 +313,7 @@ void kinc_http_request(const char *url, const char *path, const char *data, int // #if defined(KINC_WINDOWS) || defined(KINC_POSIX) // int value = 1; // if (setsockopt(sock->handle, IPPROTO_TCP, TCP_NODELAY, (const char *)&value, sizeof(value)) != 0) { -// kinc_log(KINC_LOG_LEVEL_ERROR, "Could not set no-delay mode."); +// kinc_error("Could not set no-delay mode."); // return false; // } // #endif @@ -355,7 +355,7 @@ void kinc_http_request(const char *url, const char *path, const char *data, int // timeout.tv_usec = 0; // if (select(0, &r_fds, &w_fds, NULL, &timeout) < 0) { -// kinc_log(KINC_LOG_LEVEL_ERROR, "kinc_socket_select didn't work: %s", strerror(errno)); +// kinc_error("kinc_socket_select didn't work: %s", strerror(errno)); // return false; // } @@ -369,7 +369,7 @@ void kinc_http_request(const char *url, const char *path, const char *data, int // return FD_ISSET(sock->handle, &w_fds); // } // else { -// kinc_log(KINC_LOG_LEVEL_ERROR, "Calling kinc_socket_select with both read and write set to false is useless."); +// kinc_error("Calling kinc_socket_select with both read and write set to false is useless."); // return false; // } // #else @@ -391,7 +391,7 @@ void kinc_http_request(const char *url, const char *path, const char *data, int // struct in_addr addr; // if (inet_pton(sock->family == KINC_SOCKET_FAMILY_IP4 ? AF_INET : AF_INET6, host, &addr) == 0) { -// kinc_log(KINC_LOG_LEVEL_ERROR, "Invalid %s address: %s\n", sock->family == KINC_SOCKET_FAMILY_IP4 ? "IPv4" : "IPv6", host); +// kinc_error("Invalid %s address: %s\n", sock->family == KINC_SOCKET_FAMILY_IP4 ? "IPv4" : "IPv6", host); // return false; // } // sock->host = addr.s_addr; @@ -401,7 +401,7 @@ void kinc_http_request(const char *url, const char *path, const char *data, int // struct addrinfo *address = NULL; // int res = resolveAddress(host, port, &address); // if (res != 0) { -// kinc_log(KINC_LOG_LEVEL_ERROR, "Could not resolve address."); +// kinc_error("Could not resolve address."); // return false; // } // #if defined(KINC_POSIX) @@ -479,20 +479,20 @@ void kinc_http_request(const char *url, const char *path, const char *data, int // size_t sent = sendto(sock->handle, (const char *)data, size, 0, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)); // if (sent != size) { -// kinc_log(KINC_LOG_LEVEL_ERROR, "Could not send packet."); +// kinc_error("Could not send packet."); // return -1; // } // return (int)sent; // } // else { // if (!sock->connected) { -// kinc_log(KINC_LOG_LEVEL_ERROR, "Call kinc_sockect_connect/bind before send/recv can be called for TCP sockets."); +// kinc_error("Call kinc_sockect_connect/bind before send/recv can be called for TCP sockets."); // return -1; // } // size_t sent = send(sock->handle, (const char *)data, size, 0); // if (sent != size) { -// kinc_log(KINC_LOG_LEVEL_ERROR, "Could not send packet."); +// kinc_error("Could not send packet."); // } // return (int)sent; // } @@ -510,7 +510,7 @@ void kinc_http_request(const char *url, const char *path, const char *data, int // size_t sent = sendto(sock->handle, (const char *)data, size, 0, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)); // if (sent != size) { -// kinc_log(KINC_LOG_LEVEL_ERROR, "Could not send packet."); +// kinc_error("Could not send packet."); // } // return (int)sent; // #else @@ -523,13 +523,13 @@ void kinc_http_request(const char *url, const char *path, const char *data, int // struct addrinfo *address = NULL; // int res = resolveAddress(url, port, &address); // if (res != 0) { -// kinc_log(KINC_LOG_LEVEL_ERROR, "Could not resolve address."); +// kinc_error("Could not resolve address."); // return 0; // } // size_t sent = sendto(sock->handle, (const char *)data, size, 0, address->ai_addr, sizeof(struct sockaddr_in)); // if (sent != size) { -// kinc_log(KINC_LOG_LEVEL_ERROR, "Could not send packet."); +// kinc_error("Could not send packet."); // } // freeaddrinfo(address); // return (int)sent; @@ -559,7 +559,7 @@ void kinc_http_request(const char *url, const char *path, const char *data, int // else { // if (!sock->connected) { -// kinc_log(KINC_LOG_LEVEL_ERROR, "Call kinc_sockect_connect/bind before send/recv can be called for TCP sockets."); +// kinc_error("Call kinc_sockect_connect/bind before send/recv can be called for TCP sockets."); // return -1; // } // ssize_t bytes = recv(sock->handle, (char *)data, maxSize, 0); @@ -577,7 +577,7 @@ void kinc_http_request(const char *url, const char *path, const char *data, int // struct addrinfo *address = NULL; // int res = resolveAddress(url, port, &address); // if (res != 0) { -// kinc_log(KINC_LOG_LEVEL_ERROR, "Could not resolve address."); +// kinc_error("Could not resolve address."); // return -1; // } diff --git a/base/sources/iron_system.c b/base/sources/iron_system.c index 9d8655b3..52313b5d 100644 --- a/base/sources/iron_system.c +++ b/base/sources/iron_system.c @@ -15,14 +15,10 @@ #include #include -void kinc_log(kinc_log_level_t level, const char *format, ...) { - va_list args; - va_start(args, format); - kinc_log_args(level, format, args); - va_end(args); -} - -#define UTF8 +typedef enum { + KINC_LOG_LEVEL_INFO, + KINC_LOG_LEVEL_ERROR +} kinc_log_level_t; void kinc_log_args(kinc_log_level_t level, const char *format, va_list args) { #ifdef KINC_ANDROID @@ -32,35 +28,20 @@ void kinc_log_args(kinc_log_level_t level, const char *format, va_list args) { case KINC_LOG_LEVEL_INFO: __android_log_vprint(ANDROID_LOG_INFO, "Kinc", format, args_android_copy); break; - case KINC_LOG_LEVEL_WARNING: - __android_log_vprint(ANDROID_LOG_WARN, "Kinc", format, args_android_copy); - break; case KINC_LOG_LEVEL_ERROR: __android_log_vprint(ANDROID_LOG_ERROR, "Kinc", format, args_android_copy); break; } va_end(args_android_copy); #endif + #ifdef KINC_WINDOWS -#ifdef UTF8 wchar_t buffer[4096]; kinc_microsoft_format(format, args, buffer); wcscat(buffer, L"\r\n"); OutputDebugStringW(buffer); -#ifdef KINC_WINDOWS DWORD written; WriteConsoleW(GetStdHandle(level == KINC_LOG_LEVEL_INFO ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE), buffer, (DWORD)wcslen(buffer), &written, NULL); -#endif -#else - char buffer[4096]; - vsnprintf(buffer, 4090, format, args); - strcat(buffer, "\r\n"); - OutputDebugStringA(buffer); -#ifdef KINC_WINDOWS - DWORD written; - WriteConsoleA(GetStdHandle(level == KINC_LOG_LEVEL_INFO ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE), buffer, (DWORD)strlen(buffer), &written, NULL); -#endif -#endif #else char buffer[4096]; vsnprintf(buffer, 4090, format, args); @@ -69,23 +50,14 @@ void kinc_log_args(kinc_log_level_t level, const char *format, va_list args) { #endif } -void kinc_affirm(bool condition) { - if (!condition) { - kinc_error(); - } +void kinc_log(const char *format, ...) { + va_list args; + va_start(args, format); + kinc_log_args(KINC_LOG_LEVEL_INFO, format == NULL ? "null" : format, args); + va_end(args); } -void kinc_affirm_args(bool condition, const char *format, va_list args) { - if (!condition) { - kinc_error_args(format, args); - } -} - -void kinc_error(void) { - kinc_error_message("Unknown error"); -} - -void kinc_error_message(const char *format, ...) { +void kinc_error(const char *format, ...) { { va_list args; va_start(args, format); @@ -103,24 +75,6 @@ void kinc_error_message(const char *format, ...) { va_end(args); } #endif - -#ifndef KINC_NO_CLIB - exit(EXIT_FAILURE); -#endif -} - -void kinc_error_args(const char *format, va_list args) { - kinc_log_args(KINC_LOG_LEVEL_ERROR, format, args); - -#ifdef KINC_WINDOWS - wchar_t buffer[4096]; - kinc_microsoft_format(format, args, buffer); - MessageBoxW(NULL, buffer, L"Error", 0); -#endif - -#ifndef KINC_NO_CLIB - exit(EXIT_FAILURE); -#endif } void kinc_window_options_set_defaults(kinc_window_options_t *win) { @@ -293,7 +247,7 @@ const char *kinc_application_name(void) { return application_name; } -void kinc_set_application_name(const char *name) { +void kinc_set_app_name(const char *name) { strcpy(application_name, name); } @@ -376,7 +330,7 @@ bool kinc_save_is_saving(void) { #if !defined(KINC_WINDOWS) && !defined(KINC_LINUX) && !defined(KINC_MACOS) void kinc_copy_to_clipboard(const char *text) { - kinc_log(KINC_LOG_LEVEL_WARNING, "Oh no, kinc_copy_to_clipboard is not implemented for this system."); + kinc_log("Oh no, kinc_copy_to_clipboard is not implemented for this system."); } #endif diff --git a/base/sources/iron_system.h b/base/sources/iron_system.h index 860e43d7..6d3e6784 100644 --- a/base/sources/iron_system.h +++ b/base/sources/iron_system.h @@ -6,15 +6,8 @@ #include #include -typedef enum { KINC_LOG_LEVEL_INFO, KINC_LOG_LEVEL_WARNING, KINC_LOG_LEVEL_ERROR } kinc_log_level_t; -void kinc_log(kinc_log_level_t log_level, const char *format, ...); -void kinc_log_args(kinc_log_level_t log_level, const char *format, va_list args); - -void kinc_affirm(bool condition); -void kinc_affirm_args(bool condition, const char *format, va_list args); -void kinc_error(void); -void kinc_error_message(const char *format, ...); -void kinc_error_args(const char *format, va_list args); +void kinc_log(const char *format, ...); +void kinc_error(const char *format, ...); typedef struct kinc_display_mode { int x; @@ -93,7 +86,7 @@ struct kinc_framebuffer_options; void kinc_init(const char *name, int width, int height, struct kinc_window_options *win, struct kinc_framebuffer_options *frame); const char *kinc_application_name(void); -void kinc_set_application_name(const char *name); +void kinc_set_app_name(const char *name); int kinc_width(void); int kinc_height(void); void kinc_load_url(const char *url); diff --git a/base/sources/libs/gc.c b/base/sources/libs/gc.c index f4449462..19e0bdf2 100644 --- a/base/sources/libs/gc.c +++ b/base/sources/libs/gc.c @@ -497,6 +497,6 @@ size_t _gc_run() { // double t = kinc_time(); gc_mark(); size_t collected = gc_sweep(); - // kinc_log(KINC_LOG_LEVEL_INFO, "gc took %fms, freed %db.\n", (kinc_time() - t) * 1000, collected); + // kinc_log("gc took %fms, freed %db.\n", (kinc_time() - t) * 1000, collected); return collected; } diff --git a/base/sources/ts/args.ts b/base/sources/ts/args.ts index 46afc5ed..0d127fa2 100644 --- a/base/sources/ts/args.ts +++ b/base/sources/ts/args.ts @@ -126,11 +126,11 @@ function args_run() { }); } else { - iron_log(tr("Invalid export directory")); + kinc_log(tr("Invalid export directory")); } } else { - iron_log(tr("Invalid texture type")); + kinc_log(tr("Invalid texture type")); } } @@ -143,7 +143,7 @@ function args_run() { export_mesh_run(args_export_mesh_path + path_sep + f, null, false); } else { - iron_log(tr("Invalid export directory")); + kinc_log(tr("Invalid export directory")); } } diff --git a/base/sources/ts/camera.ts b/base/sources/ts/camera.ts index 1108fe61..e060cfc3 100644 --- a/base/sources/ts/camera.ts +++ b/base/sources/ts/camera.ts @@ -21,19 +21,19 @@ function camera_update() { if (config_raw.wrap_mouse && camera_controls_down) { if (mouse_view_x() < 0) { mouse_x = mouse_last_x = app_x() + app_w(); - iron_set_mouse_position(math_floor(mouse_x), math_floor(mouse_y)); + kinc_mouse_set_position(math_floor(mouse_x), math_floor(mouse_y)); } else if (mouse_view_x() > app_w()) { mouse_x = mouse_last_x = app_x(); - iron_set_mouse_position(math_floor(mouse_x), math_floor(mouse_y)); + kinc_mouse_set_position(math_floor(mouse_x), math_floor(mouse_y)); } else if (mouse_view_y() < 0) { mouse_y = mouse_last_y = app_y() + app_h(); - iron_set_mouse_position(math_floor(mouse_x), math_floor(mouse_y)); + kinc_mouse_set_position(math_floor(mouse_x), math_floor(mouse_y)); } else if (mouse_view_y() > app_h()) { mouse_y = mouse_last_y = app_y(); - iron_set_mouse_position(math_floor(mouse_x), math_floor(mouse_y)); + kinc_mouse_set_position(math_floor(mouse_x), math_floor(mouse_y)); } } else { diff --git a/base/sources/ts/console.ts b/base/sources/ts/console.ts index 0eaf7e6a..7cc76b95 100644 --- a/base/sources/ts/console.ts +++ b/base/sources/ts/console.ts @@ -79,7 +79,7 @@ function console_log(s: string) { } function console_trace(s: string) { - iron_log(s); + kinc_log(s); base_redraw_console(); array_insert(console_last_traces, 0, s); if (console_last_traces.length > 100) { diff --git a/base/sources/ts/file.ts b/base/sources/ts/file.ts index 2972c64e..74b9c0d4 100644 --- a/base/sources/ts/file.ts +++ b/base/sources/ts/file.ts @@ -97,7 +97,7 @@ function file_start(path: string) { } function file_load_url(url: string) { - iron_load_url(url); + kinc_load_url(url); } function file_delete(path: string) { diff --git a/base/sources/ts/iron/audio.ts b/base/sources/ts/iron/audio.ts index 0b31479e..40fa0c81 100644 --- a/base/sources/ts/iron/audio.ts +++ b/base/sources/ts/iron/audio.ts @@ -2,11 +2,11 @@ ///if arm_audio function audio_play(sound: sound_t, loop: bool = false, pitch: f32 = 1.0, unique: bool = false): audio_channel_t { - return iron_play_sound(sound.sound_, loop, pitch, unique); + return kinc_a1_play_sound(sound.sound_, loop, pitch, unique); } function audio_stop(sound: sound_t) { - iron_stop_sound(sound.sound_); + kinc_a1_stop_sound(sound.sound_); } ///end diff --git a/base/sources/ts/iron/camera_data.ts b/base/sources/ts/iron/camera_data.ts index 9be0e032..fa1d3571 100644 --- a/base/sources/ts/iron/camera_data.ts +++ b/base/sources/ts/iron/camera_data.ts @@ -3,7 +3,7 @@ function camera_data_parse(name: string, id: string): camera_data_t { let format: scene_t = data_get_scene_raw(name); let raw: camera_data_t = camera_data_get_raw_by_name(format.camera_datas, id); if (raw == null) { - iron_log("Camera data '" + id + "' not found!"); + kinc_log("Camera data '" + id + "' not found!"); } return raw; } diff --git a/base/sources/ts/iron/g2.ts b/base/sources/ts/iron/g2.ts index ce3d83d4..32eb9928 100644 --- a/base/sources/ts/iron/g2.ts +++ b/base/sources/ts/iron/g2.ts @@ -140,7 +140,7 @@ function g2_disable_scissor() { function g2_begin(render_target: image_t = null) { if (_g2_in_use && !_g2_thrown) { _g2_thrown = true; - iron_log("End before you begin"); + kinc_log("End before you begin"); } _g2_in_use = true; _g2_current = render_target; @@ -158,7 +158,7 @@ function g2_begin(render_target: image_t = null) { function g2_end() { if (!_g2_in_use && !_g2_thrown) { _g2_thrown = true; - iron_log("Begin before you end"); + kinc_log("Begin before you end"); } _g2_in_use = false; _g2_current = null; diff --git a/base/sources/ts/iron/g4.ts b/base/sources/ts/iron/g4.ts index a71eff9e..4e209624 100644 --- a/base/sources/ts/iron/g4.ts +++ b/base/sources/ts/iron/g4.ts @@ -19,7 +19,7 @@ function g4_shader_from_source(source: string, type: shader_type_t): shader_t { } function g4_shader_delete(raw: shader_t) { - iron_g4_delete_shader(raw.shader_); + kinc_g5_shader_destroy(raw.shader_); } function g4_pipeline_create(): pipeline_t { @@ -111,7 +111,7 @@ function g4_pipeline_compile(raw: pipeline_t) { } function g4_pipeline_set(raw: pipeline_t) { - iron_g4_set_pipeline(raw.pipeline_); + kinc_g5_set_pipeline(raw.pipeline_); } function g4_pipeline_get_const_loc(raw: pipeline_t, name: string): kinc_const_loc_t { @@ -138,11 +138,11 @@ function g4_vertex_buffer_lock(raw: vertex_buffer_t): buffer_t { } function g4_vertex_buffer_unlock(raw: vertex_buffer_t) { - iron_g4_unlock_vertex_buffer(raw.buffer_); + kinc_g4_vertex_buffer_unlock_all(raw.buffer_); } function g4_vertex_buffer_set(raw: vertex_buffer_t) { - iron_g4_set_vertex_buffer(raw.buffer_); + kinc_g4_set_vertex_buffer(raw.buffer_); } function g4_vertex_struct_create(): vertex_struct_t { @@ -207,11 +207,11 @@ function g4_index_buffer_lock(raw: index_buffer_t): u32_array_t { } function g4_index_buffer_unlock(raw: index_buffer_t) { - iron_g4_unlock_index_buffer(raw.buffer_); + kinc_g4_index_buffer_unlock_all(raw.buffer_); } function g4_index_buffer_set(raw: index_buffer_t) { - iron_g4_set_index_buffer(raw.buffer_); + kinc_g4_set_index_buffer(raw.buffer_); } function g4_begin(render_target: image_t, additional_targets: image_t[] = null) { @@ -223,7 +223,7 @@ function g4_end() { } function g4_clear(color: color_t = 0x00000000, depth: f32 = 0.0, flags: i32 = clear_flag_t.COLOR) { - iron_g4_clear(flags, color, depth); + kinc_g5_clear(flags, color, depth); } function g4_viewport(x: i32, y: i32, width: i32, height: i32) { @@ -420,7 +420,7 @@ function image_lock(raw: image_t, level: i32 = 0): buffer_t { } function image_unlock(raw: image_t) { - iron_g4_unlock_texture(raw.texture_); + kinc_g5_texture_unlock(raw.texture_); } function image_get_pixels(raw: image_t): buffer_t { @@ -440,7 +440,7 @@ function image_get_pixels(raw: image_t): buffer_t { } function image_gen_mipmaps(raw: image_t, levels: i32) { - raw.texture_ == null ? iron_g4_generate_render_target_mipmaps(raw.render_target_, levels) : iron_g4_generate_texture_mipmaps(raw.texture_, levels); + raw.texture_ == null ? kinc_g5_render_target_generate_mipmaps(raw.render_target_, levels) : kinc_g5_texture_generate_mipmaps(raw.texture_, levels); } function image_set_mipmaps(raw: image_t, mipmaps: image_t[]) { @@ -448,7 +448,7 @@ function image_set_mipmaps(raw: image_t, mipmaps: image_t[]) { } function image_set_depth_from(raw: image_t, image: image_t) { - iron_g4_set_depth_from(raw.render_target_, image.render_target_); + kinc_g5_render_target_set_depth_from(raw.render_target_, image.render_target_); } declare type image_t = { diff --git a/base/sources/ts/iron/iron.ts b/base/sources/ts/iron/iron.ts index 80f01e53..aaf4aa7c 100644 --- a/base/sources/ts/iron/iron.ts +++ b/base/sources/ts/iron/iron.ts @@ -181,9 +181,9 @@ declare function color_set_bb(c: i32, i: u8): i32; declare function color_set_ab(c: i32, i: u8): i32; declare function iron_init(title: string, width: i32, height: i32, vsync: bool, window_mode: i32, window_features: i32, x: i32, y: i32, frequency: i32, use_depth: bool): void; -declare function iron_set_app_name(name: string): void; -declare function iron_log(v: any): void; -declare function iron_g4_clear(flags: i32, color: i32, depth: f32): void; +declare function kinc_set_app_name(name: string): void; +declare function kinc_log(v: any): void; +declare function kinc_g5_clear(flags: i32, color: i32, depth: f32): void; declare function iron_set_update_callback(callback: ()=>void): void; declare function iron_set_drop_files_callback(callback: (file: string)=>void): void; declare function iron_set_cut_copy_paste_callback(on_cut: ()=>string, on_copy: ()=>string, on_paste: (text: string)=>void): void; @@ -203,43 +203,43 @@ declare function iron_set_pen_up_callback(callback: (x: i32, y: i32, pressure: f declare function iron_set_pen_move_callback(callback: (x: i32, y: i32, pressure: f32)=>void): void; declare function iron_set_gamepad_axis_callback(callback: (gamepad: i32, axis: i32, value: f32)=>void): void; declare function iron_set_gamepad_button_callback(callback: (gamepad: i32, button: i32, value: f32)=>void): void; -declare function iron_lock_mouse(): void; -declare function iron_unlock_mouse(): void; -declare function iron_can_lock_mouse(): bool; -declare function iron_is_mouse_locked(): bool; -declare function iron_set_mouse_position(x: i32, y: i32): void; +declare function kinc_mouse_lock(): void; +declare function kinc_mouse_unlock(): void; +declare function kinc_mouse_can_lock(): bool; +declare function kinc_mouse_is_locked(): bool; +declare function kinc_mouse_set_position(x: i32, y: i32): void; declare function iron_show_mouse(show: bool): void; declare function iron_show_keyboard(show: bool): void; declare function iron_g4_create_index_buffer(count: i32): any; declare function iron_g4_delete_index_buffer(buffer: any): void; declare function iron_g4_lock_index_buffer(buffer: any): u32_array_t; -declare function iron_g4_unlock_index_buffer(buffer: any): void; -declare function iron_g4_set_index_buffer(buffer: any): void; +declare function kinc_g4_index_buffer_unlock_all(buffer: any): void; +declare function kinc_g4_set_index_buffer(buffer: any): void; declare function iron_g4_create_vertex_buffer(count: i32, structure: kinc_vertex_elem_t[], usage: i32): any; declare function iron_g4_delete_vertex_buffer(buffer: any): void; declare function iron_g4_lock_vertex_buffer(buffer: any): buffer_t; -declare function iron_g4_unlock_vertex_buffer(buffer: any): void; -declare function iron_g4_set_vertex_buffer(buffer: any): void; +declare function kinc_g4_vertex_buffer_unlock_all(buffer: any): void; +declare function kinc_g4_set_vertex_buffer(buffer: any): void; declare function iron_g4_draw_indexed_vertices(start: i32, count: i32): void; declare function iron_g4_create_shader(data: buffer_t, type: i32): any; declare function iron_g4_create_vertex_shader_from_source(source: string): any; declare function iron_g4_create_fragment_shader_from_source(source: string): any; -declare function iron_g4_delete_shader(shader: any): void; +declare function kinc_g5_shader_destroy(shader: any): void; declare function iron_g4_create_pipeline(): any; declare function iron_g4_delete_pipeline(pipeline: any): void; declare function iron_g4_compile_pipeline(pipeline: any, structure0: any, vertex_shader: any, fragment_shader: any, state: any): void; -declare function iron_g4_set_pipeline(pipeline: any): void; +declare function kinc_g5_set_pipeline(pipeline: any): void; declare function iron_load_image(file: string, readable: bool): any; declare function iron_unload_image(image: image_t): void; declare function iron_load_sound(file: string): any; -declare function iron_unload_sound(sound: any): void; -declare function iron_play_sound(sound: any, loop: bool, pitch: f32, unique: bool): audio_channel_t; -declare function iron_stop_sound(sound: any): void; -declare function iron_sound_set_pitch(channel: audio_channel_t, pitch: f32): void; +declare function kinc_a1_sound_destroy(sound: any): void; +declare function kinc_a1_play_sound(sound: any, loop: bool, pitch: f32, unique: bool): audio_channel_t; +declare function kinc_a1_stop_sound(sound: any): void; +declare function kinc_a1_channel_set_pitch(channel: audio_channel_t, pitch: f32): void; declare function iron_load_blob(file: string): buffer_t; -declare function iron_load_url(url: string): void; -declare function iron_copy_to_clipboard(text: string): void; +declare function kinc_load_url(url: string): void; +declare function kinc_copy_to_clipboard(text: string): void; declare function iron_g4_get_constant_location(pipeline: any, name: string): any; declare function iron_g4_get_texture_unit(pipeline: any, name: string): any; @@ -257,26 +257,24 @@ declare function iron_g4_set_floats(location: any, values: buffer_t): void; declare function iron_g4_set_matrix4(location: any, matrix: mat4_t): void; declare function iron_g4_set_matrix3(location: any, matrix: mat3_t): void; -declare function iron_get_time(): f32; -declare function iron_window_width(): i32; -declare function iron_window_height(): i32; +declare function kinc_time(): f32; +declare function kinc_window_width(): i32; +declare function kinc_window_height(): i32; declare function iron_set_window_title(title: string): void; -declare function iron_get_window_mode(): i32; +declare function kinc_window_get_mode(): i32; declare function iron_set_window_mode(mode: i32): void; -declare function iron_resize_window(width: i32, height: i32): void; -declare function iron_move_window(x: i32, y: i32): void; +declare function kinc_window_resize(width: i32, height: i32): void; +declare function kinc_window_move(x: i32, y: i32): void; declare function iron_screen_dpi(): i32; -declare function iron_system_id(): string; +declare function kinc_system_id(): string; declare function iron_request_shutdown(): void; -declare function iron_display_count(): i32; +declare function kinc_count_displays(): i32; declare function iron_display_width(index: i32): i32; declare function iron_display_height(index: i32): i32; declare function iron_display_x(index: i32): i32; declare function iron_display_y(index: i32): i32; declare function iron_display_frequency(index: i32): i32; declare function iron_display_is_primary(index: i32): bool; -declare function iron_write_storage(name: string, data: buffer_t): void; -declare function iron_read_storage(name: string): buffer_t; declare function iron_g4_create_render_target(width: i32, height: i32, format: i32, depth_buffer_bits: i32): any; declare function iron_g4_create_texture(width: i32, height: i32, format: i32): any; @@ -285,11 +283,11 @@ declare function iron_g4_create_texture_from_encoded_bytes(data: buffer_t, forma declare function iron_g4_get_texture_pixels(texture: any): buffer_t; declare function iron_g4_get_render_target_pixels(render_target: any, data: buffer_t): void; declare function iron_g4_lock_texture(texture: any, level: i32): buffer_t; -declare function iron_g4_unlock_texture(texture: any): void; -declare function iron_g4_generate_texture_mipmaps(texture: any, levels: i32): void; -declare function iron_g4_generate_render_target_mipmaps(render_target: any, levels: i32): void; +declare function kinc_g5_texture_unlock(texture: any): void; +declare function kinc_g5_texture_generate_mipmaps(texture: any, levels: i32): void; +declare function kinc_g5_render_target_generate_mipmaps(render_target: any, levels: i32): void; declare function iron_g4_set_mipmaps(texture: any, mipmaps: image_t[]): void; -declare function iron_g4_set_depth_from(target: any, source: any): void; +declare function kinc_g5_render_target_set_depth_from(target: any, source: any): void; declare function iron_g4_viewport(x: i32, y: i32, width: i32, height: i32): void; declare function iron_g4_scissor(x: i32, y: i32, width: i32, height: i32): void; declare function iron_g4_disable_scissor(): void; diff --git a/base/sources/ts/iron/lz4.ts b/base/sources/ts/iron/lz4.ts index c133a354..eb8dc9b3 100644 --- a/base/sources/ts/iron/lz4.ts +++ b/base/sources/ts/iron/lz4.ts @@ -31,7 +31,7 @@ function lz4_encode(b: buffer_t): buffer_t { let ibuf: u8_array_t = b; let ilen: u32 = ibuf.length; if (ilen >= 0x7e000000) { - iron_log("LZ4 range error"); + kinc_log("LZ4 range error"); return null; } diff --git a/base/sources/ts/iron/material_data.ts b/base/sources/ts/iron/material_data.ts index 9376cf70..19cbd083 100644 --- a/base/sources/ts/iron/material_data.ts +++ b/base/sources/ts/iron/material_data.ts @@ -38,7 +38,7 @@ function material_data_parse(file: string, name: string): material_data_t { let format: scene_t = data_get_scene_raw(file); let raw: material_data_t = material_data_get_raw_by_name(format.material_datas, name); if (raw == null) { - iron_log("Material data '" + name + "' not found!"); + kinc_log("Material data '" + name + "' not found!"); return null; } return material_data_create(raw, file); diff --git a/base/sources/ts/iron/mesh_data.ts b/base/sources/ts/iron/mesh_data.ts index 15ac2b52..3ae2d7b2 100644 --- a/base/sources/ts/iron/mesh_data.ts +++ b/base/sources/ts/iron/mesh_data.ts @@ -3,7 +3,7 @@ function mesh_data_parse(name: string, id: string): mesh_data_t { let format: scene_t = data_get_scene_raw(name); let raw: mesh_data_t = mesh_data_get_raw_by_name(format.mesh_datas, id); if (raw == null) { - iron_log("Mesh data '" + id + "' not found!"); + kinc_log("Mesh data '" + id + "' not found!"); return null; } @@ -204,10 +204,10 @@ function mesh_data_get(raw: mesh_data_t, vs: vertex_element_t[]): vertex_buffer_ g4_vertex_buffer_unlock(vb); map_set(raw._.vertex_buffer_map, key, vb); if (has_tex && uvs == null) { - iron_log("Geometry " + raw.name + " is missing UV map"); + kinc_log("Geometry " + raw.name + " is missing UV map"); } if (has_col && cols == null) { - iron_log("Geometry " + raw.name + " is missing vertex colors"); + kinc_log("Geometry " + raw.name + " is missing vertex colors"); } } return vb; diff --git a/base/sources/ts/iron/scene.ts b/base/sources/ts/iron/scene.ts index f4b8c623..4b9f8a93 100644 --- a/base/sources/ts/iron/scene.ts +++ b/base/sources/ts/iron/scene.ts @@ -50,7 +50,7 @@ function scene_create(format: scene_t): object_t { // Startup scene let scene_object: object_t = scene_add_scene(format.name, null); if (scene_cameras.length == 0) { - iron_log("No camera found for scene '" + format.name + "'"); + kinc_log("No camera found for scene '" + format.name + "'"); } scene_camera = scene_get_camera(format.camera_ref); diff --git a/base/sources/ts/iron/shader_data.ts b/base/sources/ts/iron/shader_data.ts index 16ff4aa5..0e1124b9 100644 --- a/base/sources/ts/iron/shader_data.ts +++ b/base/sources/ts/iron/shader_data.ts @@ -24,7 +24,7 @@ function shader_data_parse(file: string, name: string): shader_data_t { let format: scene_t = data_get_scene_raw(file); let raw: shader_data_t = shader_data_get_raw_by_name(format.shader_datas, name); if (raw == null) { - iron_log("Shader data '" + name + "' not found!"); + kinc_log("Shader data '" + name + "' not found!"); return null; } return shader_data_create(raw); diff --git a/base/sources/ts/iron/sys.ts b/base/sources/ts/iron/sys.ts index 8a2c6ed4..e2d575cc 100644 --- a/base/sources/ts/iron/sys.ts +++ b/base/sources/ts/iron/sys.ts @@ -25,7 +25,7 @@ let _sys_shaders: map_t = map_create(); function sys_start(ops: kinc_sys_ops_t) { iron_init(ops.title, ops.width, ops.height, ops.vsync, ops.mode, ops.features, ops.x, ops.y, ops.frequency, ops.use_depth); - _sys_start_time = iron_get_time(); + _sys_start_time = kinc_time(); g2_init(); iron_set_update_callback(sys_render_callback); iron_set_drop_files_callback(sys_drop_files_callback); @@ -126,11 +126,11 @@ function sys_drop_files(file_path: string) { } function sys_time(): f32 { - return iron_get_time() - _sys_start_time; + return kinc_time() - _sys_start_time; } function sys_system_id(): string { - return iron_system_id(); + return kinc_system_id(); } function sys_language(): string { @@ -142,7 +142,7 @@ function sys_stop() { } function sys_load_url(url: string) { - iron_load_url(url); + kinc_load_url(url); } function sys_render_callback() { @@ -263,22 +263,22 @@ function sys_gamepad_button_callback(gamepad: i32, button: i32, value: f32) { function sys_lock_mouse() { if (!sys_is_mouse_locked()) { - iron_lock_mouse(); + kinc_mouse_lock(); } } function sys_unlock_mouse() { if (sys_is_mouse_locked()) { - iron_unlock_mouse(); + kinc_mouse_unlock(); } } function sys_can_lock_mouse(): bool { - return iron_can_lock_mouse(); + return kinc_mouse_can_lock(); } function sys_is_mouse_locked(): bool { - return iron_is_mouse_locked(); + return kinc_mouse_is_locked(); } function sys_hide_system_cursor() { @@ -290,11 +290,11 @@ function sys_show_system_cursor() { } function sys_resize(width: i32, height: i32) { - iron_resize_window(width, height); + kinc_window_resize(width, height); } function sys_move(x: i32, y: i32) { - iron_move_window(x, y); + kinc_window_move(x, y); } function sys_x(): i32 { @@ -306,15 +306,15 @@ function sys_y(): i32 { } function sys_width(): i32 { - return iron_window_width(); + return kinc_window_width(); } function sys_height(): i32 { - return iron_window_height(); + return kinc_window_height(); } function sys_mode(): window_mode_t { - return iron_get_window_mode(); + return kinc_window_get_mode(); } function sys_mode_set(mode: window_mode_t) { @@ -331,7 +331,7 @@ function sys_title_set(value: string) { } function sys_display_primary_id(): i32 { - for (let i: i32 = 0; i < iron_display_count(); ++i) { + for (let i: i32 = 0; i < kinc_count_displays(); ++i) { if (iron_display_is_primary(i)) { return i; } @@ -395,7 +395,7 @@ function sound_create(sound_: any): sound_t { } function sound_unload(raw: sound_t) { - iron_unload_sound(raw.sound_); + kinc_a1_sound_destroy(raw.sound_); } ///end diff --git a/base/sources/ts/iron/world_data.ts b/base/sources/ts/iron/world_data.ts index 272a2179..8f486bc4 100644 --- a/base/sources/ts/iron/world_data.ts +++ b/base/sources/ts/iron/world_data.ts @@ -5,7 +5,7 @@ function world_data_parse(name: string, id: string): world_data_t { let format: scene_t = data_get_scene_raw(name); let raw: world_data_t = world_data_get_raw_by_name(format.world_datas, id); if (raw == null) { - iron_log("World data '" + id + "' not found!"); + kinc_log("World data '" + id + "' not found!"); return null; } diff --git a/base/sources/ts/main.ts b/base/sources/ts/main.ts index 870b6650..ec3344c0 100644 --- a/base/sources/ts/main.ts +++ b/base/sources/ts/main.ts @@ -2,7 +2,7 @@ function main() { // Used to locate external application data folder - iron_set_app_name(manifest_title); + kinc_set_app_name(manifest_title); config_load(); app_on_resize = base_on_resize; @@ -17,7 +17,7 @@ function main() { if (config_raw.layout == null) { base_init_layout(); } - iron_set_app_name(manifest_title); + kinc_set_app_name(manifest_title); app_init(); scene_set_active("Scene"); uniforms_ext_init(); diff --git a/base/sources/ts/tab_console.ts b/base/sources/ts/tab_console.ts index 68c7aab1..21bce003 100644 --- a/base/sources/ts/tab_console.ts +++ b/base/sources/ts/tab_console.ts @@ -49,7 +49,7 @@ function tab_console_draw(htab: ui_handle_t) { ///if (arm_windows || arm_linux || arm_macos) if (ui_button(tr("Copy"))) { let str: string = string_array_join(console_last_traces, "\n"); - iron_copy_to_clipboard(str); + kinc_copy_to_clipboard(str); } ///end diff --git a/base/sources/ts/tab_swatches.ts b/base/sources/ts/tab_swatches.ts index 6b95c990..2e2b5186 100644 --- a/base/sources/ts/tab_swatches.ts +++ b/base/sources/ts/tab_swatches.ts @@ -199,7 +199,7 @@ function tab_swatches_draw(htab: ui_handle_t) { let color: i32 = context_raw.swatch.base; color = color_set_ab(color, context_raw.swatch.opacity * 255); let val: u32 = color; - iron_copy_to_clipboard(i32_to_string(val)); + kinc_copy_to_clipboard(i32_to_string(val)); } ///end else if (project_raw.swatches.length > 1 && ui_menu_button(tr("Delete"), "delete")) { diff --git a/base/sources/ts/ui_box.ts b/base/sources/ts/ui_box.ts index ea063106..827fda27 100644 --- a/base/sources/ts/ui_box.ts +++ b/base/sources/ts/ui_box.ts @@ -102,7 +102,7 @@ function ui_box_render() { ///if (arm_windows || arm_linux || arm_macos) if (ui_box_copyable && ui_button(tr("Copy"))) { - iron_copy_to_clipboard(ui_box_text); + kinc_copy_to_clipboard(ui_box_text); } ///end if (ui_button(tr("OK"))) { diff --git a/base/sources/ts/ui_menu.ts b/base/sources/ts/ui_menu.ts index 793a16c0..562a776e 100644 --- a/base/sources/ts/ui_menu.ts +++ b/base/sources/ts/ui_menu.ts @@ -542,7 +542,7 @@ function ui_menu_render() { ///if (arm_windows || arm_linux || arm_macos) if (ui_button(tr("Copy"))) { - iron_copy_to_clipboard(_ui_menu_render_msg); + kinc_copy_to_clipboard(_ui_menu_render_msg); } ///else _ui_end_element(); diff --git a/base/sources/ts/ui_nodes.ts b/base/sources/ts/ui_nodes.ts index 24fa8fbb..031e1af6 100644 --- a/base/sources/ts/ui_nodes.ts +++ b/base/sources/ts/ui_nodes.ts @@ -403,19 +403,19 @@ function ui_nodes_get_canvas_control(ui: ui_t, controls_down: bool): ui_canvas_c if (config_raw.wrap_mouse && controls_down) { if (ui.input_x < ui._window_x) { ui.input_x = ui._window_x + ui._window_w; - iron_set_mouse_position(math_floor(ui.input_x), math_floor(ui.input_y)); + kinc_mouse_set_position(math_floor(ui.input_x), math_floor(ui.input_y)); } else if (ui.input_x > ui._window_x + ui._window_w) { ui.input_x = ui._window_x; - iron_set_mouse_position(math_floor(ui.input_x), math_floor(ui.input_y)); + kinc_mouse_set_position(math_floor(ui.input_x), math_floor(ui.input_y)); } else if (ui.input_y < ui._window_y) { ui.input_y = ui._window_y + ui._window_h; - iron_set_mouse_position(math_floor(ui.input_x), math_floor(ui.input_y)); + kinc_mouse_set_position(math_floor(ui.input_x), math_floor(ui.input_y)); } else if (ui.input_y > ui._window_y + ui._window_h) { ui.input_y = ui._window_y; - iron_set_mouse_position(math_floor(ui.input_x), math_floor(ui.input_y)); + kinc_mouse_set_position(math_floor(ui.input_x), math_floor(ui.input_y)); } } diff --git a/base/tests/triangle/main.ts b/base/tests/triangle/main.ts index 60fbebe1..8e8a0098 100644 --- a/base/tests/triangle/main.ts +++ b/base/tests/triangle/main.ts @@ -12,11 +12,11 @@ function render() { let flags: i32 = 0; flags |= 1; // Color flags |= 2; // Depth - iron_g4_clear(flags, 0xff000000, 1.0); + kinc_g5_clear(flags, 0xff000000, 1.0); - iron_g4_set_pipeline(pipeline); - iron_g4_set_vertex_buffer(vb); - iron_g4_set_index_buffer(ib); + kinc_g5_set_pipeline(pipeline); + kinc_g4_set_vertex_buffer(vb); + kinc_g4_set_index_buffer(ib); iron_g4_draw_indexed_vertices(0, -1); iron_g4_end(); @@ -75,14 +75,14 @@ function main() { for (let i: i32 = 0; i < vertices.length; i++) { buffer_set_f32(vb_data, i * 4, vertices[i]); } - iron_g4_unlock_vertex_buffer(vb); + kinc_g4_vertex_buffer_unlock_all(vb); ib = iron_g4_create_index_buffer(indices.length); let ib_data: u32_array_t = iron_g4_lock_index_buffer(ib); for (let i: i32 = 0; i < indices.length; i++) { ib_data[i] = indices[i]; } - iron_g4_unlock_index_buffer(ib); + kinc_g4_index_buffer_unlock_all(ib); iron_set_update_callback(render); } diff --git a/base/tools/pad/sources/main.ts b/base/tools/pad/sources/main.ts index 608b988a..bfccc47d 100644 --- a/base/tools/pad/sources/main.ts +++ b/base/tools/pad/sources/main.ts @@ -54,7 +54,7 @@ function shutdown() { } function main() { - iron_set_app_name("ArmorPad"); + kinc_set_app_name("ArmorPad"); let blob_storage: buffer_t = iron_load_blob(iron_save_path() + "/config.json"); if (blob_storage == null) {