BFR 2 (Big Fucking Restructureixon) (dos)
Este es el primer commit de la reestructuració. En caso de pánico, tornar al commit anterior. - [FIX] Llevada basura varia (pos no en queda...) - [NEW] mogut el codi font a ./source/ - [NEW] lagueirtofile nou per a compilar en windows y linux, release i debug. mac res, que no se ni si funciona lagueirto. - [NEW] WARNING!!! make ja no funciona. Mantinc encara el Makefile per a referència.
This commit is contained in:
1 parent
5c0b046ad8
commit
f4eac55989
79 files changed
+59
-146
No files matched your search
+24
-2
@@ -1,5 +1,27 @@
|
|||||||
|
[linux]
|
||||||
|
cppflags = -D LUA_USE_LINUX -Wall -Os -ffunction-sections -fdata-sections -std=c++20
|
||||||
|
libs = -Wl,--gc-sections -lSDL3 -lGL
|
||||||
|
executable = mini
|
||||||
|
sourcepath = source+
|
||||||
|
buildpath = build
|
||||||
|
|
||||||
|
[linux_debug] default
|
||||||
|
cppflags = -D LUA_USE_LINUX -D DEBUG -g -Wall -std=c++20
|
||||||
libs = -lSDL3 -lGL
|
libs = -lSDL3 -lGL
|
||||||
cppflags = -D LUA_USE_LINUX -D DEBUG -g -Wall -std=c++20
|
|
||||||
executable = mini_debug
|
executable = mini_debug
|
||||||
sourcepath = . lua
|
sourcepath = source+
|
||||||
|
buildpath = build
|
||||||
|
|
||||||
|
[windows]
|
||||||
|
cppflags = -Wall -Os -ffunction-sections -fdata-sections -std=c++20
|
||||||
|
libs = icon.res -Wl,--gc-sections -lmingw32 -lSDL3 -lopengl32 -static-libstdc++ -static-libgcc -lpthread -mwindows
|
||||||
|
executable = mini.exe
|
||||||
|
sourcepath = source+
|
||||||
|
buildpath = build
|
||||||
|
|
||||||
|
[windows_debug]
|
||||||
|
cppflags = -D DEBUG -g -Wall -std=c++20
|
||||||
|
libs = -lmingw32 -lSDL3 -lopengl32
|
||||||
|
executable = mini_debug.exe
|
||||||
|
sourcepath = source+
|
||||||
buildpath = build
|
buildpath = build
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1844,12 +1844,8 @@ extern "C" {
|
|||||||
const char* str = luaL_checkstring(L, 1);
|
const char* str = luaL_checkstring(L, 1);
|
||||||
int x = luaL_checknumber(L, 2);
|
int x = luaL_checknumber(L, 2);
|
||||||
int y = luaL_checknumber(L, 3);
|
int y = luaL_checknumber(L, 3);
|
||||||
if (lua_gettop(L) > 3) {
|
uint8_t color = luaL_checkinteger(L, 4);
|
||||||
uint8_t color = luaL_checkinteger(L, 4);
|
print(str, x, y, color);
|
||||||
print(str, x, y, color);
|
|
||||||
} else {
|
|
||||||
print(str, x, y);
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+33
-137
@@ -70,9 +70,6 @@ uint8_t tile_height = 8;
|
|||||||
|
|
||||||
font_t fonts[MAX_FONTS];
|
font_t fonts[MAX_FONTS];
|
||||||
font_t *current_font;
|
font_t *current_font;
|
||||||
FILE *file = NULL;
|
|
||||||
//uint8_t file_mode = 0;
|
|
||||||
bool file_ignore_comma=true;
|
|
||||||
|
|
||||||
char main_lua_file[200] = "main.lua";
|
char main_lua_file[200] = "main.lua";
|
||||||
bool override_ini = false;
|
bool override_ini = false;
|
||||||
@@ -90,7 +87,6 @@ namespace ds {
|
|||||||
uint8_t back_color = 0;
|
uint8_t back_color = 0;
|
||||||
int origin[2] = {0, 0};
|
int origin[2] = {0, 0};
|
||||||
int clip[4] = {0, 0, screen_width-1, screen_height-1}; // clip (x1,y1,x2,y2) calculat intersectat amb el tamany de la surface 'dest'
|
int clip[4] = {0, 0, screen_width-1, screen_height-1}; // clip (x1,y1,x2,y2) calculat intersectat amb el tamany de la surface 'dest'
|
||||||
int clp[4] = {0, 0, screen_width, screen_height}; // clip (x1,y1,w,h) que ha especificat l'usuari
|
|
||||||
uint8_t trans = 0;
|
uint8_t trans = 0;
|
||||||
uint16_t fill_pattern = 0b1111111111111111;
|
uint16_t fill_pattern = 0b1111111111111111;
|
||||||
bool fill_trans = false;
|
bool fill_trans = false;
|
||||||
@@ -114,14 +110,14 @@ int pitch;
|
|||||||
uint32_t palette[256] = { 0xFF1a1c2c, 0xFF5d275d, 0xFFb13e53, 0xFFef7d57, 0xFFffcd75, 0xFFa7f070, 0xFF38b764, 0xFF257179,
|
uint32_t palette[256] = { 0xFF1a1c2c, 0xFF5d275d, 0xFFb13e53, 0xFFef7d57, 0xFFffcd75, 0xFFa7f070, 0xFF38b764, 0xFF257179,
|
||||||
0xFF29366f, 0xFF3b5dc9, 0xFF41a6f6, 0xFF73eff7, 0xFFf4f4f4, 0xFF94b0c2, 0xFF566c86, 0xFF333c57 };
|
0xFF29366f, 0xFF3b5dc9, 0xFF41a6f6, 0xFF73eff7, 0xFFf4f4f4, 0xFF94b0c2, 0xFF566c86, 0xFF333c57 };
|
||||||
|
|
||||||
const char base64[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
//const char base64[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||||
|
//
|
||||||
char base64font[241] = "00@B@]0X__OnZDYK[G10:9BTDEG5j20@1h000RB:_]OBjW?odl]Wlil9_oTT__omT@@02:DA477ADid@Z=nm]_[g9a[]oIi?;a9m]_mBjGB[M]99o_][]e]M"
|
//char base64font[241] = "00@B@]0X__OnZDYK[G10:9BTDEG5j20@1h000RB:_]OBjW?odl]Wlil9_oTT__omT@@02:DA477ADid@Z=nm]_[g9a[]oIi?;a9m]_mBjGB[M]99o_][]e]M"
|
||||||
"_?A]c_[eiLGBZ]e]mZ]o]Z]mlW:O9IABdTdZ000hR00__H[7?iH]3Oih;1?mXm5GjhB3M]897o]H]5^Mhm1ZchM5>LhB2]eXm2]oXZ5mlh<gJbBBJbJP?0Zm";
|
// "_?A]c_[eiLGBZ]e]mZ]o]Z]mlW:O9IABdTdZ000hR00__H[7?iH]3Oih;1?mXm5GjhB3M]897o]H]5^Mhm1ZchM5>LhB2]eXm2]oXZ5mlh<gJbBBJbJP?0Zm";
|
||||||
uint16_t font[96];
|
//uint16_t font[96];
|
||||||
|
//
|
||||||
char base64glyphs[193] = "/h/AqV/hhhh/GMYYMGz/t/eS33H477wsjjswY4IOPHEFFVVVAVAVAVIc+dJHMMM/h/qBgBgVqq+//eIUi/dJzhAAhzAAA/eM"
|
//char base64glyphs[193] = "/h/AqV/hhhh/GMYYMGz/t/eS33H477wsjjswY4IOPHEFFVVVAVAVAVIc+dJHMMM/h/qBgBgVqq+//eIUi/dJzhAAhzAAA/eM"
|
||||||
"AMShAAAQsjAAAwsjAAAeSzAAAcU3AAAEqRAAABVaiAAMezhAAAAAMAADH4wAASb2SAAMAttAQYcefACGOe+AAAVVAAAAbbAA";
|
// "AMShAAAQsjAAAwsjAAAeSzAAAcU3AAAEqRAAABVaiAAMezhAAAAAMAADH4wAASb2SAAMAttAQYcefACGOe+AAAVVAAAAbbAA";
|
||||||
|
|
||||||
//Uint8 keymapping[6] = { SDL_SCANCODE_LEFT, SDL_SCANCODE_RIGHT, SDL_SCANCODE_UP, SDL_SCANCODE_DOWN, SDL_SCANCODE_Z, SDL_SCANCODE_X };
|
//Uint8 keymapping[6] = { SDL_SCANCODE_LEFT, SDL_SCANCODE_RIGHT, SDL_SCANCODE_UP, SDL_SCANCODE_DOWN, SDL_SCANCODE_Z, SDL_SCANCODE_X };
|
||||||
const bool *keys;
|
const bool *keys;
|
||||||
@@ -245,23 +241,14 @@ void reinit() {
|
|||||||
ds::back_color = 0;
|
ds::back_color = 0;
|
||||||
ds::origin[0] = ds::origin[1] = 0;
|
ds::origin[0] = ds::origin[1] = 0;
|
||||||
ds::clip[0] = ds::clip[1] = 0; ds::clip[2] = screen_width-1; ds::clip[3] = screen_height-1;
|
ds::clip[0] = ds::clip[1] = 0; ds::clip[2] = screen_width-1; ds::clip[3] = screen_height-1;
|
||||||
ds::clp[0] = ds::clp[1] = 0; ds::clp[2] = screen_width; ds::clp[3] = screen_height;
|
|
||||||
ds::trans=0;
|
ds::trans=0;
|
||||||
ds::fill_pattern = 0b1111111111111111;
|
ds::fill_pattern = 0b1111111111111111;
|
||||||
ds::fill_trans = false;
|
ds::fill_trans = false;
|
||||||
for (unsigned int i=1; i<MAX_SURFACES; ++i) freesurf(i);
|
for (unsigned int i=0; i<MAX_SURFACES; ++i) freesurf(i);
|
||||||
/*{
|
setdest(newsurf(screen_width, screen_height));
|
||||||
if (surfaces[i].p != NULL) free(surfaces[i].p);
|
|
||||||
surfaces[i].p = NULL;
|
|
||||||
if (surfaces[i].name != NULL) free(surfaces[i].name);
|
|
||||||
surfaces[i].name = NULL;
|
|
||||||
}
|
|
||||||
surfaces.clear();*/
|
|
||||||
dest_surface = screen_surface;
|
dest_surface = screen_surface;
|
||||||
|
|
||||||
for (int i=0;i<256;++i) ds::draw_palette[i]=i;
|
for (int i=0;i<256;++i) ds::draw_palette[i]=i;
|
||||||
if (file!=NULL) fclose(file);
|
|
||||||
file = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void initaudio() {
|
void initaudio() {
|
||||||
@@ -410,10 +397,6 @@ int surfh(uint8_t surface) {
|
|||||||
|
|
||||||
void recalculate_clip()
|
void recalculate_clip()
|
||||||
{
|
{
|
||||||
ds::clip[0] = ds::clp[0];
|
|
||||||
ds::clip[1] = ds::clp[1];
|
|
||||||
ds::clip[2] = ds::clp[2]+ds::clp[0]-1;
|
|
||||||
ds::clip[3] = ds::clp[3]+ds::clp[1]-1;
|
|
||||||
if (ds::clip[0]<0) ds::clip[0]=0;
|
if (ds::clip[0]<0) ds::clip[0]=0;
|
||||||
if (ds::clip[1]<0) ds::clip[1]=0;
|
if (ds::clip[1]<0) ds::clip[1]=0;
|
||||||
if (ds::clip[2]>=dest_surface->w) ds::clip[2]=dest_surface->w-1;
|
if (ds::clip[2]>=dest_surface->w) ds::clip[2]=dest_surface->w-1;
|
||||||
@@ -572,8 +555,6 @@ void createDisplay() {
|
|||||||
windowID = SDL_GetWindowID(mini_win);
|
windowID = SDL_GetWindowID(mini_win);
|
||||||
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl");
|
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl");
|
||||||
mini_ren = SDL_CreateRenderer(mini_win, NULL);
|
mini_ren = SDL_CreateRenderer(mini_win, NULL);
|
||||||
//SDL_CreateWindowAndRenderer(512,512,0,&mini_win,&mini_ren);
|
|
||||||
//SDL_SetRenderLogicalPresentation(mini_ren, screen_width, screen_height);
|
|
||||||
if (screen_cursor) SDL_ShowCursor(); else SDL_HideCursor();
|
if (screen_cursor) SDL_ShowCursor(); else SDL_HideCursor();
|
||||||
mini_bak = SDL_CreateTexture(mini_ren, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, screen_width, screen_height);
|
mini_bak = SDL_CreateTexture(mini_ren, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, screen_width, screen_height);
|
||||||
SDL_SetTextureScaleMode(mini_bak, SDL_SCALEMODE_NEAREST);
|
SDL_SetTextureScaleMode(mini_bak, SDL_SCALEMODE_NEAREST);
|
||||||
@@ -585,15 +566,13 @@ void createDisplay() {
|
|||||||
}
|
}
|
||||||
mini_shadertex = SDL_CreateTexture(mini_ren, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_TARGET, screen_width*screen_zoom, screen_height*screen_zoom);
|
mini_shadertex = SDL_CreateTexture(mini_ren, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_TARGET, screen_width*screen_zoom, screen_height*screen_zoom);
|
||||||
SDL_SetTextureScaleMode(mini_shadertex, SDL_SCALEMODE_NEAREST);
|
SDL_SetTextureScaleMode(mini_shadertex, SDL_SCALEMODE_NEAREST);
|
||||||
|
|
||||||
//int filesize;
|
|
||||||
//char *shaderfile = file_getfilebuffer("lynx.glsl", filesize);
|
|
||||||
shader::init(mini_win, mini_shadertex, nullptr);
|
shader::init(mini_win, mini_shadertex, nullptr);
|
||||||
//SDL_GetWindowPosition(mini_win, &windowpos_x, &windowpos_y);
|
|
||||||
log_msg(LOG_OK, "Graphics subsystem initialized\n");
|
log_msg(LOG_OK, "Graphics subsystem initialized\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void destroyDisplay() {
|
void destroyDisplay() {
|
||||||
|
SDL_DestroyTexture(mini_shadertex);
|
||||||
SDL_DestroyTexture(mini_bak);
|
SDL_DestroyTexture(mini_bak);
|
||||||
SDL_DestroyRenderer(mini_ren);
|
SDL_DestroyRenderer(mini_ren);
|
||||||
SDL_DestroyWindow(mini_win);
|
SDL_DestroyWindow(mini_win);
|
||||||
@@ -619,13 +598,12 @@ void initGamePad() {
|
|||||||
int main(int argc,char*argv[]){
|
int main(int argc,char*argv[]){
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
SDL_SetLogPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG);
|
SDL_SetLogPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG);
|
||||||
|
log_msg(LOG_UNSALTED, "MINI v%s\n",MINI_VERSION);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
// Gestió de arguments
|
||||||
log_msg(LOG_UNSALTED, "MINI v%s\n",MINI_VERSION);
|
// ===============================================================
|
||||||
#endif
|
|
||||||
|
|
||||||
if (argc>1)
|
if (argc>1)
|
||||||
{
|
{
|
||||||
if (argv[1][0]=='-' && argv[1][1]=='-') {
|
if (argv[1][0]=='-' && argv[1][1]=='-') {
|
||||||
@@ -634,7 +612,6 @@ int main(int argc,char*argv[]){
|
|||||||
createNewProject();
|
createNewProject();
|
||||||
exit(0);
|
exit(0);
|
||||||
} else if (strcmp(command, "version")==0) {
|
} else if (strcmp(command, "version")==0) {
|
||||||
//createNewProject();
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
} else if (strstr(argv[1], ".lua")!=nullptr) {
|
} else if (strstr(argv[1], ".lua")!=nullptr) {
|
||||||
@@ -646,35 +623,32 @@ int main(int argc,char*argv[]){
|
|||||||
} else if (strstr(argv[1], ".jf2")!=nullptr) {
|
} else if (strstr(argv[1], ".jf2")!=nullptr) {
|
||||||
file_setresourcefilename(argv[1]);
|
file_setresourcefilename(argv[1]);
|
||||||
file_setsource(SOURCE_FILE);
|
file_setsource(SOURCE_FILE);
|
||||||
//strcpy(main_lua_file, argv[1]);
|
|
||||||
//strcpy(window_title, argv[1]);
|
|
||||||
//override_ini = true;
|
|
||||||
} else {
|
} else {
|
||||||
char path[256] = "./";
|
char path[256] = "./";
|
||||||
strcat(path, argv[1]);
|
strcat(path, argv[1]);
|
||||||
file_setresourcefolder(path);
|
file_setresourcefolder(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef MACOS_BUNDLE
|
||||||
|
char res_file[255] = "";
|
||||||
|
strcpy(res_file, dirname(argv[0]));
|
||||||
|
strcat(res_file, "/../Resources/data.jrf");
|
||||||
|
file_setresourcefilename(res_file);
|
||||||
|
#endif
|
||||||
|
|
||||||
//screen_surface = &surfaces.emplace_back();
|
|
||||||
while (!should_quit) {
|
while (!should_quit) {
|
||||||
should_exit=false;
|
should_exit=false;
|
||||||
|
|
||||||
// initfont()
|
// initfont()
|
||||||
|
|
||||||
int bi = 0;
|
//int bi = 0;
|
||||||
for (int ci=0; ci<96; ci+=2) {
|
//for (int ci=0; ci<96; ci+=2) {
|
||||||
font[ci] = base64font[bi] - 48 + ( ( base64font[bi+1] - 48 ) << 6) + ( ( ( base64font[bi+2] - 48 ) & 7 ) << 12 );
|
// font[ci] = base64font[bi] - 48 + ( ( base64font[bi+1] - 48 ) << 6) + ( ( ( base64font[bi+2] - 48 ) & 7 ) << 12 );
|
||||||
font[ci+1] = ( ( base64font[bi+2] - 48 ) >> 3 ) + ( ( base64font[bi+3] - 48 ) << 3 ) + ( ( base64font[bi+4] - 48 ) << 9 );
|
// font[ci+1] = ( ( base64font[bi+2] - 48 ) >> 3 ) + ( ( base64font[bi+3] - 48 ) << 3 ) + ( ( base64font[bi+4] - 48 ) << 9 );
|
||||||
bi += 5;
|
// bi += 5;
|
||||||
}
|
//}
|
||||||
|
|
||||||
#ifdef MACOS_BUNDLE
|
// READ INI
|
||||||
char res_file[255] = "";
|
|
||||||
strcpy(res_file, dirname(argv[0]));
|
|
||||||
strcat(res_file, "/../Resources/data.jrf");
|
|
||||||
file_setresourcefilename(res_file);
|
|
||||||
#endif
|
|
||||||
if (!override_ini)
|
if (!override_ini)
|
||||||
{
|
{
|
||||||
read_ini();
|
read_ini();
|
||||||
@@ -691,8 +665,6 @@ int main(int argc,char*argv[]){
|
|||||||
if (sound_enabled) JA_EnableSound(strcmp(sound_enabled, "true")==0?true:false);
|
if (sound_enabled) JA_EnableSound(strcmp(sound_enabled, "true")==0?true:false);
|
||||||
}
|
}
|
||||||
|
|
||||||
setdest(newsurf(screen_width, screen_height));
|
|
||||||
|
|
||||||
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_GAMEPAD);
|
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_GAMEPAD);
|
||||||
|
|
||||||
const SDL_DisplayMode *dm = SDL_GetDesktopDisplayMode(SDL_GetPrimaryDisplay());
|
const SDL_DisplayMode *dm = SDL_GetDesktopDisplayMode(SDL_GetPrimaryDisplay());
|
||||||
@@ -703,10 +675,6 @@ int main(int argc,char*argv[]){
|
|||||||
|
|
||||||
initGamePad();
|
initGamePad();
|
||||||
|
|
||||||
//Mix_Init(MIX_INIT_OGG);
|
|
||||||
|
|
||||||
SDL_Event mini_eve;
|
|
||||||
|
|
||||||
reinit();
|
reinit();
|
||||||
initaudio();
|
initaudio();
|
||||||
|
|
||||||
@@ -725,9 +693,11 @@ int main(int argc,char*argv[]){
|
|||||||
mouse_wheel = 0;
|
mouse_wheel = 0;
|
||||||
double_click = false;
|
double_click = false;
|
||||||
has_text_input = false;
|
has_text_input = false;
|
||||||
|
|
||||||
while(!should_exit) {
|
while(!should_exit) {
|
||||||
if (update_mode==UPDATE_WAIT) SDL_WaitEvent(NULL);
|
if (update_mode==UPDATE_WAIT) SDL_WaitEvent(NULL);
|
||||||
else if (update_mode==UPDATE_TIMEOUT) SDL_WaitEventTimeout(NULL, timeout);
|
else if (update_mode==UPDATE_TIMEOUT) SDL_WaitEventTimeout(NULL, timeout);
|
||||||
|
SDL_Event mini_eve;
|
||||||
while(SDL_PollEvent(&mini_eve)) {
|
while(SDL_PollEvent(&mini_eve)) {
|
||||||
if (mini_eve.type == SDL_EVENT_QUIT) { should_exit=true; should_quit=true; break; }
|
if (mini_eve.type == SDL_EVENT_QUIT) { should_exit=true; should_quit=true; break; }
|
||||||
if (mini_eve.type == SDL_EVENT_TEXT_INPUT) {
|
if (mini_eve.type == SDL_EVENT_TEXT_INPUT) {
|
||||||
@@ -738,13 +708,6 @@ int main(int argc,char*argv[]){
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (mini_eve.key.scancode == SDL_SCANCODE_F12) {
|
if (mini_eve.key.scancode == SDL_SCANCODE_F12) {
|
||||||
reloadsurfs();
|
reloadsurfs();
|
||||||
//if (lua_is_playing()) {
|
|
||||||
// lua_quit();
|
|
||||||
// quitaudio();
|
|
||||||
// reinit();
|
|
||||||
//} else {
|
|
||||||
// should_exit=true;
|
|
||||||
//}
|
|
||||||
} else if (mini_eve.key.scancode == SDL_SCANCODE_F11) {
|
} else if (mini_eve.key.scancode == SDL_SCANCODE_F11) {
|
||||||
lua_toggle_debug();
|
lua_toggle_debug();
|
||||||
} else if (mini_eve.key.scancode == SDL_SCANCODE_F5) {
|
} else if (mini_eve.key.scancode == SDL_SCANCODE_F5) {
|
||||||
@@ -849,12 +812,6 @@ void simple_pset(int x, int y, uint8_t color) {
|
|||||||
|
|
||||||
void cls(uint8_t color) {
|
void cls(uint8_t color) {
|
||||||
const uint8_t col = ds::draw_palette[color];
|
const uint8_t col = ds::draw_palette[color];
|
||||||
/*for (int y=ds::clip[1]; y<=ds::clip[3];++y) {
|
|
||||||
for (int x=ds::clip[0]; x<=ds::clip[2];++x) {
|
|
||||||
simple_pset(x,y,col);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
SDL_memset(dest_surface->p, col, dest_surface->size);
|
SDL_memset(dest_surface->p, col, dest_surface->size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1059,63 +1016,6 @@ void fillp(uint16_t pat, bool transparent) {
|
|||||||
ds::fill_pattern = pat;
|
ds::fill_pattern = pat;
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_symbol(char sym, int x, int y) {
|
|
||||||
switch(sym) {
|
|
||||||
case 1: pset(x, y-3); pset(x+1, y-2); break;
|
|
||||||
case 2: pset(x+1, y-2); pset(x+2, y-3); break;
|
|
||||||
case 3: pset(x+1, y+5); break;
|
|
||||||
case 4: pset(x, y-2); pset(x+1, y-2); pset(x+2, y-2); break;
|
|
||||||
case 5: pset(x, y-2); pset(x+1, y-1); break;
|
|
||||||
case 6: pset(x+1, y-1); pset(x+2, y-2); break;
|
|
||||||
case 7: pset(x, y-1); pset(x+1, y-1); pset(x+2, y-1); break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void print_char(char chr, int x, int y) {
|
|
||||||
int xi = 0, yi = 0;
|
|
||||||
uint16_t val = 1;
|
|
||||||
while(1) {
|
|
||||||
if (font[chr-32] & val) pset(x+xi, y+yi);
|
|
||||||
if (xi<2) xi++; else { if (yi==4) return; else { xi=0; yi++; } }
|
|
||||||
val <<= 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void print_char_hv(char chr, int x, int y) {
|
|
||||||
int xi = 0, yi = 0;
|
|
||||||
uint16_t val = 1;
|
|
||||||
while(1) {
|
|
||||||
if (font[chr-32] & val) pset(x+(2-xi), y+(4-yi));
|
|
||||||
if (xi<2) xi++; else { if (yi==4) return; else { xi=0; yi++; } }
|
|
||||||
val <<= 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const char t195_char[]={65,65,0,0,0,0,0,67,69,69,0,0,73,73,0,0,0,78,79,79,0,0,0,0,0,85,85,0,0,0,0,0,97,97,0,0,0,0,0,99,101,101,0,0,105,105,0,0,0,110,111,111,0,0,0,0,0,117,117,0,0,0,0,0};
|
|
||||||
const char t195_symbol[]={1,2,0,0,0,0,0,3,1,2,0,0,1,2,0,0,0,4,1,2,0,0,0,0,0,1,2,0,0,0,0,0,5,6,0,0,0,0,0,3,5,6,0,0,5,6,0,0,0,7,5,6,0,0,0,0,0,5,6,0,0,0,0,0};
|
|
||||||
|
|
||||||
void print(const char *str, int x, int y) {
|
|
||||||
int pos=0;
|
|
||||||
for (size_t i=0; i < SDL_strlen(str); ++i) {
|
|
||||||
if ((unsigned char)str[i]==194) {
|
|
||||||
i++;
|
|
||||||
if ((unsigned char)str[i]==161) print_char_hv('!', x+pos*4, y);
|
|
||||||
else if ((unsigned char)str[i]==191) print_char_hv('?', x+pos*4, y);
|
|
||||||
} else if ((unsigned char)str[i]==195) {
|
|
||||||
i++;
|
|
||||||
print_char(t195_char[(unsigned char)str[i]-128], x+pos*4, y);
|
|
||||||
print_symbol(t195_symbol[(unsigned char)str[i]-128], x+pos*4, y);
|
|
||||||
} else {
|
|
||||||
print_char(str[i], x+pos*4, y);
|
|
||||||
}
|
|
||||||
pos++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void old_print(const char *str, int x, int y, uint8_t color) {
|
|
||||||
ds::pen_color=color;
|
|
||||||
print(str, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
const uint8_t printchar(uint8_t c, int x, int y) {
|
const uint8_t printchar(uint8_t c, int x, int y) {
|
||||||
char_t &chr = current_font->chars[c];
|
char_t &chr = current_font->chars[c];
|
||||||
blit(chr.x, chr.y, chr.w, chr.h, x, y-chr.base);
|
blit(chr.x, chr.y, chr.w, chr.h, x, y-chr.base);
|
||||||
@@ -1150,12 +1050,12 @@ void print(const char* str, int x, int y, uint8_t color) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void clip(int x, int y, int w, int h) {
|
void clip(int x, int y, int w, int h) {
|
||||||
ds::clp[0] = x; ds::clp[1] = y; ds::clp[2] = w; ds::clp[3] = h;
|
ds::clip[0] = x; ds::clip[1] = y; ds::clip[2] = w-x-1; ds::clip[3] = h-y-1;
|
||||||
recalculate_clip();
|
recalculate_clip();
|
||||||
}
|
}
|
||||||
|
|
||||||
void clip() {
|
void clip() {
|
||||||
ds::clp[0] = ds::clp[1] = 0; ds::clp[2] = dest_surface->w; ds::clp[3] = dest_surface->h;
|
ds::clip[0] = ds::clip[1] = 0; ds::clip[2] = dest_surface->w-1; ds::clip[3] = dest_surface->h-1;
|
||||||
recalculate_clip();
|
recalculate_clip();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1776,10 +1676,6 @@ bool beat(int16_t i) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int rnd(int x) {
|
|
||||||
return rand()%x;
|
|
||||||
}
|
|
||||||
|
|
||||||
int getfps() {
|
int getfps() {
|
||||||
return fps;
|
return fps;
|
||||||
}
|
}
|
||||||
@@ -256,7 +256,6 @@ bool minside(int x, int y, int w, int h);
|
|||||||
float time();
|
float time();
|
||||||
bool beat(int16_t i);
|
bool beat(int16_t i);
|
||||||
|
|
||||||
int rnd(int x);
|
|
||||||
int getfps();
|
int getfps();
|
||||||
|
|
||||||
void playmusic(const char *filename, const int loop=-1);
|
void playmusic(const char *filename, const int loop=-1);
|
||||||
File renamed without changes.
File renamed without changes.
Reference in new issue
Block a user