-Slight changes for macos
This commit is contained in:
19
mini.cpp
19
mini.cpp
@@ -13,7 +13,6 @@ struct surface_t {
|
|||||||
uint32_t size;
|
uint32_t size;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define swap(a, b) {auto tmp=a;a=b;b=tmp;}
|
|
||||||
|
|
||||||
char window_title[256];
|
char window_title[256];
|
||||||
uint16_t screen_width = 160;
|
uint16_t screen_width = 160;
|
||||||
@@ -432,7 +431,7 @@ void line(int x0, int y0, int x1, int y1, uint8_t color) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void hline(int x0, int y, int x1) {
|
void hline(int x0, int y, int x1) {
|
||||||
if (x0>x1) swap(x0, x1);
|
if (x0>x1) { const int tmp=x0;x0=x1;x1=tmp; }
|
||||||
for (int x=x0; x<=x1; ++x) pset(x, y);
|
for (int x=x0; x<=x1; ++x) pset(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -442,7 +441,7 @@ void hline(int x0, int y, int x1, uint8_t color) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void vline(int x, int y0, int y1) {
|
void vline(int x, int y0, int y1) {
|
||||||
if (y0>y1) swap(y0, y1);
|
if (y0>y1) { const int tmp=y0;y0=y1;y1=tmp; }
|
||||||
for (int y=y0; y<=y1; ++y) pset(x, y);
|
for (int y=y0; y<=y1; ++y) pset(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -741,7 +740,7 @@ void tline(int x0, int y0, int x1, int y1, float mx, float my, float mdx, float
|
|||||||
}
|
}
|
||||||
|
|
||||||
void thline(int x0, int y, int x1, float mx, float my, float mdx, float mdy) {
|
void thline(int x0, int y, int x1, float mx, float my, float mdx, float mdy) {
|
||||||
if (x0>x1) swap(x0, x1);
|
if (x0>x1) { const int tmp=x0;x0=x1;x1=tmp; }
|
||||||
for (int x=x0; x<=x1; ++x) {
|
for (int x=x0; x<=x1; ++x) {
|
||||||
pset(x, y, sget(mx*8, my*8));
|
pset(x, y, sget(mx*8, my*8));
|
||||||
mx += mdx;
|
mx += mdx;
|
||||||
@@ -750,7 +749,7 @@ void thline(int x0, int y, int x1, float mx, float my, float mdx, float mdy) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void tvline(int x, int y0, int y1, float mx, float my, float mdx, float mdy) {
|
void tvline(int x, int y0, int y1, float mx, float my, float mdx, float mdy) {
|
||||||
if (y0>y1) swap(y0, y1);
|
if (y0>y1) { const int tmp=y0;y0=y1;y1=tmp; }
|
||||||
for (int y=y0; y<=y1; ++y) {
|
for (int y=y0; y<=y1; ++y) {
|
||||||
pset(x, y, sget(mx*8, my*8));
|
pset(x, y, sget(mx*8, my*8));
|
||||||
mx += mdx;
|
mx += mdx;
|
||||||
@@ -887,7 +886,7 @@ float min(float x, float y) {
|
|||||||
int utfstrlen(const char *str) {
|
int utfstrlen(const char *str) {
|
||||||
const int size_in_bytes = SDL_strlen(str);
|
const int size_in_bytes = SDL_strlen(str);
|
||||||
int size_in_utfchars = 0;
|
int size_in_utfchars = 0;
|
||||||
for (int i=0;i<size_in_bytes;++i) if (str[i] != 194 && str[i] != 195) size_in_utfchars++;
|
for (int i=0;i<size_in_bytes;++i) if ((unsigned char)str[i] != 194 && (unsigned char)str[i] != 195) size_in_utfchars++;
|
||||||
return size_in_utfchars;
|
return size_in_utfchars;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -953,7 +952,7 @@ void fwritew(const char *value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void fwriteb(bool value) {
|
void fwriteb(bool value) {
|
||||||
sprintf(fstr, value?"true ":"false ", value);
|
sprintf(fstr, value?"true ":"false ");
|
||||||
fwrite(fstr, strlen(fstr), 1, file);
|
fwrite(fstr, strlen(fstr), 1, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -973,18 +972,18 @@ float freadd() {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
const char *freads() {
|
const char *freads() {
|
||||||
fscanf(file, " \"%[^\"]\"", &fstr);
|
fscanf(file, " \"%[^\"]\"", &fstr[0]);
|
||||||
//fscanf(file, "\"%[^\"]\"", &fstr);
|
//fscanf(file, "\"%[^\"]\"", &fstr);
|
||||||
return fstr;
|
return fstr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *freadw() {
|
const char *freadw() {
|
||||||
fscanf(file, "%s", &fstr);
|
fscanf(file, "%s", &fstr[0]);
|
||||||
return fstr;
|
return fstr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool freadb() {
|
bool freadb() {
|
||||||
fscanf(file, "%s", &fstr);
|
fscanf(file, "%s", &fstr[0]);
|
||||||
return strcmp(fstr, "true")==0?true:false;
|
return strcmp(fstr, "true")==0?true:false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
4
opti_mac.sh
Normal file
4
opti_mac.sh
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
g++ *.cpp ./lua/*.c -Os -ffunction-sections -fdata-sections -lSDL2 -o mini
|
||||||
|
strip -s -R .comment -R .gnu.version --strip-unneeded mini
|
||||||
|
|
||||||
Reference in New Issue
Block a user