mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-30 17:15:29 -04:00
Merge branch 'master' into ModernLighting
This commit is contained in:
commit
f18c28ec93
@ -7,6 +7,7 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
9A62ADF5286D906F00E5E3DE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9A62ADF4286D906F00E5E3DE /* Assets.xcassets */; };
|
||||
9A89D4F227F802F600FF3F80 /* LWidgets.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A89D37827F802F500FF3F80 /* LWidgets.c */; };
|
||||
9A89D4F327F802F600FF3F80 /* Graphics_GL2.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A89D37A27F802F500FF3F80 /* Graphics_GL2.c */; };
|
||||
9A89D4F427F802F600FF3F80 /* Vorbis.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A89D37C27F802F500FF3F80 /* Vorbis.c */; };
|
||||
@ -98,7 +99,8 @@
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
9A89D35727F802B100FF3F80 /* CCIOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CCIOS.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
9A62ADF4286D906F00E5E3DE /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = ClassiCube/Assets.xcassets; sourceTree = "<group>"; };
|
||||
9A89D35727F802B100FF3F80 /* ClassiCube.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ClassiCube.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
9A89D36827F802B400FF3F80 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
9A89D37827F802F500FF3F80 /* LWidgets.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = LWidgets.c; sourceTree = "<group>"; };
|
||||
9A89D37927F802F500FF3F80 /* AxisLinesRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AxisLinesRenderer.h; sourceTree = "<group>"; };
|
||||
@ -273,6 +275,7 @@
|
||||
9A89D34E27F802B100FF3F80 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9A62ADF4286D906F00E5E3DE /* Assets.xcassets */,
|
||||
9A89D36827F802B400FF3F80 /* Info.plist */,
|
||||
9A89D37727F802F500FF3F80 /* src */,
|
||||
9A89D35827F802B100FF3F80 /* Products */,
|
||||
@ -282,7 +285,7 @@
|
||||
9A89D35827F802B100FF3F80 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9A89D35727F802B100FF3F80 /* CCIOS.app */,
|
||||
9A89D35727F802B100FF3F80 /* ClassiCube.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
@ -454,9 +457,9 @@
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
9A89D35627F802B100FF3F80 /* CCIOS */ = {
|
||||
9A89D35627F802B100FF3F80 /* ClassiCube */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 9A89D36D27F802B400FF3F80 /* Build configuration list for PBXNativeTarget "CCIOS" */;
|
||||
buildConfigurationList = 9A89D36D27F802B400FF3F80 /* Build configuration list for PBXNativeTarget "ClassiCube" */;
|
||||
buildPhases = (
|
||||
9A89D35327F802B100FF3F80 /* Sources */,
|
||||
9A89D35427F802B100FF3F80 /* Frameworks */,
|
||||
@ -466,9 +469,9 @@
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = CCIOS;
|
||||
productName = CCIOS;
|
||||
productReference = 9A89D35727F802B100FF3F80 /* CCIOS.app */;
|
||||
name = ClassiCube;
|
||||
productName = CCIOS2;
|
||||
productReference = 9A89D35727F802B100FF3F80 /* ClassiCube.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
@ -498,7 +501,7 @@
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
9A89D35627F802B100FF3F80 /* CCIOS */,
|
||||
9A89D35627F802B100FF3F80 /* ClassiCube */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
@ -508,6 +511,7 @@
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
9A62ADF5286D906F00E5E3DE /* Assets.xcassets in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -730,6 +734,7 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
@ -746,6 +751,7 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
@ -768,7 +774,7 @@
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
9A89D36D27F802B400FF3F80 /* Build configuration list for PBXNativeTarget "CCIOS" */ = {
|
||||
9A89D36D27F802B400FF3F80 /* Build configuration list for PBXNativeTarget "ClassiCube" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
9A89D36E27F802B400FF3F80 /* Debug */,
|
BIN
ios/ClassiCube/Assets.xcassets/AppIcon.appiconset/CC10242.png
Normal file
BIN
ios/ClassiCube/Assets.xcassets/AppIcon.appiconset/CC10242.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
@ -0,0 +1,99 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "20x20",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "20x20",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "29x29",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "29x29",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "40x40",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "40x40",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "76x76",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "76x76",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "83.5x83.5",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "1024x1024",
|
||||
"idiom" : "ios-marketing",
|
||||
"filename" : "CC10242.png",
|
||||
"scale" : "1x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
6
ios/ClassiCube/Assets.xcassets/Contents.json
Normal file
6
ios/ClassiCube/Assets.xcassets/Contents.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
@ -2,20 +2,28 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSPhotoLibraryAddUsageDescription</key>
|
||||
<string>Saving screenshot</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>ClassiCube</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.classicube.client.ios</string>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>ClassiCube</string>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>NSPhotoLibraryAddUsageDescription</key>
|
||||
<string>Saving screenshot</string>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
|
BIN
misc/CC1024.png
Normal file
BIN
misc/CC1024.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.9 KiB |
BIN
misc/CC10242.png
Normal file
BIN
misc/CC10242.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
28
src/Bitmap.c
28
src/Bitmap.c
@ -7,6 +7,14 @@
|
||||
#include "Errors.h"
|
||||
#include "Utils.h"
|
||||
|
||||
BitmapCol BitmapColor_Offset(BitmapCol color, int rBy, int gBy, int bBy) {
|
||||
int r, g, b;
|
||||
r = BitmapCol_R(color) + rBy; Math_Clamp(r, 0, 255);
|
||||
g = BitmapCol_G(color) + gBy; Math_Clamp(g, 0, 255);
|
||||
b = BitmapCol_B(color) + bBy; Math_Clamp(b, 0, 255);
|
||||
return BitmapColor_RGB(r, g, b);
|
||||
}
|
||||
|
||||
void Bitmap_UNSAFE_CopyBlock(int srcX, int srcY, int dstX, int dstY,
|
||||
struct Bitmap* src, struct Bitmap* dst, int size) {
|
||||
int x, y;
|
||||
@ -299,13 +307,13 @@ static Png_RowExpander Png_GetExpander(cc_uint8 col, cc_uint8 bitsPerSample) {
|
||||
|
||||
/* Sets alpha to 0 for any pixels in the bitmap whose RGB is same as col */
|
||||
static void ComputeTransparency(struct Bitmap* bmp, BitmapCol col) {
|
||||
BitmapCol trnsRGB = col & BITMAPCOL_RGB_MASK;
|
||||
BitmapCol trnsRGB = col & BITMAPCOLOR_RGB_MASK;
|
||||
int x, y, width = bmp->width, height = bmp->height;
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
BitmapCol* row = Bitmap_GetRow(bmp, y);
|
||||
for (x = 0; x < width; x++) {
|
||||
BitmapCol rgb = row[x] & BITMAPCOL_RGB_MASK;
|
||||
BitmapCol rgb = row[x] & BITMAPCOLOR_RGB_MASK;
|
||||
row[x] = (rgb == trnsRGB) ? trnsRGB : row[x];
|
||||
}
|
||||
}
|
||||
@ -350,8 +358,8 @@ cc_result Png_Decode(struct Bitmap* bmp, struct Stream* stream) {
|
||||
if (res) return res;
|
||||
if (!Png_Detect(tmp, PNG_SIG_SIZE)) return PNG_ERR_INVALID_SIG;
|
||||
|
||||
trnsCol = BITMAPCOL_BLACK;
|
||||
for (i = 0; i < PNG_PALETTE; i++) { palette[i] = BITMAPCOL_BLACK; }
|
||||
trnsCol = BITMAPCOLOR_BLACK;
|
||||
for (i = 0; i < PNG_PALETTE; i++) { palette[i] = BITMAPCOLOR_BLACK; }
|
||||
|
||||
Inflate_MakeStream2(&compStream, &inflate, stream);
|
||||
ZLibHeader_Init(&zlibHeader);
|
||||
@ -401,10 +409,10 @@ cc_result Png_Decode(struct Bitmap* bmp, struct Stream* stream) {
|
||||
if (res) return res;
|
||||
|
||||
for (i = 0; i < dataSize; i += 3) {
|
||||
palette[i / 3] &= BITMAPCOL_A_MASK; /* set RGB to 0 */
|
||||
palette[i / 3] |= tmp[i ] << BITMAPCOL_R_SHIFT;
|
||||
palette[i / 3] |= tmp[i + 1] << BITMAPCOL_G_SHIFT;
|
||||
palette[i / 3] |= tmp[i + 2] << BITMAPCOL_B_SHIFT;
|
||||
palette[i / 3] &= BITMAPCOLOR_A_MASK; /* set RGB to 0 */
|
||||
palette[i / 3] |= tmp[i ] << BITMAPCOLOR_R_SHIFT;
|
||||
palette[i / 3] |= tmp[i + 1] << BITMAPCOLOR_G_SHIFT;
|
||||
palette[i / 3] |= tmp[i + 2] << BITMAPCOLOR_B_SHIFT;
|
||||
}
|
||||
} break;
|
||||
|
||||
@ -423,8 +431,8 @@ cc_result Png_Decode(struct Bitmap* bmp, struct Stream* stream) {
|
||||
|
||||
/* set alpha component of palette */
|
||||
for (i = 0; i < dataSize; i++) {
|
||||
palette[i] &= BITMAPCOL_RGB_MASK; /* set A to 0 */
|
||||
palette[i] |= tmp[i] << BITMAPCOL_A_SHIFT;
|
||||
palette[i] &= BITMAPCOLOR_RGB_MASK; /* set A to 0 */
|
||||
palette[i] |= tmp[i] << BITMAPCOLOR_A_SHIFT;
|
||||
}
|
||||
} else if (col == PNG_COLOR_RGB) {
|
||||
if (dataSize != 6) return PNG_ERR_TRANS_COUNT;
|
||||
|
51
src/Bitmap.h
51
src/Bitmap.h
@ -9,37 +9,40 @@ struct Stream;
|
||||
/* Represents a packed 32 bit RGBA colour, suitable for native graphics API texture pixels. */
|
||||
typedef cc_uint32 BitmapCol;
|
||||
#if defined CC_BUILD_WEB || defined CC_BUILD_ANDROID
|
||||
#define BITMAPCOL_R_SHIFT 0
|
||||
#define BITMAPCOL_G_SHIFT 8
|
||||
#define BITMAPCOL_B_SHIFT 16
|
||||
#define BITMAPCOL_A_SHIFT 24
|
||||
#define BITMAPCOLOR_R_SHIFT 0
|
||||
#define BITMAPCOLOR_G_SHIFT 8
|
||||
#define BITMAPCOLOR_B_SHIFT 16
|
||||
#define BITMAPCOLOR_A_SHIFT 24
|
||||
#else
|
||||
#define BITMAPCOL_B_SHIFT 0
|
||||
#define BITMAPCOL_G_SHIFT 8
|
||||
#define BITMAPCOL_R_SHIFT 16
|
||||
#define BITMAPCOL_A_SHIFT 24
|
||||
#define BITMAPCOLOR_B_SHIFT 0
|
||||
#define BITMAPCOLOR_G_SHIFT 8
|
||||
#define BITMAPCOLOR_R_SHIFT 16
|
||||
#define BITMAPCOLOR_A_SHIFT 24
|
||||
#endif
|
||||
|
||||
#define BITMAPCOL_R_MASK (0xFFU << BITMAPCOL_R_SHIFT)
|
||||
#define BITMAPCOL_G_MASK (0xFFU << BITMAPCOL_G_SHIFT)
|
||||
#define BITMAPCOL_B_MASK (0xFFU << BITMAPCOL_B_SHIFT)
|
||||
#define BITMAPCOL_A_MASK (0xFFU << BITMAPCOL_A_SHIFT)
|
||||
#define BITMAPCOLOR_R_MASK (0xFFU << BITMAPCOLOR_R_SHIFT)
|
||||
#define BITMAPCOLOR_G_MASK (0xFFU << BITMAPCOLOR_G_SHIFT)
|
||||
#define BITMAPCOLOR_B_MASK (0xFFU << BITMAPCOLOR_B_SHIFT)
|
||||
#define BITMAPCOLOR_A_MASK (0xFFU << BITMAPCOLOR_A_SHIFT)
|
||||
|
||||
#define BitmapCol_R(color) ((cc_uint8)(color >> BITMAPCOL_R_SHIFT))
|
||||
#define BitmapCol_G(color) ((cc_uint8)(color >> BITMAPCOL_G_SHIFT))
|
||||
#define BitmapCol_B(color) ((cc_uint8)(color >> BITMAPCOL_B_SHIFT))
|
||||
#define BitmapCol_A(color) ((cc_uint8)(color >> BITMAPCOL_A_SHIFT))
|
||||
#define BitmapCol_R(color) ((cc_uint8)(color >> BITMAPCOLOR_R_SHIFT))
|
||||
#define BitmapCol_G(color) ((cc_uint8)(color >> BITMAPCOLOR_G_SHIFT))
|
||||
#define BitmapCol_B(color) ((cc_uint8)(color >> BITMAPCOLOR_B_SHIFT))
|
||||
#define BitmapCol_A(color) ((cc_uint8)(color >> BITMAPCOLOR_A_SHIFT))
|
||||
|
||||
#define BitmapCol_R_Bits(color) ((cc_uint8)(color) << BITMAPCOL_R_SHIFT)
|
||||
#define BitmapCol_G_Bits(color) ((cc_uint8)(color) << BITMAPCOL_G_SHIFT)
|
||||
#define BitmapCol_B_Bits(color) ((cc_uint8)(color) << BITMAPCOL_B_SHIFT)
|
||||
#define BitmapCol_A_Bits(color) ((cc_uint8)(color) << BITMAPCOL_A_SHIFT)
|
||||
#define BitmapColor_R_Bits(color) ((cc_uint8)(color) << BITMAPCOLOR_R_SHIFT)
|
||||
#define BitmapColor_G_Bits(color) ((cc_uint8)(color) << BITMAPCOLOR_G_SHIFT)
|
||||
#define BitmapColor_B_Bits(color) ((cc_uint8)(color) << BITMAPCOLOR_B_SHIFT)
|
||||
#define BitmapColor_A_Bits(color) ((cc_uint8)(color) << BITMAPCOLOR_A_SHIFT)
|
||||
|
||||
#define BitmapCol_Make(r, g, b, a) (BitmapCol_R_Bits(r) | BitmapCol_G_Bits(g) | BitmapCol_B_Bits(b) | BitmapCol_A_Bits(a))
|
||||
#define BITMAPCOL_RGB_MASK (BITMAPCOL_R_MASK | BITMAPCOL_G_MASK | BITMAPCOL_B_MASK)
|
||||
#define BitmapCol_Make(r, g, b, a) (BitmapColor_R_Bits(r) | BitmapColor_G_Bits(g) | BitmapColor_B_Bits(b) | BitmapColor_A_Bits(a))
|
||||
#define BitmapColor_RGB(r, g, b) (BitmapColor_R_Bits(r) | BitmapColor_G_Bits(g) | BitmapColor_B_Bits(b) | BITMAPCOLOR_A_MASK)
|
||||
#define BITMAPCOLOR_RGB_MASK (BITMAPCOLOR_R_MASK | BITMAPCOLOR_G_MASK | BITMAPCOLOR_B_MASK)
|
||||
|
||||
#define BITMAPCOL_BLACK BitmapCol_Make( 0, 0, 0, 255)
|
||||
#define BITMAPCOL_WHITE BitmapCol_Make(255, 255, 255, 255)
|
||||
#define BITMAPCOLOR_BLACK BitmapColor_RGB( 0, 0, 0)
|
||||
#define BITMAPCOLOR_WHITE BitmapColor_RGB(255, 255, 255)
|
||||
|
||||
BitmapCol BitmapColor_Offset(BitmapCol color, int rBy, int gBy, int bBy);
|
||||
|
||||
/* A 2D array of BitmapCol pixels */
|
||||
struct Bitmap { BitmapCol* scan0; int width, height; };
|
||||
|
@ -22,32 +22,32 @@
|
||||
<ProjectGuid>{8A7D82BD-178A-4785-B41B-70EDE998920A}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>ClassiCube</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>$(SDKVersion)</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
|
@ -195,7 +195,7 @@ void Gradient_Noise(struct Context2D* ctx, BitmapCol color, int variation,
|
||||
G = BitmapCol_G(color) + (int)(noise * variation); Drawer2D_ClampPixel(G);
|
||||
B = BitmapCol_B(color) + (int)(noise * variation); Drawer2D_ClampPixel(B);
|
||||
|
||||
*dst = BitmapCol_Make(R, G, B, 255);
|
||||
*dst = BitmapColor_RGB(R, G, B);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -247,7 +247,7 @@ void Gradient_Blend(struct Context2D* ctx, BitmapCol color, int blend,
|
||||
G = BitmapCol_G(color) + (BitmapCol_G(*dst) * blend) / 255;
|
||||
B = BitmapCol_B(color) + (BitmapCol_B(*dst) * blend) / 255;
|
||||
|
||||
*dst = BitmapCol_Make(R, G, B, 255);
|
||||
*dst = BitmapColor_RGB(R, G, B);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -381,15 +381,15 @@ char Drawer2D_LastColor(const cc_string* text, int start) {
|
||||
cc_bool Drawer2D_IsWhiteColor(char c) { return c == '\0' || c == 'f' || c == 'F'; }
|
||||
|
||||
/* Divides R/G/B by 4 */
|
||||
#define SHADOW_MASK ((0x3F << BITMAPCOL_R_SHIFT) | (0x3F << BITMAPCOL_G_SHIFT) | (0x3F << BITMAPCOL_B_SHIFT))
|
||||
#define SHADOW_MASK ((0x3F << BITMAPCOLOR_R_SHIFT) | (0x3F << BITMAPCOLOR_G_SHIFT) | (0x3F << BITMAPCOLOR_B_SHIFT))
|
||||
CC_NOINLINE static BitmapCol GetShadowColor(BitmapCol c) {
|
||||
if (Drawer2D.BlackTextShadows) return BITMAPCOL_BLACK;
|
||||
if (Drawer2D.BlackTextShadows) return BITMAPCOLOR_BLACK;
|
||||
|
||||
/* Initial layout: aaaa_aaaa|rrrr_rrrr|gggg_gggg|bbbb_bbbb */
|
||||
/* Shift right 2: 00aa_aaaa|aarr_rrrr|rrgg_gggg|ggbb_bbbb */
|
||||
/* And by 3f3f3f: 0000_0000|00rr_rrrr|00gg_gggg|00bb_bbbb */
|
||||
/* Or by alpha : aaaa_aaaa|00rr_rrrr|00gg_gggg|00bb_bbbb */
|
||||
return (c & BITMAPCOL_A_MASK) | ((c >> 2) & SHADOW_MASK);
|
||||
return (c & BITMAPCOLOR_A_MASK) | ((c >> 2) & SHADOW_MASK);
|
||||
}
|
||||
|
||||
/* TODO: Needs to account for DPI */
|
||||
@ -632,11 +632,10 @@ void Drawer2D_DrawClippedText(struct Context2D* ctx, struct DrawTextArgs* args,
|
||||
*---------------------------------------------------Drawer2D component----------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
static void InitHexEncodedColor(int i, int hex, cc_uint8 lo, cc_uint8 hi) {
|
||||
Drawer2D.Colors[i] = BitmapCol_Make(
|
||||
Drawer2D.Colors[i] = BitmapColor_RGB(
|
||||
lo * ((hex >> 2) & 1) + hi * (hex >> 3),
|
||||
lo * ((hex >> 1) & 1) + hi * (hex >> 3),
|
||||
lo * ((hex >> 0) & 1) + hi * (hex >> 3),
|
||||
255);
|
||||
lo * ((hex >> 0) & 1) + hi * (hex >> 3));
|
||||
}
|
||||
|
||||
static void OnReset(void) {
|
||||
@ -1151,7 +1150,7 @@ static void DrawBlackWhiteGlyph(FT_Bitmap* img, struct Bitmap* bmp, int x, int y
|
||||
|
||||
/* TODO: transparent text (don't set A to 255) */
|
||||
if (intensity & (1 << (7 - (xx & 7)))) {
|
||||
*dst = col | BitmapCol_A_Bits(255);
|
||||
*dst = col | BitmapColor_A_Bits(255);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -396,7 +396,7 @@ static void Entity_ClearHat(struct Bitmap* bmp, cc_uint8 skinType) {
|
||||
BitmapCol* row = Bitmap_GetRow(bmp, y) + sizeX;
|
||||
for (x = 0; x < sizeX; x++) {
|
||||
BitmapCol c = row[x];
|
||||
if (c == BITMAPCOL_WHITE || c == BITMAPCOL_BLACK) row[x] = 0;
|
||||
if (c == BITMAPCOLOR_WHITE || c == BITMAPCOLOR_BLACK) row[x] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -87,13 +87,14 @@ void Event_UnregisterAll(void) {
|
||||
ChatEvents.ChatSending.Count = 0;
|
||||
ChatEvents.ColCodeChanged.Count = 0;
|
||||
|
||||
WindowEvents.Redraw.Count = 0;
|
||||
WindowEvents.RedrawNeeded.Count = 0;
|
||||
WindowEvents.Resized.Count = 0;
|
||||
WindowEvents.Closing.Count = 0;
|
||||
WindowEvents.FocusChanged.Count = 0;
|
||||
WindowEvents.StateChanged.Count = 0;
|
||||
WindowEvents.Created.Count = 0;
|
||||
WindowEvents.InactiveChanged.Count = 0;
|
||||
WindowEvents.Redrawing.Count = 0;
|
||||
|
||||
InputEvents.Press.Count = 0;
|
||||
InputEvents.Down.Count = 0;
|
||||
|
@ -108,7 +108,8 @@ void Event_UnregisterAll(void);
|
||||
/* NOTE: Event_UnregisterAll MUST be updated when events lists are changed */
|
||||
|
||||
/* Event API version supported by the client */
|
||||
/* Version 1 - Added NetEvents.PluginMessageReceived, */
|
||||
/* Version 1 - Added NetEvents.PluginMessageReceived */
|
||||
/* Version 2 - Added WindowEvents.Redrawing */
|
||||
/* You MUST CHECK the event API version before attempting to use the events listed above, */
|
||||
/* as otherwise if the player is using an older client that lacks some of the above events, */
|
||||
/* you will be calling Event_Register on random data instead of the expected EventsList struct */
|
||||
@ -166,13 +167,14 @@ CC_VAR extern struct _ChatEventsList {
|
||||
} ChatEvents;
|
||||
|
||||
CC_VAR extern struct _WindowEventsList {
|
||||
struct Event_Void Redraw; /* Window contents invalidated, should be redrawn */
|
||||
struct Event_Void RedrawNeeded; /* Window contents invalidated and will need to be redrawn */
|
||||
struct Event_Void Resized; /* Window is resized */
|
||||
struct Event_Void Closing; /* Window is about to close (should free resources/save state/etc here) */
|
||||
struct Event_Void FocusChanged; /* Focus of the window changed */
|
||||
struct Event_Void StateChanged; /* State of the window changed (e.g. minimised, fullscreen) */
|
||||
struct Event_Void Created; /* Window has been created, Window_Handle is valid now. */
|
||||
struct Event_Void InactiveChanged; /* Inactive/background state of the window changed */
|
||||
struct Event_Void Redrawing; /* Window contents should be redrawn (as they are about to be displayed) */
|
||||
} WindowEvents;
|
||||
|
||||
CC_VAR extern struct _InputEventsList {
|
||||
|
@ -159,7 +159,7 @@ static void Gfx_RestoreState(void) {
|
||||
|
||||
/* 1x1 dummy white texture */
|
||||
struct Bitmap bmp;
|
||||
BitmapCol pixels[1] = { BITMAPCOL_WHITE };
|
||||
BitmapCol pixels[1] = { BITMAPCOLOR_WHITE };
|
||||
Bitmap_Init(bmp, 1, 1, pixels);
|
||||
Gfx_RecreateTexture(&white_square, &bmp, 0, false);
|
||||
}
|
||||
|
@ -578,7 +578,7 @@ static void Gfx_RestoreState(void) {
|
||||
|
||||
/* 1x1 dummy white texture */
|
||||
struct Bitmap bmp;
|
||||
BitmapCol pixels[1] = { BITMAPCOL_WHITE };
|
||||
BitmapCol pixels[1] = { BITMAPCOLOR_WHITE };
|
||||
Bitmap_Init(bmp, 1, 1, pixels);
|
||||
Gfx_RecreateTexture(&white_square, &bmp, 0, false);
|
||||
}
|
||||
|
@ -245,13 +245,7 @@ static CC_NOINLINE void RedrawDirty(void) {
|
||||
MarkAllDirty();
|
||||
}
|
||||
|
||||
void LBackend_Redraw(void) {
|
||||
pendingRedraw = REDRAW_ALL;
|
||||
MarkAllDirty();
|
||||
}
|
||||
void LBackend_ThemeChanged(void) { LBackend_Redraw(); }
|
||||
|
||||
void LBackend_Tick(void) {
|
||||
static CC_NOINLINE void DoRedraw(void) {
|
||||
if (pendingRedraw & REDRAW_ALL) {
|
||||
RedrawAll();
|
||||
pendingRedraw = 0;
|
||||
@ -259,8 +253,18 @@ void LBackend_Tick(void) {
|
||||
RedrawDirty();
|
||||
pendingRedraw = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void LBackend_Redraw(void) {
|
||||
pendingRedraw = REDRAW_ALL;
|
||||
MarkAllDirty();
|
||||
}
|
||||
void LBackend_ThemeChanged(void) { LBackend_Redraw(); }
|
||||
|
||||
void LBackend_Tick(void) {
|
||||
DoRedraw();
|
||||
if (!dirty_rect.Width) return;
|
||||
|
||||
Window_DrawFramebuffer(dirty_rect);
|
||||
dirty_rect.X = 0; dirty_rect.Width = 0;
|
||||
dirty_rect.Y = 0; dirty_rect.Height = 0;
|
||||
@ -270,7 +274,8 @@ void LBackend_Tick(void) {
|
||||
/*########################################################################################################################*
|
||||
*-----------------------------------------------------Event handling------------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
static void ReqeustRedraw(void* obj) { LBackend_Redraw(); }
|
||||
static void ReqeustRedraw(void* obj) { LBackend_Redraw(); }
|
||||
static void RedrawContents(void* obj) { DoRedraw(); }
|
||||
|
||||
CC_NOINLINE static struct LWidget* GetWidgetAt(struct LScreen* s, int idx) {
|
||||
struct LWidget* w;
|
||||
@ -361,13 +366,15 @@ static void OnTextChanged(void* obj, const cc_string* str) {
|
||||
}
|
||||
|
||||
static void HookEvents(void) {
|
||||
Event_Register_(&WindowEvents.Redraw, NULL, ReqeustRedraw);
|
||||
Event_Register_(&PointerEvents.Down, NULL, OnPointerDown);
|
||||
Event_Register_(&PointerEvents.Up, NULL, OnPointerUp);
|
||||
Event_Register_(&PointerEvents.Moved, NULL, OnPointerMove);
|
||||
|
||||
Event_Register_(&InputEvents.Press, NULL, OnKeyPress);
|
||||
Event_Register_(&InputEvents.TextChanged, NULL, OnTextChanged);
|
||||
|
||||
Event_Register_(&WindowEvents.RedrawNeeded, NULL, ReqeustRedraw);
|
||||
Event_Register_(&WindowEvents.Redrawing, NULL, RedrawContents);
|
||||
}
|
||||
|
||||
|
||||
@ -448,21 +455,21 @@ static const cc_uint8 checkbox_indices[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
static const BitmapCol checkbox_palette[] = {
|
||||
BitmapCol_Make( 0, 0, 0, 0), BitmapCol_Make(144, 144, 144, 255),
|
||||
BitmapCol_Make( 61, 61, 61, 255), BitmapCol_Make( 94, 94, 94, 255),
|
||||
BitmapCol_Make(197, 196, 197, 255), BitmapCol_Make( 57, 57, 57, 255),
|
||||
BitmapCol_Make( 33, 33, 33, 255), BitmapCol_Make(177, 177, 177, 255),
|
||||
BitmapCol_Make(189, 189, 189, 255), BitmapCol_Make( 67, 67, 67, 255),
|
||||
BitmapCol_Make(108, 108, 108, 255), BitmapCol_Make(171, 171, 171, 255),
|
||||
BitmapCol_Make(220, 220, 220, 255), BitmapCol_Make( 43, 43, 43, 255),
|
||||
BitmapCol_Make( 63, 63, 63, 255), BitmapCol_Make(100, 100, 100, 255),
|
||||
BitmapCol_Make(192, 192, 192, 255), BitmapCol_Make(132, 132, 132, 255),
|
||||
BitmapCol_Make(175, 175, 175, 255), BitmapCol_Make(217, 217, 217, 255),
|
||||
BitmapCol_Make( 42, 42, 42, 255), BitmapCol_Make( 86, 86, 86, 255),
|
||||
BitmapCol_Make( 56, 56, 56, 255), BitmapCol_Make( 76, 76, 76, 255),
|
||||
BitmapCol_Make(139, 139, 139, 255), BitmapCol_Make(130, 130, 130, 255),
|
||||
BitmapCol_Make(181, 181, 181, 255), BitmapCol_Make( 62, 62, 62, 255),
|
||||
BitmapCol_Make( 75, 75, 75, 255), BitmapCol_Make(184, 184, 184, 255),
|
||||
BitmapCol_Make(0,0,0,0), BitmapColor_RGB(144, 144, 144),
|
||||
BitmapColor_RGB( 61, 61, 61), BitmapColor_RGB( 94, 94, 94),
|
||||
BitmapColor_RGB(197, 196, 197), BitmapColor_RGB( 57, 57, 57),
|
||||
BitmapColor_RGB( 33, 33, 33), BitmapColor_RGB(177, 177, 177),
|
||||
BitmapColor_RGB(189, 189, 189), BitmapColor_RGB( 67, 67, 67),
|
||||
BitmapColor_RGB(108, 108, 108), BitmapColor_RGB(171, 171, 171),
|
||||
BitmapColor_RGB(220, 220, 220), BitmapColor_RGB( 43, 43, 43),
|
||||
BitmapColor_RGB( 63, 63, 63), BitmapColor_RGB(100, 100, 100),
|
||||
BitmapColor_RGB(192, 192, 192), BitmapColor_RGB(132, 132, 132),
|
||||
BitmapColor_RGB(175, 175, 175), BitmapColor_RGB(217, 217, 217),
|
||||
BitmapColor_RGB( 42, 42, 42), BitmapColor_RGB( 86, 86, 86),
|
||||
BitmapColor_RGB( 56, 56, 56), BitmapColor_RGB( 76, 76, 76),
|
||||
BitmapColor_RGB(139, 139, 139), BitmapColor_RGB(130, 130, 130),
|
||||
BitmapColor_RGB(181, 181, 181), BitmapColor_RGB( 62, 62, 62),
|
||||
BitmapColor_RGB( 75, 75, 75), BitmapColor_RGB(184, 184, 184),
|
||||
};
|
||||
|
||||
static void DrawIndexed(int size, int x, int y, struct Context2D* ctx) {
|
||||
@ -486,8 +493,8 @@ static void DrawIndexed(int size, int x, int y, struct Context2D* ctx) {
|
||||
}
|
||||
|
||||
void LBackend_CheckboxDraw(struct LCheckbox* w) {
|
||||
BitmapCol boxTop = BitmapCol_Make(255, 255, 255, 255);
|
||||
BitmapCol boxBottom = BitmapCol_Make(240, 240, 240, 255);
|
||||
BitmapCol boxTop = BitmapColor_RGB(255, 255, 255);
|
||||
BitmapCol boxBottom = BitmapColor_RGB(240, 240, 240);
|
||||
struct DrawTextArgs args;
|
||||
int x, y, width, height;
|
||||
|
||||
@ -505,7 +512,7 @@ void LBackend_CheckboxDraw(struct LCheckbox* w) {
|
||||
y = w->y + height / 2 - size / 2;
|
||||
DrawIndexed(size, x, y, &framebuffer);
|
||||
}
|
||||
DrawBoxBounds(BITMAPCOL_BLACK, w->x, w->y, width, height);
|
||||
DrawBoxBounds(BITMAPCOLOR_BLACK, w->x, w->y, width, height);
|
||||
|
||||
DrawTextArgs_Make(&args, &w->text, &textFont, true);
|
||||
x = w->x + Display_ScaleX(CB_SIZE + CB_OFFSET);
|
||||
@ -642,7 +649,7 @@ void LBackend_InputUnselect(struct LInput* w) {
|
||||
static void LInput_DrawOuterBorder(struct LInput* w) {
|
||||
struct LScreen* s = Launcher_Active;
|
||||
struct Context2D* ctx = &framebuffer;
|
||||
BitmapCol color = BitmapCol_Make(97, 81, 110, 255);
|
||||
BitmapCol color = Launcher_Theme.ButtonBorderColor;
|
||||
|
||||
if (w->selected) {
|
||||
DrawBoxBounds(color, w->x, w->y, w->width, w->height);
|
||||
@ -659,7 +666,8 @@ static void LInput_DrawOuterBorder(struct LInput* w) {
|
||||
}
|
||||
|
||||
static void LInput_DrawInnerBorder(struct LInput* w) {
|
||||
BitmapCol color = BitmapCol_Make(165, 142, 168, 255);
|
||||
/* e.g. for modern theme: 162,131,186 --> 165,142,168 */
|
||||
BitmapCol color = BitmapColor_Offset(Launcher_Theme.ButtonHighlightColor, 3,11,-18);
|
||||
|
||||
Context2D_Clear(&framebuffer, color,
|
||||
w->x + xBorder, w->y + yBorder,
|
||||
@ -676,7 +684,7 @@ static void LInput_DrawInnerBorder(struct LInput* w) {
|
||||
}
|
||||
|
||||
static void LInput_BlendBoxTop(struct LInput* w) {
|
||||
BitmapCol color = BitmapCol_Make(0, 0, 0, 255);
|
||||
BitmapCol color = BitmapColor_RGB(0, 0, 0);
|
||||
|
||||
Gradient_Blend(&framebuffer, color, 75,
|
||||
w->x + xBorder, w->y + yBorder,
|
||||
@ -703,10 +711,10 @@ static void LInput_DrawText(struct LInput* w, struct DrawTextArgs* args) {
|
||||
hintHeight = Drawer2D_TextHeight(args);
|
||||
y = w->y + (w->height - hintHeight) / 2;
|
||||
|
||||
Drawer2D.Colors['f'] = BitmapCol_Make(125, 125, 125, 255);
|
||||
Drawer2D.Colors['f'] = BitmapColor_RGB(125, 125, 125);
|
||||
Context2D_DrawText(&framebuffer, args,
|
||||
w->x + xInputOffset, y);
|
||||
Drawer2D.Colors['f'] = BITMAPCOL_WHITE;
|
||||
Drawer2D.Colors['f'] = BITMAPCOLOR_WHITE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -720,7 +728,7 @@ void LBackend_InputDraw(struct LInput* w) {
|
||||
|
||||
LInput_DrawOuterBorder(w);
|
||||
LInput_DrawInnerBorder(w);
|
||||
Context2D_Clear(&framebuffer, BITMAPCOL_WHITE,
|
||||
Context2D_Clear(&framebuffer, BITMAPCOLOR_WHITE,
|
||||
w->x + xBorder2, w->y + yBorder2,
|
||||
w->width - xBorder4, w->height - yBorder4);
|
||||
LInput_BlendBoxTop(w);
|
||||
@ -731,7 +739,7 @@ void LBackend_InputDraw(struct LInput* w) {
|
||||
|
||||
caretRect = LInput_MeasureCaret(w, &text);
|
||||
if (!w->caretShow) return;
|
||||
Context2D_Clear(&framebuffer, BITMAPCOL_BLACK,
|
||||
Context2D_Clear(&framebuffer, BITMAPCOLOR_BLACK,
|
||||
caretRect.X, caretRect.Y, caretRect.Width, caretRect.Height);
|
||||
}
|
||||
|
||||
@ -785,8 +793,8 @@ void LBackend_SliderUpdate(struct LSlider* w) {
|
||||
}
|
||||
|
||||
static void LSlider_DrawBoxBounds(struct LSlider* w) {
|
||||
BitmapCol boundsTop = BitmapCol_Make(119, 100, 132, 255);
|
||||
BitmapCol boundsBottom = BitmapCol_Make(150, 130, 165, 255);
|
||||
BitmapCol boundsTop = BitmapColor_RGB(119, 100, 132);
|
||||
BitmapCol boundsBottom = BitmapColor_RGB(150, 130, 165);
|
||||
|
||||
/* TODO: Check these are actually right */
|
||||
Context2D_Clear(&framebuffer, boundsTop,
|
||||
@ -805,8 +813,8 @@ static void LSlider_DrawBoxBounds(struct LSlider* w) {
|
||||
}
|
||||
|
||||
static void LSlider_DrawBox(struct LSlider* w) {
|
||||
BitmapCol progTop = BitmapCol_Make(220, 204, 233, 255);
|
||||
BitmapCol progBottom = BitmapCol_Make(207, 181, 216, 255);
|
||||
BitmapCol progTop = BitmapColor_RGB(220, 204, 233);
|
||||
BitmapCol progBottom = BitmapColor_RGB(207, 181, 216);
|
||||
int halfHeight = (w->height - yBorder2) / 2;
|
||||
|
||||
Gradient_Vertical(&framebuffer, progTop, progBottom,
|
||||
@ -859,7 +867,7 @@ void LBackend_TableFlagAdded(struct LTable* w) {
|
||||
|
||||
/* Draws background behind column headers */
|
||||
static void LTable_DrawHeaderBackground(struct LTable* w) {
|
||||
BitmapCol gridColor = BitmapCol_Make(20, 20, 10, 255);
|
||||
BitmapCol gridColor = BitmapColor_RGB(20, 20, 10);
|
||||
|
||||
if (!Launcher_Theme.ClassicBackground) {
|
||||
Context2D_Clear(&framebuffer, gridColor,
|
||||
@ -986,8 +994,8 @@ static void LTable_DrawRows(struct LTable* w) {
|
||||
|
||||
/* Draws scrollbar on the right edge of the table */
|
||||
static void LTable_DrawScrollbar(struct LTable* w) {
|
||||
BitmapCol classicBack = BitmapCol_Make( 80, 80, 80, 255);
|
||||
BitmapCol classicScroll = BitmapCol_Make(160, 160, 160, 255);
|
||||
BitmapCol classicBack = BitmapColor_RGB( 80, 80, 80);
|
||||
BitmapCol classicScroll = BitmapColor_RGB(160, 160, 160);
|
||||
BitmapCol backCol = Launcher_Theme.ClassicBackground ? classicBack : Launcher_Theme.ButtonBorderColor;
|
||||
BitmapCol scrollCol = Launcher_Theme.ClassicBackground ? classicScroll : Launcher_Theme.ButtonForeActiveColor;
|
||||
|
||||
|
@ -338,7 +338,7 @@ static void ColoursScreen_TextChanged(struct LInput* w) {
|
||||
if (!Convert_ParseUInt8(&s->iptColours[index + 1].text, &g)) return;
|
||||
if (!Convert_ParseUInt8(&s->iptColours[index + 2].text, &b)) return;
|
||||
|
||||
*color = BitmapCol_Make(r, g, b, 255);
|
||||
*color = BitmapColor_RGB(r, g, b);
|
||||
Launcher_SaveTheme();
|
||||
LBackend_ThemeChanged();
|
||||
}
|
||||
@ -1011,8 +1011,8 @@ static void CheckResourcesScreen_Show(struct LScreen* s_) {
|
||||
LLabel_SetText(&s->lblStatus, &str);
|
||||
}
|
||||
|
||||
#define RESOURCES_BACK_COLOR BitmapCol_Make( 12, 12, 12, 255)
|
||||
#define RESOURCES_FORE_COLOR BitmapCol_Make(120, 85, 151, 255)
|
||||
#define RESOURCES_BACK_COLOR BitmapColor_RGB( 12, 12, 12)
|
||||
#define RESOURCES_FORE_COLOR BitmapColor_RGB(120, 85, 151)
|
||||
|
||||
static void CheckResourcesScreen_ResetArea(struct Context2D* ctx, int x, int y, int width, int height) {
|
||||
Gradient_Noise(ctx, RESOURCES_FORE_COLOR, 4, x, y, width, height);
|
||||
@ -1067,9 +1067,9 @@ static void FetchResourcesScreen_Init(struct LScreen* s_) {
|
||||
s->numWidgets = Array_Elems(fetchResources_widgets);
|
||||
s->lblStatus.small = true;
|
||||
|
||||
LLabel_Init( &s->lblStatus, "", fres_lblStatus);
|
||||
LButton_Init(&s->btnCancel, 120, 35, "Cancel", fres_btnCancel);
|
||||
LSlider_Init(&s->sdrProgress, 200, 12, BitmapCol_Make(0, 220, 0, 255), fres_sdrProgress);
|
||||
LLabel_Init( &s->lblStatus, "", fres_lblStatus);
|
||||
LButton_Init(&s->btnCancel, 120, 35, "Cancel", fres_btnCancel);
|
||||
LSlider_Init(&s->sdrProgress, 200, 12, BitmapColor_RGB(0, 220, 0), fres_sdrProgress);
|
||||
|
||||
s->btnCancel.OnClick = CheckResourcesScreen_Next;
|
||||
}
|
||||
|
@ -30,14 +30,6 @@ void LWidget_CalcOffsets(void) {
|
||||
/*########################################################################################################################*
|
||||
*------------------------------------------------------ButtonWidget-------------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
static BitmapCol LButton_Expand(BitmapCol a, int amount) {
|
||||
int r, g, b;
|
||||
r = BitmapCol_R(a) + amount; Math_Clamp(r, 0, 255);
|
||||
g = BitmapCol_G(a) + amount; Math_Clamp(g, 0, 255);
|
||||
b = BitmapCol_B(a) + amount; Math_Clamp(b, 0, 255);
|
||||
return BitmapCol_Make(r, g, b, 255);
|
||||
}
|
||||
|
||||
static void LButton_DrawBase(struct Context2D* ctx, int x, int y, int width, int height, cc_bool hovered) {
|
||||
BitmapCol color = hovered ? Launcher_Theme.ButtonForeActiveColor
|
||||
: Launcher_Theme.ButtonForeColor;
|
||||
@ -47,7 +39,7 @@ static void LButton_DrawBase(struct Context2D* ctx, int x, int y, int width, int
|
||||
x + oneX, y + oneY,
|
||||
width - twoX, height - twoY);
|
||||
} else {
|
||||
Gradient_Vertical(ctx, LButton_Expand(color, 8), LButton_Expand(color, -8),
|
||||
Gradient_Vertical(ctx, BitmapColor_Offset(color, 8,8,8), BitmapColor_Offset(color, -8,-8,-8),
|
||||
x + oneX, y + oneY,
|
||||
width - twoX, height - twoY);
|
||||
}
|
||||
@ -76,7 +68,7 @@ static void LButton_DrawBorder(struct Context2D* ctx, int x, int y, int width, i
|
||||
}
|
||||
|
||||
static void LButton_DrawHighlight(struct Context2D* ctx, int x, int y, int width, int height, cc_bool hovered) {
|
||||
BitmapCol activeColor = BitmapCol_Make(189, 198, 255, 255);
|
||||
BitmapCol activeColor = BitmapColor_RGB(189, 198, 255);
|
||||
BitmapCol color = Launcher_Theme.ButtonHighlightColor;
|
||||
|
||||
if (Launcher_Theme.ClassicBackground) {
|
||||
@ -418,7 +410,7 @@ void LLine_Init(struct LLine* w, int width, const struct LLayout* layouts) {
|
||||
LBackend_LineInit(w, width);
|
||||
}
|
||||
|
||||
#define CLASSIC_LINE_COLOR BitmapCol_Make(128,128,128, 255)
|
||||
#define CLASSIC_LINE_COLOR BitmapColor_RGB(128, 128, 128)
|
||||
BitmapCol LLine_GetColor(void) {
|
||||
return Launcher_Theme.ClassicBackground ? CLASSIC_LINE_COLOR : Launcher_Theme.ButtonBorderColor;
|
||||
}
|
||||
@ -730,9 +722,9 @@ void LTable_ShowSelected(struct LTable* w) {
|
||||
}
|
||||
|
||||
BitmapCol LTable_RowColor(struct ServerInfo* entry, int row, cc_bool selected) {
|
||||
BitmapCol featSelColor = BitmapCol_Make( 50, 53, 0, 255);
|
||||
BitmapCol featuredColor = BitmapCol_Make(101, 107, 0, 255);
|
||||
BitmapCol selectedColor = BitmapCol_Make( 40, 40, 40, 255);
|
||||
BitmapCol featSelColor = BitmapColor_RGB( 50, 53, 0);
|
||||
BitmapCol featuredColor = BitmapColor_RGB(101, 107, 0);
|
||||
BitmapCol selectedColor = BitmapColor_RGB( 40, 40, 40);
|
||||
|
||||
if (entry && entry->featured) {
|
||||
return selected ? featSelColor : featuredColor;
|
||||
@ -741,7 +733,7 @@ BitmapCol LTable_RowColor(struct ServerInfo* entry, int row, cc_bool selected) {
|
||||
}
|
||||
|
||||
if (!Launcher_Theme.ClassicBackground) {
|
||||
return BitmapCol_Make(20, 20, 10, 255);
|
||||
return BitmapColor_RGB(20, 20, 10);
|
||||
} else {
|
||||
return (row & 1) == 0 ? Launcher_Theme.BackgroundColor : 0;
|
||||
}
|
||||
|
@ -290,27 +290,27 @@ void Launcher_Run(void) {
|
||||
struct LauncherTheme Launcher_Theme;
|
||||
const struct LauncherTheme Launcher_ModernTheme = {
|
||||
false,
|
||||
BitmapCol_Make(153, 127, 172, 255), /* background */
|
||||
BitmapCol_Make( 97, 81, 110, 255), /* button border */
|
||||
BitmapCol_Make(189, 168, 206, 255), /* active button */
|
||||
BitmapCol_Make(141, 114, 165, 255), /* button foreground */
|
||||
BitmapCol_Make(162, 131, 186, 255), /* button highlight */
|
||||
BitmapColor_RGB(153, 127, 172), /* background */
|
||||
BitmapColor_RGB( 97, 81, 110), /* button border */
|
||||
BitmapColor_RGB(189, 168, 206), /* active button */
|
||||
BitmapColor_RGB(141, 114, 165), /* button foreground */
|
||||
BitmapColor_RGB(162, 131, 186), /* button highlight */
|
||||
};
|
||||
const struct LauncherTheme Launcher_ClassicTheme = {
|
||||
true,
|
||||
BitmapCol_Make( 41, 41, 41, 255), /* background */
|
||||
BitmapCol_Make( 0, 0, 0, 255), /* button border */
|
||||
BitmapCol_Make(126, 136, 191, 255), /* active button */
|
||||
BitmapCol_Make(111, 111, 111, 255), /* button foreground */
|
||||
BitmapCol_Make(168, 168, 168, 255), /* button highlight */
|
||||
BitmapColor_RGB( 41, 41, 41), /* background */
|
||||
BitmapColor_RGB( 0, 0, 0), /* button border */
|
||||
BitmapColor_RGB(126, 136, 191), /* active button */
|
||||
BitmapColor_RGB(111, 111, 111), /* button foreground */
|
||||
BitmapColor_RGB(168, 168, 168), /* button highlight */
|
||||
};
|
||||
const struct LauncherTheme Launcher_NordicTheme = {
|
||||
false,
|
||||
BitmapCol_Make( 46, 52, 64, 255), /* background */
|
||||
BitmapCol_Make( 59, 66, 82, 255), /* button border */
|
||||
BitmapCol_Make( 66, 74, 90, 255), /* active button */
|
||||
BitmapCol_Make( 59, 66, 82, 255), /* button foreground */
|
||||
BitmapCol_Make( 76, 86, 106, 255), /* button highlight */
|
||||
BitmapColor_RGB( 46, 52, 64), /* background */
|
||||
BitmapColor_RGB( 59, 66, 82), /* button border */
|
||||
BitmapColor_RGB( 66, 74, 90), /* active button */
|
||||
BitmapColor_RGB( 59, 66, 82), /* button foreground */
|
||||
BitmapColor_RGB( 76, 86, 106), /* button highlight */
|
||||
};
|
||||
|
||||
CC_NOINLINE static void ParseColor(const char* key, BitmapCol* color) {
|
||||
@ -319,7 +319,7 @@ CC_NOINLINE static void ParseColor(const char* key, BitmapCol* color) {
|
||||
if (!Options_UNSAFE_Get(key, &value)) return;
|
||||
if (!PackedCol_TryParseHex(&value, rgb)) return;
|
||||
|
||||
*color = BitmapCol_Make(rgb[0], rgb[1], rgb[2], 255);
|
||||
*color = BitmapColor_RGB(rgb[0], rgb[1], rgb[2]);
|
||||
}
|
||||
|
||||
void Launcher_LoadTheme(void) {
|
||||
@ -373,11 +373,10 @@ static void TintBitmap(struct Bitmap* bmp, cc_uint8 tintA, cc_uint8 tintB, int w
|
||||
|
||||
for (xx = 0; xx < width; xx++) {
|
||||
/* TODO: Not shift when multiplying */
|
||||
row[xx] = BitmapCol_Make(
|
||||
row[xx] = BitmapColor_RGB(
|
||||
BitmapCol_R(row[xx]) * tint / 255,
|
||||
BitmapCol_G(row[xx]) * tint / 255,
|
||||
BitmapCol_B(row[xx]) * tint / 255,
|
||||
255);
|
||||
BitmapCol_B(row[xx]) * tint / 255);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -518,9 +517,9 @@ void Launcher_DrawLogo(struct FontDesc* font, const char* text, struct Context2D
|
||||
DrawTextArgs_Make(&args, &title, font, false);
|
||||
x = ctx->width / 2 - Drawer2D_TextWidth(&args) / 2;
|
||||
|
||||
Drawer2D.Colors['f'] = BITMAPCOL_BLACK;
|
||||
Drawer2D.Colors['f'] = BITMAPCOLOR_BLACK;
|
||||
Context2D_DrawText(ctx, &args, x + Display_ScaleX(4), Display_ScaleY(4));
|
||||
Drawer2D.Colors['f'] = BITMAPCOL_WHITE;
|
||||
Drawer2D.Colors['f'] = BITMAPCOLOR_WHITE;
|
||||
Context2D_DrawText(ctx, &args, x, 0);
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ static cc_bool IsAllBlack(const struct Bitmap* bmp, int x1, int y1, int width, i
|
||||
BitmapCol* row = Bitmap_GetRow(bmp, y);
|
||||
|
||||
for (x = x1; x < x1 + width; x++) {
|
||||
if (row[x] != BITMAPCOL_BLACK) return false;
|
||||
if (row[x] != BITMAPCOLOR_BLACK) return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -154,7 +154,7 @@ static void JNICALL java_processSurfaceResized(JNIEnv* env, jobject o, jobject s
|
||||
|
||||
static void JNICALL java_processSurfaceRedrawNeeded(JNIEnv* env, jobject o) {
|
||||
Platform_LogConst("WIN - REDRAW");
|
||||
Event_RaiseVoid(&WindowEvents.Redraw);
|
||||
Event_RaiseVoid(&WindowEvents.RedrawNeeded);
|
||||
}
|
||||
|
||||
static void JNICALL java_onStart(JNIEnv* env, jobject o) {
|
||||
|
@ -237,7 +237,7 @@ static OSStatus Window_ProcessWindowEvent(EventRef inEvent) {
|
||||
return eventNotHandledErr;
|
||||
|
||||
case kEventWindowDrawContent:
|
||||
Event_RaiseVoid(&WindowEvents.Redraw);
|
||||
Event_RaiseVoid(&WindowEvents.RedrawNeeded);
|
||||
return eventNotHandledErr;
|
||||
}
|
||||
return eventNotHandledErr;
|
||||
|
@ -197,7 +197,7 @@ static void OnTextEvent(const SDL_Event* e) {
|
||||
static void OnWindowEvent(const SDL_Event* e) {
|
||||
switch (e->window.event) {
|
||||
case SDL_WINDOWEVENT_EXPOSED:
|
||||
Event_RaiseVoid(&WindowEvents.Redraw);
|
||||
Event_RaiseVoid(&WindowEvents.RedrawNeeded);
|
||||
break;
|
||||
case SDL_WINDOWEVENT_SIZE_CHANGED:
|
||||
RefreshWindowBounds();
|
||||
|
@ -119,7 +119,7 @@ static LRESULT CALLBACK Window_Procedure(HWND handle, UINT message, WPARAM wPara
|
||||
|
||||
case WM_PAINT:
|
||||
ValidateRect(win_handle, NULL);
|
||||
Event_RaiseVoid(&WindowEvents.Redraw);
|
||||
Event_RaiseVoid(&WindowEvents.RedrawNeeded);
|
||||
return 0;
|
||||
|
||||
case WM_WINDOWPOSCHANGED:
|
||||
@ -181,23 +181,31 @@ static LRESULT CALLBACK Window_Procedure(HWND handle, UINT message, WPARAM wPara
|
||||
|
||||
case WM_INPUT:
|
||||
{
|
||||
RAWINPUT raw;
|
||||
int dx, dy, width, height, absX, absY, isVirtual;
|
||||
UINT ret, rawSize = sizeof(RAWINPUT);
|
||||
int dx, dy;
|
||||
RAWINPUT raw;
|
||||
|
||||
ret = _GetRawInputData((HRAWINPUT)lParam, RID_INPUT, &raw, &rawSize, sizeof(RAWINPUTHEADER));
|
||||
if (ret == -1 || raw.header.dwType != RIM_TYPEMOUSE) break;
|
||||
|
||||
if (raw.data.mouse.usFlags == MOUSE_MOVE_RELATIVE) {
|
||||
/* Majority of mouse input devices provide relative coordinates */
|
||||
dx = raw.data.mouse.lLastX;
|
||||
dy = raw.data.mouse.lLastY;
|
||||
} else if (raw.data.mouse.usFlags == MOUSE_MOVE_ABSOLUTE) {
|
||||
} else if (raw.data.mouse.usFlags & MOUSE_MOVE_ABSOLUTE) {
|
||||
/* This mouse mode is produced by VirtualBox with Mouse Integration on */
|
||||
/* To understand reasoning behind the following code, see Remarks in */
|
||||
/* https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-rawmouse */
|
||||
static int prevPosX, prevPosY;
|
||||
dx = raw.data.mouse.lLastX - prevPosX;
|
||||
dy = raw.data.mouse.lLastY - prevPosY;
|
||||
isVirtual = (raw.data.mouse.usFlags & MOUSE_VIRTUAL_DESKTOP);
|
||||
|
||||
prevPosX = raw.data.mouse.lLastX;
|
||||
prevPosY = raw.data.mouse.lLastY;
|
||||
width = GetSystemMetrics(isVirtual ? SM_CXVIRTUALSCREEN : SM_CXSCREEN);
|
||||
height = GetSystemMetrics(isVirtual ? SM_CYVIRTUALSCREEN : SM_CYSCREEN);
|
||||
absX = (int)((raw.data.mouse.lLastX / 65535.0f) * width);
|
||||
absY = (int)((raw.data.mouse.lLastY / 65535.0f) * height);
|
||||
|
||||
dx = absX - prevPosX; prevPosX = absX;
|
||||
dy = absY - prevPosY; prevPosY = absY;
|
||||
} else { break; }
|
||||
|
||||
if (Input_RawMode) Event_RaiseRawMove(&PointerEvents.RawMoved, (float)dx, (float)dy);
|
||||
|
@ -541,7 +541,7 @@ void Window_ProcessEvents(void) {
|
||||
break;
|
||||
|
||||
case Expose:
|
||||
if (e.xexpose.count == 0) Event_RaiseVoid(&WindowEvents.Redraw);
|
||||
if (e.xexpose.count == 0) Event_RaiseVoid(&WindowEvents.RedrawNeeded);
|
||||
break;
|
||||
|
||||
case LeaveNotify:
|
||||
|
@ -552,6 +552,8 @@ static void DoDrawFramebuffer(CGRect dirty) {
|
||||
NSGraphicsContext* nsContext;
|
||||
CGImageRef image;
|
||||
CGRect rect;
|
||||
|
||||
Event_RaiseVoid(&WindowEvents.Redrawing);
|
||||
|
||||
// Unfortunately CGImageRef is immutable, so changing the
|
||||
// underlying data doesn't change what shows when drawing.
|
||||
|
@ -15,8 +15,8 @@
|
||||
#include "Funcs.h"
|
||||
#include <mach-o/dyld.h>
|
||||
#include <sys/stat.h>
|
||||
#include <UIKit/UIPasteboard.h>
|
||||
#include <UIKit/UIKit.h>
|
||||
#include <UIKit/UIPasteboard.h>
|
||||
#include <OpenGLES/ES2/gl.h>
|
||||
#include <OpenGLES/ES2/glext.h>
|
||||
#include <CoreText/CoreText.h>
|
||||
@ -63,9 +63,13 @@ static UIInterfaceOrientationMask SupportedOrientations(void) {
|
||||
return UIInterfaceOrientationMaskAll;
|
||||
}
|
||||
|
||||
@implementation CCWindow
|
||||
static cc_bool fullscreen = true;
|
||||
static CGRect GetViewFrame(void) {
|
||||
UIScreen* screen = UIScreen.mainScreen;
|
||||
return fullscreen ? screen.bounds : screen.applicationFrame;
|
||||
}
|
||||
|
||||
//- (void)drawRect:(CGRect)dirty { DoDrawFramebuffer(dirty); }
|
||||
@implementation CCWindow
|
||||
|
||||
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
|
||||
for (UITouch* t in touches) AddTouch(t);
|
||||
@ -154,9 +158,17 @@ static UITextField* kb_widget;
|
||||
} completion:nil];
|
||||
}
|
||||
|
||||
/*- (BOOL)prefersStatusBarHidden {
|
||||
|
||||
}*/
|
||||
- (BOOL)prefersStatusBarHidden {
|
||||
return fullscreen;
|
||||
}
|
||||
|
||||
- (UIRectEdge)preferredScreenEdgesDeferringSystemGestures {
|
||||
// recent iOS versions have a 'bottom home bar', which when swiped up,
|
||||
// switches out of ClassiCube and to the app list menu
|
||||
// overriding this forces the user to swipe up twice, which should
|
||||
// significantly the chance of accidentally triggering this gesture
|
||||
return UIRectEdgeBottom;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation CCAppDelegate
|
||||
@ -312,13 +324,20 @@ void Window_Init(void) {
|
||||
DisplayInfo.ScaleY = 1; // TODO dpi scale
|
||||
}
|
||||
|
||||
static UIColor* CalcBackgroundColor(void) {
|
||||
// default to purple if no themed background color yet
|
||||
if (!Launcher_Theme.BackgroundColor)
|
||||
return UIColor.purpleColor;
|
||||
return ToUIColor(Launcher_Theme.BackgroundColor, 1.0f);
|
||||
}
|
||||
|
||||
static CGRect DoCreateWindow(void) {
|
||||
CGRect bounds = UIScreen.mainScreen.bounds;
|
||||
CGRect bounds = GetViewFrame();
|
||||
cc_controller = [CCViewController alloc];
|
||||
win_handle = [[CCWindow alloc] initWithFrame:bounds];
|
||||
|
||||
win_handle.rootViewController = cc_controller;
|
||||
win_handle.backgroundColor = UIColor.blueColor;
|
||||
win_handle.backgroundColor = CalcBackgroundColor();
|
||||
WindowInfo.Exists = true;
|
||||
WindowInfo.Width = bounds.size.width;
|
||||
WindowInfo.Height = bounds.size.height;
|
||||
@ -421,9 +440,22 @@ void Window_CloseKeyboard(void) {
|
||||
[text_input resignFirstResponder];
|
||||
}
|
||||
|
||||
int Window_GetWindowState(void) { return WINDOW_STATE_NORMAL; }
|
||||
cc_result Window_EnterFullscreen(void) { return ERR_NOT_SUPPORTED; }
|
||||
cc_result Window_ExitFullscreen(void) { return ERR_NOT_SUPPORTED; }
|
||||
int Window_GetWindowState(void) {
|
||||
return fullscreen ? WINDOW_STATE_FULLSCREEN : WINDOW_STATE_NORMAL;
|
||||
}
|
||||
|
||||
static void ToggleFullscreen(cc_bool isFullscreen) {
|
||||
fullscreen = isFullscreen;
|
||||
[cc_controller setNeedsStatusBarAppearanceUpdate];
|
||||
view_handle.frame = GetViewFrame();
|
||||
}
|
||||
|
||||
cc_result Window_EnterFullscreen(void) {
|
||||
ToggleFullscreen(true); return 0;
|
||||
}
|
||||
cc_result Window_ExitFullscreen(void) {
|
||||
ToggleFullscreen(false); return 0;
|
||||
}
|
||||
int Window_IsObscured(void) { return 0; }
|
||||
|
||||
void Window_EnableRawMouse(void) { DefaultEnableRawMouse(); }
|
||||
@ -473,6 +505,8 @@ void Window_Create2D(int width, int height) {
|
||||
/*#########################################################################################################################*
|
||||
*--------------------------------------------------------3D window--------------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
static void GLContext_OnLayout(void);
|
||||
|
||||
@interface CCGLView : UIView
|
||||
@end
|
||||
|
||||
@ -481,6 +515,11 @@ void Window_Create2D(int width, int height) {
|
||||
+ (Class)layerClass {
|
||||
return [CAEAGLLayer class];
|
||||
}
|
||||
|
||||
- (void)layoutSubviews {
|
||||
[super layoutSubviews];
|
||||
GLContext_OnLayout();
|
||||
}
|
||||
@end
|
||||
|
||||
void Window_Create3D(int width, int height) {
|
||||
@ -505,6 +544,7 @@ void Window_Create3D(int width, int height) {
|
||||
static EAGLContext* ctx_handle;
|
||||
static GLuint framebuffer;
|
||||
static GLuint color_renderbuffer, depth_renderbuffer;
|
||||
static int fb_width, fb_height;
|
||||
|
||||
static void CreateFramebuffer(void) {
|
||||
CAEAGLLayer* layer = (CAEAGLLayer*)view_handle.layer;
|
||||
@ -524,6 +564,9 @@ static void CreateFramebuffer(void) {
|
||||
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE)
|
||||
Logger_Abort2(status, "Failed to create renderbuffer");
|
||||
|
||||
fb_width = WindowInfo.Width;
|
||||
fb_height = WindowInfo.Height;
|
||||
}
|
||||
|
||||
void GLContext_Create(void) {
|
||||
@ -535,8 +578,18 @@ void GLContext_Create(void) {
|
||||
}
|
||||
|
||||
void GLContext_Update(void) {
|
||||
// trying to update renderbuffer here results in garbage output,
|
||||
// so do instead when layoutSubviews method is called
|
||||
}
|
||||
|
||||
static void GLContext_OnLayout(void) {
|
||||
CAEAGLLayer* layer = (CAEAGLLayer*)view_handle.layer;
|
||||
|
||||
// only resize buffers when absolutely have to
|
||||
if (fb_width == WindowInfo.Width && fb_height == WindowInfo.Height) return;
|
||||
fb_width = WindowInfo.Width;
|
||||
fb_height = WindowInfo.Height;
|
||||
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, color_renderbuffer);
|
||||
[ctx_handle renderbufferStorage:GL_RENDERBUFFER fromDrawable:layer];
|
||||
|
||||
@ -670,8 +723,6 @@ void GetDeviceUUID(cc_string* str) {
|
||||
*-----------------------------------------------------Font handling-------------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
#ifndef CC_BUILD_FREETYPE
|
||||
#include "ExtMath.h"
|
||||
|
||||
void interop_GetFontNames(struct StringsBuffer* buffer) {
|
||||
NSArray<NSString*>* families = UIFont.familyNames;
|
||||
NSLog(@"Families: %@", families);
|
||||
@ -688,6 +739,7 @@ void interop_GetFontNames(struct StringsBuffer* buffer) {
|
||||
StringsBuffer_Sort(buffer);
|
||||
}
|
||||
|
||||
#include "ExtMath.h"
|
||||
static void InitFont(struct FontDesc* desc, UIFont* font) {
|
||||
desc->handle = CFBridgingRetain(font);
|
||||
desc->height = Math_Ceil(Math_AbsF(font.ascender) + Math_AbsF(font.descender));
|
||||
@ -1102,6 +1154,7 @@ static UIView* LBackend_InputShow(struct LInput* w) {
|
||||
fld.frame = CGRectMake(0, 0, w->_textHeight, LINPUT_HEIGHT);
|
||||
fld.borderStyle = UITextBorderStyleBezel;
|
||||
fld.backgroundColor = UIColor.whiteColor;
|
||||
fld.textColor = UIColor.blackColor;
|
||||
fld.delegate = ui_controller;
|
||||
[fld addTarget:ui_controller action:@selector(handleTextChanged:) forControlEvents:UIControlEventEditingChanged];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user