changed types and added utils/sw

This commit is contained in:
2021-06-23 22:11:41 -05:00
parent 22b23f39cd
commit c7dffb0727
8 changed files with 73 additions and 54 deletions

View File

@@ -2,25 +2,29 @@
* Menu Functions
* @public
*/
declare namespace type2take1 {
type Player = number;
type Entity = number;
type Ped = number;
type Vehicle = number;
type Group = number;
type Hash = number;
type Ptfx = number;
type Any = number;
type Thread = number;
type Feature = number;
type Player = number;
type Entity = number;
type Ped = number;
type Vehicle = number;
type Group = number;
type Hash = number;
type Ptfx = number;
type Any = number;
type Thread = number;
type vector<T> = object;
type table<T> = vector<T>;
type uint8_t = number;
type uint32_t = number;
type uint64_t = number;
type integer = number;
type int = number;
type float = number;
}
type Feature = number;
// C++ Types
type vector<T> = object;
type uint8_t = number;
type uint32_t = number;
type uint64_t = number;
type integer = number;
type int = number;
type float = number;
//type wstring = string;
// lua C++ adjacent types
type table<T> = vector<T>;

View File

@@ -8,27 +8,27 @@ declare namespace menu {
type featureTypes = "parent"|"toggle"|"action"|"value_i"|"action_value_i"|"autoaction_value_i";
export function add_feature(name: string, type: featureTypes, parent: type2take1.Feature, script_handler: (feat: Feat) => void): Feat;
export function add_feature(name: string, type: featureTypes, parent: Feature, script_handler: (feat: Feat) => void): Feat;
export function delete_feature(id: type2take1.int): boolean;
export function delete_feature(id: int): boolean;
export function set_menu_can_navigate(): void;
export function get_version(): void;
export function add_player_feature(name: string, type: string, parent: type2take1.integer, script_handler: (feat: Feat) => void): PlayerFeat
export function add_player_feature(name: string, type: string, parent: integer, script_handler: (feat: Feat) => void): PlayerFeat
export function get_player_feature(i: type2take1.uint32_t): PlayerFeat
export function get_player_feature(i: uint32_t): PlayerFeat
export function is_threading_mode(mode: type2take1.int): boolean
export function is_threading_mode(mode: int): boolean
/**
* @privateRemarks callback declaration may be wrong
*/
export function create_thread(callback: () => void, context: any): type2take1.Thread
export function create_thread(callback: () => void, context: any): Thread
export function has_thread_finished(id: type2take1.Thread): boolean
export function has_thread_finished(id: Thread): boolean
export function delete_thread(id: type2take1.Thread): boolean
export function delete_thread(id: Thread): boolean
}

View File

@@ -4,20 +4,20 @@
*/
declare namespace scriptdraw {
//void draw_text(string text, v2 pos, v2 size, float scale, uint32_t color, uint32_t flags)
//void wdraw_text(wstring text, v2 pos, v2 size, float scale, uint32_t color, uint32_t flags)
//uint32_t register_sprite(string path)
//void draw_sprite(uint32_t id, v2 pos, float scale, float rot, uint32_t color)
//void draw_line(v2 start, v2 end, uint32_t size, uint32_t color)
//void draw_rect(v2 pos, v2 size, uint32_t color)
//float pos_pixel_to_rel_x(float in)
//float pos_pixel_to_rel_y(float in)
//float pos_rel_to_pixel_x(float in)
//float pos_rel_to_pixel_y(float in)
//float size_pixel_to_rel_x(float in)
//float size_pixel_to_rel_y(float in)
//float size_rel_to_pixel_x(float in)
//float size_rel_to_pixel_y(float in)
function draw_text(text: string, pos: v2, size: v2, scale: float, color: uint32_t, flags: uint32_t): void;
//function wdraw_text(text: wstring, pos: v2, size: v2, scale: float, color: uint32_t, flags: uint32_t): void;
function register_sprite(path: string): uint32_t;
function draw_sprite(id: uint32_t, pos: v2, scale: float, rot: float, color: uint32_t): void;
function draw_line(start: v2, end: v2, size: uint32_t, color: uint32_t): void;
function draw_rect(pos: v2, size: v2, color: uint32_t): void;
function pos_pixel_to_rel_x(input: float): float;
function pos_pixel_to_rel_y(input: float): float;
function pos_rel_to_pixel_x(input: float): float;
function pos_rel_to_pixel_y(input: float): float;
function size_pixel_to_rel_x(input: float): float;
function size_pixel_to_rel_y(input: float): float;
function size_rel_to_pixel_x(input: float): float;
function size_rel_to_pixel_y(input: float): float;
}

View File

@@ -4,7 +4,21 @@
*/
declare namespace utils {
function str_to_vk(keyName: string): int
//function string_to_wstring(str: string): wstring
//function wstring_to_string(str: wstring): string
function get_all_files_in_directory(path: string, extension: string): vector<string>
function get_all_sub_directories_in_directory(path: string): vector<string>
function file_exists(path: string): boolean
function dir_exists(path: string): boolean
function make_dir(path: string): boolean
function get_appdata_path(dir: string, file: string): string
function from_clipboard(): string
function to_clipboard(str: string): void
function time(): int
function time_ms(): int
function str_to_vecu64(str: string): vector<uint64_t>
function vecu64_to_str(vec: vector<uint64_t>): string
}

View File

@@ -44,26 +44,26 @@ declare class Feat {
/**
* value for integer features
*/
public get value_i(): type2take1.integer;
public set value_i(value_i: type2take1.integer);
public get value_i(): integer;
public set value_i(value_i: integer);
/**
* min value
*/
public get min_1(): type2take1.integer;
public set min_1(min_1: type2take1.integer);
public get min_1(): integer;
public set min_1(min_1: integer);
/**
* max value
*/
public get max_i(): type2take1.integer;
public set max_i(max_i: type2take1.integer);
public get max_i(): integer;
public set max_i(max_i: integer);
/**
* step size
*/
public get mod_i(): type2take1.integer;
public set mod_i(mod_i: type2take1.integer);
public get mod_i(): integer;
public set mod_i(mod_i: integer);
/**
* deprecated

View File

@@ -7,9 +7,9 @@ declare class MenuKey {
/**
* vector of virtual keys
*/
readonly keys: type2take1.table<type2take1.uint32_t>;
readonly keys: table<uint32_t>;
public push_vk(virtualKeyCode: type2take1.uint32_t): void;
public push_vk(virtualKeyCode: uint32_t): void;
public push_str(key: string): boolean;

View File

@@ -30,7 +30,7 @@ declare class RegexResult {
*/
constructor(type: "debug");
readonly count: type2take1.integer;
readonly count: integer;
readonly matches: string[];