-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;
|
||||
};
|
||||
|
||||
#define swap(a, b) {auto tmp=a;a=b;b=tmp;}
|
||||
|
||||
char window_title[256];
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -442,7 +441,7 @@ void hline(int x0, int y, int x1, uint8_t color) {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
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, sget(mx*8, my*8));
|
||||
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) {
|
||||
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, sget(mx*8, my*8));
|
||||
mx += mdx;
|
||||
@@ -887,7 +886,7 @@ float min(float x, float y) {
|
||||
int utfstrlen(const char *str) {
|
||||
const int size_in_bytes = SDL_strlen(str);
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -953,7 +952,7 @@ void fwritew(const char *value) {
|
||||
}
|
||||
|
||||
void fwriteb(bool value) {
|
||||
sprintf(fstr, value?"true ":"false ", value);
|
||||
sprintf(fstr, value?"true ":"false ");
|
||||
fwrite(fstr, strlen(fstr), 1, file);
|
||||
}
|
||||
|
||||
@@ -973,18 +972,18 @@ float freadd() {
|
||||
return value;
|
||||
}
|
||||
const char *freads() {
|
||||
fscanf(file, " \"%[^\"]\"", &fstr);
|
||||
fscanf(file, " \"%[^\"]\"", &fstr[0]);
|
||||
//fscanf(file, "\"%[^\"]\"", &fstr);
|
||||
return fstr;
|
||||
}
|
||||
|
||||
const char *freadw() {
|
||||
fscanf(file, "%s", &fstr);
|
||||
fscanf(file, "%s", &fstr[0]);
|
||||
return fstr;
|
||||
}
|
||||
|
||||
bool freadb() {
|
||||
fscanf(file, "%s", &fstr);
|
||||
fscanf(file, "%s", &fstr[0]);
|
||||
return strcmp(fstr, "true")==0?true:false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user