add default fonts for solaris

This commit is contained in:
UnknownShadow200 2019-01-25 23:58:52 +11:00
parent 2d1909cb92
commit 73b90a2cc8
5 changed files with 28 additions and 24 deletions

View File

@ -684,10 +684,12 @@ static void Drawer2D_TextureChanged(void* obj, struct Stream* src, const String*
}
static void Drawer2D_CheckFont(void) {
const static String default_fonts[3] = {
const static String default_fonts[5] = {
String_FromConst("Arial"), /* preferred font on all platforms */
String_FromConst("Century Schoolbook L Roman"), /* commonly available on linux */
String_FromConst("Nimbus Sans"), /* another common one on linux */
String_FromConst("Nimbus Sans"), /* other common ones */
String_FromConst("Liberation Sans"),
String_FromConst("Bitstream Charter")
};
String path;
int i;

View File

@ -345,7 +345,7 @@ void Logger_Abort2(ReturnCode result, const char* raw_msg) {
/*########################################################################################################################*
*-------------------------------------------------------Info dumping------------------------------------------------------*
*#########################################################################################################################*/
#if defined CC_BUILD_OSX || defined CC_BUILD_LINUX || defined CC_BUILD_BSD || defined CC_BUILD_SOLARIS
#ifdef CC_BUILD_POSIX
static void Logger_DumpRegisters(void* ctx) {
String str; char strBuffer[STRING_SIZE * 8];
mcontext_t r;
@ -357,11 +357,11 @@ static void Logger_DumpRegisters(void* ctx) {
#if defined CC_BUILD_LINUX || defined CC_BUILD_SOLARIS
/* TODO: There must be a better way of getting these.. */
#ifdef __i386__
#if defined __i386__
String_Format3(&str, "eax=%x ebx=%x ecx=%x\n", &r.gregs[11], &r.gregs[8], &r.gregs[10]);
String_Format3(&str, "edx=%x esi=%x edi=%x\n", &r.gregs[9], &r.gregs[5], &r.gregs[4]);
String_Format3(&str, "eip=%x ebp=%x esp=%x\n", &r.gregs[14], &r.gregs[6], &r.gregs[7]);
#elif __x86_64__
#elif defined __x86_64__
String_Format3(&str, "rax=%x rbx=%x rcx=%x\n", &r.gregs[13], &r.gregs[11], &r.gregs[14]);
String_Format3(&str, "rdx=%x rsi=%x rdi=%x\n", &r.gregs[12], &r.gregs[9], &r.gregs[8]);
String_Format3(&str, "rip=%x rbp=%x rsp=%x\n", &r.gregs[16], &r.gregs[10], &r.gregs[15]);

View File

@ -15,7 +15,7 @@ struct DateTime {
int Hour; /* Hour, ranges from 0 to 23 */
int Minute; /* Minute, ranges from 0 to 59 */
int Second; /* Second, ranges from 0 to 59 */
int Milli; /* Milliseconds, ranges from 0 to 999 */
int Milli; /* Milliseconds, ranges from 0 to 999 */
};
#define MILLIS_PER_SEC 1000
@ -34,7 +34,7 @@ void DateTime_HttpDate(TimeMS ms, String* str);
CC_NOINLINE int Utils_ParseEnum(const String* text, int defValue, const char** names, int namesCount);
bool Utils_IsUrlPrefix(const String* value, int index);
/* Creates the directory if it doesn't exist. (logs failure in chat) */
/* Creates the directory if it doesn't exist. (logs failure using Logger_Warn2) */
bool Utils_EnsureDirectory(const char* dirName);
/* Gets the filename portion of a path. (e.g. "dir/file.txt" -> "file.txt") */
void Utils_UNSAFE_GetFilename(STRING_REF String* path);
@ -43,6 +43,8 @@ int Utils_AccumulateWheelDelta(float* accumulator, float delta);
uint8_t Utils_GetSkinType(const Bitmap* bmp);
uint32_t Utils_CRC32(const uint8_t* data, uint32_t length);
/* CRC32 lookup table, for faster CRC32 calculations. */
/* NOTE: This cannot be just indexed by byte value - see Utils_CRC32 implementation. */
extern const uint32_t Utils_Crc32Table[256];
CC_NOINLINE void* Utils_Resize(void* buffer, uint32_t* maxElems, uint32_t elemSize, uint32_t defElems, uint32_t expandElems);
CC_NOINLINE bool Utils_ParseIP(const String* ip, uint8_t* data);

View File

@ -3,13 +3,13 @@
#include "Funcs.h"
#include "Constants.h"
void Vector3_Lerp(Vector3* result, Vector3* a, Vector3* b, float blend) {
void Vector3_Lerp(Vector3* result, const Vector3* a, const Vector3* b, float blend) {
result->X = blend * (b->X - a->X) + a->X;
result->Y = blend * (b->Y - a->Y) + a->Y;
result->Z = blend * (b->Z - a->Z) + a->Z;
}
void Vector3_Normalize(Vector3* result, Vector3* a) {
void Vector3_Normalize(Vector3* result, const Vector3* a) {
float lenSquared = a->X * a->X + a->Y * a->Y + a->Z * a->Z;
float scale = 1.0f / Math_SqrtF(lenSquared);
result->X = a->X * scale;
@ -17,7 +17,7 @@ void Vector3_Normalize(Vector3* result, Vector3* a) {
result->Z = a->Z * scale;
}
void Vector3_Transform(Vector3* result, Vector3* a, struct Matrix* mat) {
void Vector3_Transform(Vector3* result, Vector3* a, const struct Matrix* mat) {
/* a could be pointing to result - can't directly assign X/Y/Z therefore */
float x = a->X * mat->Row0.X + a->Y * mat->Row1.X + a->Z * mat->Row2.X + mat->Row3.X;
float y = a->X * mat->Row0.Y + a->Y * mat->Row1.Y + a->Z * mat->Row2.Y + mat->Row3.Y;
@ -25,7 +25,7 @@ void Vector3_Transform(Vector3* result, Vector3* a, struct Matrix* mat) {
result->X = x; result->Y = y; result->Z = z;
}
void Vector3_TransformY(Vector3* result, float y, struct Matrix* mat) {
void Vector3_TransformY(Vector3* result, float y, const struct Matrix* mat) {
result->X = y * mat->Row1.X + mat->Row3.X;
result->Y = y * mat->Row1.Y + mat->Row3.Y;
result->Z = y * mat->Row1.Z + mat->Row3.Z;
@ -56,19 +56,19 @@ Vector3 Vector3_RotateZ(Vector3 v, float angle) {
}
void Vector3I_Floor(Vector3I* result, Vector3* a) {
void Vector3I_Floor(Vector3I* result, const Vector3* a) {
result->X = Math_Floor(a->X); result->Y = Math_Floor(a->Y); result->Z = Math_Floor(a->Z);
}
void Vector3I_ToVector3(Vector3* result, Vector3I* a) {
void Vector3I_ToVector3(Vector3* result, const Vector3I* a) {
result->X = (float)a->X; result->Y = (float)a->Y; result->Z = (float)a->Z;
}
void Vector3I_Min(Vector3I* result, Vector3I* a, Vector3I* b) {
void Vector3I_Min(Vector3I* result, const Vector3I* a, const Vector3I* b) {
result->X = min(a->X, b->X); result->Y = min(a->Y, b->Y); result->Z = min(a->Z, b->Z);
}
void Vector3I_Max(Vector3I* result, Vector3I* a, Vector3I* b) {
void Vector3I_Max(Vector3I* result, const Vector3I* a, const Vector3I* b) {
result->X = max(a->X, b->X); result->Y = max(a->Y, b->Y); result->Z = max(a->Z, b->Z);
}

View File

@ -27,7 +27,7 @@ static CC_INLINE Vector3 Vector3_Zero(void) {
}
/* Returns a vector with all components 1. */
static CC_INLINE Vector3 Vector3_One(void) {
Vector3 v = { 1, 1, 1}; return v;
Vector3 v = { 1, 1, 1 }; return v;
}
/* Returns a vector with all components set to Int32_MaxValue. */
static CC_INLINE Vector3I Vector3I_MaxValue(void) {
@ -81,14 +81,14 @@ static CC_INLINE void Vector3_Negate(Vector3* result, Vector3* a) {
#define Vector3_Mul3By(dst, value) Vector3_Mul3(dst, dst, value)
/* Linearly interpolates components of two vectors. */
void Vector3_Lerp(Vector3* result, Vector3* a, Vector3* b, float blend);
void Vector3_Lerp(Vector3* result, const Vector3* a, const Vector3* b, float blend);
/* Scales all components of a vector to lie in [-1, 1] */
void Vector3_Normalize(Vector3* result, Vector3* a);
void Vector3_Normalize(Vector3* result, const Vector3* a);
/* Transforms a vector by the given matrix. */
void Vector3_Transform(Vector3* result, Vector3* a, struct Matrix* mat);
void Vector3_Transform(Vector3* result, const Vector3* a, const struct Matrix* mat);
/* Same as Vector3_Transform, but faster since X and Z are assumed as 0. */
void Vector3_TransformY(Vector3* result, float y, struct Matrix* mat);
void Vector3_TransformY(Vector3* result, float y, const struct Matrix* mat);
Vector3 Vector3_RotateX(Vector3 v, float angle);
Vector3 Vector3_RotateY(Vector3 v, float angle);
@ -112,10 +112,10 @@ static CC_INLINE bool Vector3I_NotEquals(const Vector3I* a, const Vector3I* b) {
return a->X != b->X || a->Y != b->Y || a->Z != b->Z;
}
void Vector3I_Floor(Vector3I* result, Vector3* a);
void Vector3I_ToVector3(Vector3* result, Vector3I* a);
void Vector3I_Min(Vector3I* result, Vector3I* a, Vector3I* b);
void Vector3I_Max(Vector3I* result, Vector3I* a, Vector3I* b);
void Vector3I_Floor(Vector3I* result, const Vector3* a);
void Vector3I_ToVector3(Vector3* result, const Vector3I* a);
void Vector3I_Min(Vector3I* result, const Vector3I* a, const Vector3I* b);
void Vector3I_Max(Vector3I* result, const Vector3I* a, const Vector3I* b);
/* Returns a normalised vector facing in the direction described by the given yaw and pitch. */
Vector3 Vector3_GetDirVector(float yawRad, float pitchRad);