Hi guys!

Thank you for suggestions! Does it mean that windows API won't help here?

Edit: yes, 'key_pressed' shows that f4 and f5 are remaining pressed when file dialog windows get's closed...

Edit2: I found this in manual for 'key_pressed'
Quote:
number - scancode of the key to check, 8.30 or -1 for resetting all keys to the nonpressed state.
So maybe I need to call 'key_pressed(-1)' to reset all keys, right after the file windows was closed ?

Edit3: grin yes, this helped. Just call 'key_pressed(-1)' right after 'file_dialog' function. As a prove, here is edited example from first post:
Code:
#include <acknex.h>
#include <default.c>
#include <windows.h>
#include <strio.c>

#define PRAGMA_POINTER

BMAP *temp_bmp = NULL;

void save_level(){
	
	char *map_file = file_dialog_save("Save level", "*.png");	
	key_pressed(-1);
	if(map_file == NULL){ return(-1); }
	
	STRING *file_name_str = "";
	STRING *path_str = str_create(map_file);
	var e_pos = str_stri(path_str, ".png");
	
	if(e_pos == 0){
		
		var length = str_len(path_str);
		var n_pos = str_chr(path_str, -length, 92);
		str_cut(file_name_str, path_str, n_pos + 1, length);
		
	}
	else{
		
		var n_pos = str_chr(path_str, -e_pos, 92);
		str_cut(file_name_str, path_str, n_pos + 1, e_pos - 1);
		
	}
	
	str_cat(file_name_str, ".png");
	
	bmap_save(temp_bmp, file_name_str);
	
}

void load_level(){
	
	char *map_file = file_dialog("Load level", "*.png");
	key_pressed(-1);
	if(map_file == NULL){ return; }	
	
	STRING *file_name_str = "";
	STRING *path_str = str_create(map_file);
	var e_pos = str_stri(path_str, ".png");
	
	if(e_pos == 0){
		
		var length = str_len(path_str);
		var n_pos = str_chr(path_str, -length, 92);
		str_cut(file_name_str, path_str, n_pos + 1, length);
		
	}
	else{
		
		var n_pos = str_chr(path_str, -e_pos, 92);
		str_cut(file_name_str, path_str, n_pos + 1, e_pos - 1);
		
	}
	
	str_cat(file_name_str, ".png");
	
	if(!file_exists(file_name_str)){ return; }
	temp_bmp = bmap_create(file_name_str);
	
}

void remove_level(){
	
	if(temp_bmp){ safe_remove(temp_bmp); }
	
}

void main(){
	
	on_f3 = remove_level;
	on_f4 = save_level;
	on_f5 = load_level;
	
	fps_max = 60;
	warn_level = 6;
	level_load("");
	wait(3);
	
	temp_bmp = bmap_createblack(256, 64, 32);
	bmap_fill(temp_bmp, COLOR_RED, 100);
	
	while(!key_esc){
		
		draw_text("F3 - removenF4 - savenF5 - load", 10, 10, COLOR_WHITE);
		DEBUG_VAR(key_pressed(62), 100);
		DEBUG_VAR(key_pressed(63), 130);
		
		if(temp_bmp){
			
			draw_quad(temp_bmp, vector(256, 256, 0), NULL, NULL, NULL, NULL, 100, 0);
			
		}
		
		wait(1);
		
	}
	
	sys_exit("");
	
}

Thank you for clearing things out guys! Without you I wouldn't even understand why this happened. Was thinking about memory/pointers related issues grin

Last edited by 3run; 04/29/18 09:56.

Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung