zipped fonts together

master
Allen Webster 2017-07-18 17:19:28 -04:00
parent 179cbd7404
commit 1a629cedcc
11 changed files with 85 additions and 321 deletions

View File

@ -1014,8 +1014,6 @@ App_Init_Sig(app_init){
Partition *partition = &models->mem.part;
PRFL_INIT(memory->debug_memory, memory->debug_memory_size);
i32 panel_max_count = models->layout.panel_max_count = MAX_VIEWS;
i32 divider_max_count = panel_max_count - 1;
models->layout.panel_count = 0;
@ -1347,8 +1345,6 @@ App_Init_Sig(app_init){
}
App_Step_Sig(app_step){
PRFL_BEGIN_FRAME();
Application_Step_Result app_result = *app_result_;
app_result.animating = 0;
@ -2309,8 +2305,6 @@ App_Step_Sig(app_step){
*app_result_ = app_result;
// end-of-app_step
PRFL_END_FRAME("profile.data");
}
extern "C" App_Get_Functions_Sig(app_get_functions){

View File

@ -18,7 +18,6 @@
#include "4ed_math.h"
#include "4ed_system.h"
#include "4ed_profile.h"
// TODO(allen): set in compilation line
#define PREFERRED_ALIGNMENT 8

View File

@ -1372,20 +1372,12 @@ file_measure_wraps(System_Functions *system, Models *models, Editing_File *file,
i32 potential_count = 0;
i32 stage = 0;
PRFL_BEGIN_RESUMABLE(buffer_measure_wrap_y);
PRFL_BEGIN_RESUMABLE(NeedWrapDetermination);
PRFL_BEGIN_RESUMABLE(NeedLineShift);
PRFL_BEGIN_RESUMABLE(LongTokenParsing);
do{
PRFL_START_RESUMABLE(buffer_measure_wrap_y);
stop = buffer_measure_wrap_y(&state, params, current_line_shift, do_wrap, wrap_unit_end);
PRFL_STOP_RESUMABLE(buffer_measure_wrap_y);
switch (stop.status){
case BLStatus_NeedWrapDetermination:
{
PRFL_START_RESUMABLE(NeedWrapDetermination);
if (use_tokens){
if (stage == 0){
do_wrap = 0;
@ -1465,13 +1457,11 @@ file_measure_wraps(System_Functions *system, Models *models, Editing_File *file,
do_wrap = 0;
}
}
PRFL_STOP_RESUMABLE(NeedWrapDetermination);
}break;
case BLStatus_NeedWrapLineShift:
case BLStatus_NeedLineShift:
{
PRFL_START_RESUMABLE(NeedLineShift);
f32 current_width = width;
if (use_tokens){
@ -1510,7 +1500,6 @@ file_measure_wraps(System_Functions *system, Models *models, Editing_File *file,
b32 first_word = 1;
if (wrap_state.token_ptr->type == CPP_TOKEN_COMMENT || wrap_state.token_ptr->type == CPP_TOKEN_STRING_CONSTANT){
PRFL_START_RESUMABLE(LongTokenParsing);
i32 i = wrap_state.token_ptr->start;
i32 end_i = i + wrap_state.token_ptr->size;
@ -1631,8 +1620,6 @@ file_measure_wraps(System_Functions *system, Models *models, Editing_File *file,
potential_marks[potential_count] = potential_wrap;
++potential_count;
}
PRFL_STOP_RESUMABLE(LongTokenParsing);
}
if (!emit_comment_position){
@ -1803,17 +1790,10 @@ file_measure_wraps(System_Functions *system, Models *models, Editing_File *file,
file->state.line_indents[stop.wrap_line_index] = current_line_shift;
file->state.wrap_line_count = stop.wrap_line_index;
PRFL_STOP_RESUMABLE(NeedLineShift);
}break;
}
}while(stop.status != BLStatus_Finished);
PRFL_END_RESUMABLE(buffer_measure_wrap_y);
PRFL_END_RESUMABLE(NeedWrapDetermination);
PRFL_END_RESUMABLE(NeedLineShift);
PRFL_END_RESUMABLE(LongTokenParsing);
++file->state.wrap_line_count;
file_allocate_wrap_positions_as_needed(general, file, wrap_position_index);
@ -1880,7 +1860,6 @@ file_create_from_string(System_Functions *system, Models *models, Editing_File *
Render_Font *font = system->font.get_render_data_by_id(font_id);
{
PRFL_SCOPE_GROUP(measurements);
file_measure_starts(general, &file->state.buffer);
file_allocate_character_starts_as_needed(general, file);
@ -1919,7 +1898,6 @@ file_create_from_string(System_Functions *system, Models *models, Editing_File *
}
if (hook_open_file){
PRFL_SCOPE_GROUP(open_hook);
file->state.hacks.suppression_mode = true;
hook_open_file(app_links, file->id.id);
file->state.hacks.suppression_mode = false;

View File

@ -29,21 +29,26 @@
# define LOGF(...)
# endif
#else
#else /* Not platform layer */
# if defined(USE_LOG)
# define LOG(s,m) GEN_LOG((s)->log, m)
# define LOG(s,m) GEN_LOG((s)->log, m)
# else
# define LOG(s,m)
# define LOG(s,m)
# endif
# if defined(USE_LOGF)
# define LOGF(s,...) GEN_LOGF((s)->log, __VA_ARGS__)
# define LOGF(s,...) GEN_LOGF((s)->log, __VA_ARGS__)
# else
# define LOGF(s,...)
# define LOGF(s,...)
# endif
#endif
// HACK(allen): Get rid of this dependency. Implement snprintf ourself or something.
#if defined(USE_LOG)
# include <stdio.h>
#endif
// BOTTOM

View File

@ -9,8 +9,8 @@
// TOP
internal u32
directory_cd(char *dir, i32 *len, i32 cap, char *rel_path, i32 rel_len, char slash){
internal
Sys_Directory_CD_Sig(system_directory_cd){
String directory = make_string_cap(dir, *len, cap);
b32 result = false;
@ -26,7 +26,7 @@ directory_cd(char *dir, i32 *len, i32 cap, char *rel_path, i32 rel_len, char sla
if (directory.size + rel_len + 1 > directory.memory_size){
i32 old_size = directory.size;
append_partial_sc(&directory, rel_path);
append_s_char(&directory, slash);
append_s_char(&directory, SLASH);
terminate_with_null(&directory);
if (system_directory_exists(directory.str)){

View File

@ -1,37 +1,32 @@
/*
* Mr. 4th Dimention - Allen Webster
*
* 09.02.2016
* 18.07.2017
*
* Shared system functions
* Shared font functions
*
*/
// TOP
#include "4ed_system_shared.h"
#include "4ed_font_interface.h"
#include "4ed_font_interface_to_os.h"
#include "4ed_font_data.h"
struct Win32_Fonts{
struct Font_Vars{
Partition part;
Render_Font fonts[32];
u32 font_count;
};
global Win32_Fonts win32_fonts = {0};
global Font_Vars fontvars = {0};
internal
Sys_Font_Get_Count_Sig(system_font_get_count){
return(win32_fonts.font_count);
return(fontvars.font_count);
}
internal
Sys_Font_Get_IDs_By_Index_Sig(system_font_get_ids_by_index){
b32 result = false;
u32 stop_index = first_index + index_count;
if (stop_index <= win32_fonts.font_count){
if (stop_index <= fontvars.font_count){
result = true;
for (u32 i = first_index; i < stop_index; ++i){
id_out[i-first_index] = i;
@ -43,8 +38,8 @@ Sys_Font_Get_IDs_By_Index_Sig(system_font_get_ids_by_index){
internal
Sys_Font_Get_Name_By_Index_Sig(system_font_get_name_by_index){
u32 length = 0;
if (font_index < win32_fonts.font_count){
Render_Font *font = &win32_fonts.fonts[font_index];
if (font_index < fontvars.font_count){
Render_Font *font = &fontvars.fonts[font_index];
char *name = font->name;
length = font->name_len;
copy_partial_cs(str_out, str_out_cap, make_string(name, length));
@ -63,15 +58,15 @@ internal
Sys_Font_Get_Render_Data_By_ID_Sig(system_font_get_render_data_by_id){
Render_Font *result = 0;
u32 font_index = font_id;
if (font_index < win32_fonts.font_count){
result = &win32_fonts.fonts[font_index];
if (font_index < fontvars.font_count){
result = &fontvars.fonts[font_index];
}
return(result);
}
internal
Sys_Font_Load_Page_Sig(system_font_load_page){
system_set_page(&sysfunc, &win32_fonts.part, font, page, page_number, win32vars.settings.font_size, win32vars.settings.use_hinting);
system_set_page(&sysfunc, &fontvars.part, font, page, page_number, plat_settings.font_size, plat_settings.use_hinting);
}
internal
@ -80,6 +75,7 @@ Sys_Font_Allocate_Sig(system_font_allocate){
return(result);
}
// HACK(allen): Have to pass the size somehow or the free doesn't actually happen on linux.
internal
Sys_Font_Free_Sig(system_font_free){
system_memory_free(ptr, 0);
@ -112,10 +108,10 @@ Sys_Font_Init_Sig(system_font_init){
u32 dir_max = KB(32);
u8 *directory = push_array(scratch, u8, dir_max);
String dir_str = make_string_cap(directory, 0, dir_max);
u32 dir_len = system_get_binary_path_string(&dir_str);
u32 dir_len = dir_str.size = system_get_4ed_path(dir_str.str, dir_str.memory_size);
Assert(dir_len < dir_max);
set_last_folder_sc(&dir_str, "fonts", '\\');
set_last_folder_sc(&dir_str, "fonts", SLASH);
terminate_with_null(&dir_str);
dir_len = dir_str.size;
@ -150,20 +146,20 @@ Sys_Font_Init_Sig(system_font_init){
system_set_file_list(&file_list, 0, 0, 0, 0);
u32 font_count_max = ArrayCount(win32_fonts.fonts);
u32 font_count_max = ArrayCount(fontvars.fonts);
u32 font_count = 0;
u32 i = 0;
for (Font_Setup *ptr = first_setup; ptr != 0; ptr = ptr->next_font, ++i){
if (i < font_count_max){
Render_Font *render_font = &win32_fonts.fonts[i];
Render_Font *render_font = &fontvars.fonts[i];
system_set_font(&sysfunc, &win32_fonts.part, render_font, ptr->c_filename, font_size, use_hinting);
system_set_font(&sysfunc, &fontvars.part, render_font, ptr->c_filename, font_size, use_hinting);
}
++font_count;
}
win32_fonts.font_count = clamp_top(font_count, font_count_max);
fontvars.font_count = clamp_top(font_count, font_count_max);
end_temp_memory(temp);
}

View File

@ -43,7 +43,7 @@ init_shared_vars(){
internal b32
handle_track_out_of_memory(i32 val){
b32 result = 0;
b32 result = false;
switch (val){
case FileTrack_OutOfTableMemory:
@ -63,7 +63,7 @@ handle_track_out_of_memory(i32 val){
expand_track_system_listeners(&shared_vars.track, &shared_vars.scratch, node_expansion, shared_vars.track_node_size);
}break;
default: result = 1; break;
default: result = true; break;
}
return(result);
@ -212,7 +212,7 @@ internal b32
sysshared_to_binary_path(String *out_filename, char *filename){
b32 translate_success = 0;
i32 max = out_filename->memory_size;
i32 size = system_get_binary_path_string(out_filename);
i32 size = out_filename->size = system_get_4ed_path(out_filename->str, out_filename->memory_size);
if (size > 0 && size < max-1){
out_filename->size = size;
if (append_sc(out_filename, filename) && terminate_with_null(out_filename)){

View File

@ -11,6 +11,7 @@
// TOP
#define IS_PLAT_LAYER
#include "4ed_os_comp_cracking.h"
#include <string.h>
#include "4ed_defines.h"
@ -45,8 +46,6 @@
#include "4ed_font_interface_to_os.h"
#include "4ed_system_shared.h"
#include "unix_4ed_functions.cpp"
#include <math.h>
#include <stdlib.h>
@ -175,7 +174,6 @@ struct Linux_Vars{
i32 dpi_x, dpi_y;
Plat_Settings settings;
App_Functions app;
Custom_API custom_api;
b32 vsync;
@ -189,9 +187,12 @@ struct Linux_Vars{
global Linux_Vars linuxvars;
global System_Functions sysfunc;
global Application_Memory memory_vars;
global Plat_Settings plat_settings;
////////////////////////////////
#define SLASH '/'
internal Plat_Handle
handle_sem(sem_t *sem){
return(*(Plat_Handle*)&sem);
@ -237,6 +238,11 @@ system_schedule_step(){
////////////////////////////////
#include "unix_4ed_functions.cpp"
#include "4ed_shared_file_handling.cpp"
////////////////////////////////
internal void
LinuxSetWMState(Display* d, Window w, Atom one, Atom two, int mode){
//NOTE(inso): this will only work after it is mapped
@ -765,7 +771,7 @@ InitializeOpenGLContext(Display *XDisplay, Window XWindow, GLXFBConfig &bestFbc,
if (glXSwapIntervalSGI){
glXSwapIntervalSGI(1);
//NOTE(inso): The SGI one doesn't seem to have a way to confirm we got it...
// NOTE(inso): The SGI one doesn't seem to have a way to confirm we got it...
linuxvars.vsync = 1;
LOG("VSync enabled? hopefully (SGI)\n");
}
@ -1404,9 +1410,9 @@ size_change(i32 x, i32 y){
internal b32
LinuxX11WindowInit(int argc, char** argv, int* window_width, int* window_height){
if (linuxvars.settings.set_window_size){
*window_width = linuxvars.settings.window_w;
*window_height = linuxvars.settings.window_h;
if (plat_settings.set_window_size){
*window_width = plat_settings.window_w;
*window_height = plat_settings.window_h;
} else {
f32 schange = size_change(linuxvars.dpi_x, linuxvars.dpi_y);
*window_width = ceil32(BASE_W * schange);
@ -1469,10 +1475,10 @@ LinuxX11WindowInit(int argc, char** argv, int* window_width, int* window_height)
*/
sz_hints->win_gravity = NorthWestGravity;
if (linuxvars.settings.set_window_pos){
if (plat_settings.set_window_pos){
sz_hints->flags |= USPosition;
sz_hints->x = linuxvars.settings.window_x;
sz_hints->y = linuxvars.settings.window_y;
sz_hints->x = plat_settings.window_x;
sz_hints->y = plat_settings.window_y;
}
wm_hints->flags |= InputHint | StateHint;
@ -1505,14 +1511,14 @@ LinuxX11WindowInit(int argc, char** argv, int* window_width, int* window_height)
XRaiseWindow(linuxvars.XDisplay, linuxvars.XWindow);
if (linuxvars.settings.set_window_pos){
XMoveWindow(linuxvars.XDisplay, linuxvars.XWindow, linuxvars.settings.window_x, linuxvars.settings.window_y);
if (plat_settings.set_window_pos){
XMoveWindow(linuxvars.XDisplay, linuxvars.XWindow, plat_settings.window_x, plat_settings.window_y);
}
if (linuxvars.settings.maximize_window){
if (plat_settings.maximize_window){
LinuxMaximizeWindow(linuxvars.XDisplay, linuxvars.XWindow, 1);
}
else if (linuxvars.settings.fullscreen_window){
else if (plat_settings.fullscreen_window){
system_toggle_fullscreen();
}
@ -1900,7 +1906,7 @@ main(int argc, char **argv){
i32 *file_count;
i32 output_size;
output_size = linuxvars.app.read_command_line(&sysfunc, &memory_vars, current_directory, &linuxvars.settings, &files, &file_count, clparams);
output_size = linuxvars.app.read_command_line(&sysfunc, &memory_vars, current_directory, &plat_settings, &files, &file_count, clparams);
if (output_size > 0){
LOGF("%.*s", output_size, (char*)memory_vars.target_memory);
@ -1910,7 +1916,7 @@ main(int argc, char **argv){
return(1);
}
unixvars.use_log = linuxvars.settings.use_log;
unixvars.use_log = plat_settings.use_log;
sysshared_filter_real_files(files, file_count);
@ -1925,15 +1931,15 @@ main(int argc, char **argv){
custom_file_default = base_dir.str;
char *custom_file;
if (linuxvars.settings.custom_dll){
custom_file = linuxvars.settings.custom_dll;
if (plat_settings.custom_dll){
custom_file = plat_settings.custom_dll;
} else {
custom_file = custom_file_default;
}
linuxvars.custom = dlopen(custom_file, RTLD_LAZY);
if (!linuxvars.custom && custom_file != custom_file_default){
if (!linuxvars.settings.custom_dll_is_strict){
if (!plat_settings.custom_dll_is_strict){
linuxvars.custom = dlopen(custom_file_default, RTLD_LAZY);
}
}
@ -2091,7 +2097,7 @@ main(int argc, char **argv){
// Font System Init
//
system_font_init(&sysfunc.font, 0, 0, linuxvars.settings.font_size, linuxvars.settings.use_hinting);
system_font_init(&sysfunc.font, 0, 0, plat_settings.font_size, plat_settings.use_hinting);
//
// Epoll init
@ -2262,7 +2268,7 @@ main(int argc, char **argv){
return(0);
}
#include "linux_4ed_fonts.cpp"
#include "4ed_shared_fonts.cpp"
#include "linux_4ed_file_track.cpp"
#include "4ed_font_static_functions.cpp"

View File

@ -1,174 +0,0 @@
/*
* Mr. 4th Dimention - Allen Webster
*
* 09.02.2016
*
* Shared system functions
*
*/
// TOP
#include "4ed_system_shared.h"
#include "4ed_font_interface.h"
#include "4ed_font_interface_to_os.h"
#include "4ed_font_data.h"
struct Linux_Fonts{
Partition part;
Render_Font fonts[5];
u32 font_count;
};
global Linux_Fonts linux_fonts = {0};
internal
Sys_Font_Get_Count_Sig(system_font_get_count){
return(linux_fonts.font_count);
}
internal
Sys_Font_Get_IDs_By_Index_Sig(system_font_get_ids_by_index){
b32 result = false;
u32 stop_index = first_index + index_count;
if (stop_index <= linux_fonts.font_count){
result = true;
for (u32 i = first_index; i < stop_index; ++i){
id_out[i-first_index] = i;
}
}
return(result);
}
internal
Sys_Font_Get_Name_By_Index_Sig(system_font_get_name_by_index){
u32 length = 0;
if (font_index < linux_fonts.font_count){
Render_Font *font = &linux_fonts.fonts[font_index];
char *name = font->name;
length = font->name_len;
copy_partial_cs(str_out, str_out_cap, make_string(name, length));
}
return(length);
}
internal
Sys_Font_Get_Name_By_ID_Sig(system_font_get_name_by_id){
u32 font_index = font_id;
u32 result = system_font_get_name_by_index(font_index, str_out, str_out_cap);
return(result);
}
internal
Sys_Font_Get_Render_Data_By_ID_Sig(system_font_get_render_data_by_id){
Render_Font *result = 0;
u32 font_index = font_id;
if (font_index < linux_fonts.font_count){
result = &linux_fonts.fonts[font_index];
}
return(result);
}
internal
Sys_Font_Load_Page_Sig(system_font_load_page){
system_set_page(&sysfunc, &linux_fonts.part, font, page, page_number, linuxvars.settings.font_size, linuxvars.settings.use_hinting);
}
internal
Sys_Font_Allocate_Sig(system_font_allocate){
void *result = system_memory_allocate(size);
return(result);
}
internal
Sys_Font_Free_Sig(system_font_free){
system_memory_free(ptr, 0);
}
internal
Sys_Font_Init_Sig(system_font_init){
Partition *scratch = &shared_vars.scratch;
Temp_Memory temp = begin_temp_memory(scratch);
font->get_count = system_font_get_count;
font->get_ids_by_index = system_font_get_ids_by_index;
font->get_name_by_index = system_font_get_name_by_index;
font->get_name_by_id = system_font_get_name_by_id;
font->get_render_data_by_id = system_font_get_render_data_by_id;
font->load_page = system_font_load_page;
font->allocate = system_font_allocate;
font->free = system_font_free;
font_size = clamp_bottom(8, font_size);
struct Font_Setup{
Font_Setup *next_font;
char *c_filename;
};
Font_Setup *first_setup = 0;
Font_Setup *head_setup = 0;
u32 dir_max = KB(32);
u8 *directory = push_array(scratch, u8, dir_max);
String dir_str = make_string_cap(directory, 0, dir_max);
u32 dir_len = system_get_binary_path_string(&dir_str);
Assert(dir_len < dir_max);
set_last_folder_sc(&dir_str, "fonts", '/');
terminate_with_null(&dir_str);
dir_len = dir_str.size;
partition_reduce(scratch, dir_max - dir_len - 1);
partition_align(scratch, 8);
File_List file_list = {0};
system_set_file_list(&file_list, (char*)directory, 0, 0, 0);
for (u32 i = 0; i < file_list.count; ++i){
File_Info *info = &file_list.infos[i];
if (first_setup == 0){
first_setup = push_struct(scratch, Font_Setup);
head_setup = first_setup;
}
else{
head_setup->next_font = push_struct(scratch, Font_Setup);
head_setup = head_setup->next_font;
}
head_setup->next_font = 0;
char *filename = info->filename;
u32 len = 0;
for (;filename[len];++len);
head_setup->c_filename = push_array(scratch, char, dir_len+len+1);
memcpy(head_setup->c_filename, directory, dir_len);
memcpy(head_setup->c_filename + dir_len, filename, len+1);
partition_align(scratch, 8);
}
system_set_file_list(&file_list, 0, 0, 0, 0);
u32 font_count_max = ArrayCount(linux_fonts.fonts);
u32 font_count = 0;
u32 i = 0;
for (Font_Setup *ptr = first_setup; ptr != 0; ptr = ptr->next_font, ++i){
if (i < font_count_max){
Render_Font *render_font = &linux_fonts.fonts[i];
system_set_font(&sysfunc, &linux_fonts.part, render_font, ptr->c_filename, font_size, use_hinting);
}
++font_count;
}
linux_fonts.font_count = clamp_top(font_count, font_count_max);
end_temp_memory(temp);
}
// BOTTOM

View File

@ -439,42 +439,6 @@ system_directory_exists(char *path){
return(result);
}
internal
Sys_Directory_CD_Sig(system_directory_cd){
String directory = make_string_cap(dir, *len, cap);
b32 result = false;
if (rel_path[0] != 0){
if (rel_path[0] == '.' && rel_path[1] == 0){
result = true;
}
else if (rel_path[0] == '.' && rel_path[1] == '.' && rel_path[2] == 0){
result = remove_last_folder(&directory);
terminate_with_null(&directory);
}
else{
if (directory.size + rel_len + 1 > directory.memory_size){
i32 old_size = directory.size;
append_partial_sc(&directory, rel_path);
append_s_char(&directory, '/');
terminate_with_null(&directory);
if (system_directory_exists(directory.str)){
result = true;
}
else{
directory.size = old_size;
}
}
}
}
*len = directory.size;
LOGF("%.*s: %d\n", directory.size, directory.str, result);
return(result);
}
//
// Time
//

View File

@ -10,10 +10,8 @@
// TOP
#define IS_PLAT_LAYER
#include "4ed_os_comp_cracking.h"
//
// Program setup
//
@ -119,7 +117,6 @@ struct Win32_Vars{
Custom_API custom_api;
HMODULE app_code;
HMODULE custom;
Plat_Settings settings;
Win32_Coroutine coroutine_data[18];
Win32_Coroutine *coroutine_free;
@ -161,9 +158,12 @@ struct Win32_Vars{
global Win32_Vars win32vars;
global System_Functions sysfunc;
global Application_Memory memory_vars;
global Plat_Settings plat_settings;
////////////////////////////////
#define SLASH '\\'
internal HANDLE
handle_type(Plat_Handle h){
HANDLE result;
@ -209,7 +209,7 @@ Sys_Get_4ed_Path_Sig(system_get_4ed_path){
internal
Sys_Log_Sig(system_log){
if (win32vars.settings.use_log){
if (plat_settings.use_log){
u8 space[4096];
String str = make_fixed_width_string(space);
str.size = system_get_4ed_path(str.str, str.memory_size);
@ -586,14 +586,6 @@ system_directory_exists(char *path){
return(attrib != INVALID_FILE_ATTRIBUTES && (attrib & FILE_ATTRIBUTE_DIRECTORY));
}
#include "4ed_shared_file_handling.cpp"
internal
Sys_Directory_CD_Sig(system_directory_cd){
u32 result = directory_cd(dir, len, cap, rel_path, rel_len, '\\');
return(result);
}
//
// Time
//
@ -606,6 +598,10 @@ Sys_Now_Time_Sig(system_now_time){
////////////////////////////////
#include "4ed_shared_file_handling.cpp"
////////////////////////////////
//
// Threads
//
@ -981,7 +977,7 @@ Sys_Toggle_Fullscreen_Sig(system_toggle_fullscreen){
b32 success = false;
// NOTE(allen): On windows we must be in stream mode to go fullscreen.
if (win32vars.settings.stream_mode){
if (plat_settings.stream_mode){
win32vars.do_toggle = !win32vars.do_toggle;
success = true;
}
@ -1619,7 +1615,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
char **files = 0;
i32 *file_count = 0;
win32vars.app.read_command_line(&sysfunc, &memory_vars, current_directory, &win32vars.settings, &files, &file_count, clparams);
win32vars.app.read_command_line(&sysfunc, &memory_vars, current_directory, &plat_settings, &files, &file_count, clparams);
sysshared_filter_real_files(files, file_count);
LOG("Loaded system code, read command line.\n");
@ -1631,8 +1627,8 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
#if defined(FRED_SUPER)
char *custom_file_default = "custom_4coder.dll";
char *custom_file = 0;
if (win32vars.settings.custom_dll){
custom_file = win32vars.settings.custom_dll;
if (plat_settings.custom_dll){
custom_file = plat_settings.custom_dll;
}
else{
custom_file = custom_file_default;
@ -1641,7 +1637,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
LOGF("Trying to load custom DLL: %s\n", custom_file);
win32vars.custom = LoadLibraryA(custom_file);
if (!win32vars.custom && custom_file != custom_file_default){
if (!win32vars.settings.custom_dll_is_strict){
if (!plat_settings.custom_dll_is_strict){
LOGF("Trying to load custom DLL: %s\n", custom_file_default);
win32vars.custom = LoadLibraryA(custom_file_default);
}
@ -1683,9 +1679,9 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
}
RECT window_rect = {0};
if (win32vars.settings.set_window_size){
window_rect.right = win32vars.settings.window_w;
window_rect.bottom = win32vars.settings.window_h;
if (plat_settings.set_window_size){
window_rect.right = plat_settings.window_w;
window_rect.bottom = plat_settings.window_h;
}
else{
window_rect.right = 800;
@ -1699,14 +1695,14 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
i32 window_x = CW_USEDEFAULT;
i32 window_y = CW_USEDEFAULT;
if (win32vars.settings.set_window_pos){
window_x = win32vars.settings.window_x;
window_y = win32vars.settings.window_y;
if (plat_settings.set_window_pos){
window_x = plat_settings.window_x;
window_y = plat_settings.window_y;
LOGF("Setting window position (%d, %d)\n", window_x, window_y);
}
i32 window_style = WS_OVERLAPPEDWINDOW;
if (!win32vars.settings.fullscreen_window && win32vars.settings.maximize_window){
if (!plat_settings.fullscreen_window && plat_settings.maximize_window){
window_style |= WS_MAXIMIZE;
}
@ -1741,7 +1737,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
//
LOG("Initializing fonts\n");
system_font_init(&sysfunc.font, 0, 0, win32vars.settings.font_size, win32vars.settings.use_hinting);
system_font_init(&sysfunc.font, 0, 0, plat_settings.font_size, plat_settings.use_hinting);
//
// Misc System Initializations
@ -1798,7 +1794,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
win32vars.first = true;
timeBeginPeriod(1);
if (win32vars.settings.fullscreen_window){
if (plat_settings.fullscreen_window){
Win32ToggleFullscreen();
}
@ -1821,7 +1817,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
// the first step right away so it will render into the
// window. With double buffering this is not an issue
// for reasons I cannot at all comprehend.
if (!(win32vars.first && win32vars.settings.stream_mode)){
if (!(win32vars.first && plat_settings.stream_mode)){
system_release_lock(FRAME_LOCK);
if (win32vars.running_cli == 0){
@ -2033,7 +2029,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
return(0);
}
#include "win32_4ed_fonts.cpp"
#include "4ed_shared_fonts.cpp"
#include "win32_4ed_file_track.cpp"
#include "4ed_font_static_functions.cpp"
#include "win32_utf8.cpp"