mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-27 10:57:22 +08:00
Fixed whitespace
This commit is contained in:
+12
-12
@@ -91,11 +91,11 @@ struct VulkanVideoContext
|
|||||||
|
|
||||||
VulkanDeviceFeatures features;
|
VulkanDeviceFeatures features;
|
||||||
|
|
||||||
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr;
|
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr;
|
||||||
#define VULKAN_GLOBAL_FUNCTION(name) PFN_##name name;
|
#define VULKAN_GLOBAL_FUNCTION(name) PFN_##name name;
|
||||||
#define VULKAN_INSTANCE_FUNCTION(name) PFN_##name name;
|
#define VULKAN_INSTANCE_FUNCTION(name) PFN_##name name;
|
||||||
#define VULKAN_DEVICE_FUNCTION(name) PFN_##name name;
|
#define VULKAN_DEVICE_FUNCTION(name) PFN_##name name;
|
||||||
VULKAN_FUNCTIONS()
|
VULKAN_FUNCTIONS()
|
||||||
#undef VULKAN_GLOBAL_FUNCTION
|
#undef VULKAN_GLOBAL_FUNCTION
|
||||||
#undef VULKAN_INSTANCE_FUNCTION
|
#undef VULKAN_INSTANCE_FUNCTION
|
||||||
#undef VULKAN_DEVICE_FUNCTION
|
#undef VULKAN_DEVICE_FUNCTION
|
||||||
@@ -440,7 +440,7 @@ static int findPhysicalDevice(VulkanVideoContext *context)
|
|||||||
if (!context->physicalDevice) {
|
if (!context->physicalDevice) {
|
||||||
return SDL_SetError("Vulkan: no viable physical devices found");
|
return SDL_SetError("Vulkan: no viable physical devices found");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void initDeviceFeatures(VulkanDeviceFeatures *features)
|
static void initDeviceFeatures(VulkanDeviceFeatures *features)
|
||||||
@@ -649,24 +649,24 @@ done:
|
|||||||
if (result != VK_SUCCESS) {
|
if (result != VK_SUCCESS) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
VulkanVideoContext *CreateVulkanVideoContext(SDL_Window *window)
|
VulkanVideoContext *CreateVulkanVideoContext(SDL_Window *window)
|
||||||
{
|
{
|
||||||
VulkanVideoContext *context = SDL_calloc(1, sizeof(*context));
|
VulkanVideoContext *context = SDL_calloc(1, sizeof(*context));
|
||||||
if (!context) {
|
if (!context) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (loadGlobalFunctions(context) < 0 ||
|
if (loadGlobalFunctions(context) < 0 ||
|
||||||
createInstance(context) < 0 ||
|
createInstance(context) < 0 ||
|
||||||
createSurface(context, window) < 0 ||
|
createSurface(context, window) < 0 ||
|
||||||
findPhysicalDevice(context) < 0 ||
|
findPhysicalDevice(context) < 0 ||
|
||||||
createDevice(context) < 0) {
|
createDevice(context) < 0) {
|
||||||
DestroyVulkanVideoContext(context);
|
DestroyVulkanVideoContext(context);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupVulkanRenderProperties(VulkanVideoContext *context, SDL_PropertiesID props)
|
void SetupVulkanRenderProperties(VulkanVideoContext *context, SDL_PropertiesID props)
|
||||||
|
|||||||
+21
-21
@@ -75,32 +75,32 @@ static void DrawScreen(SDL_Renderer *renderer)
|
|||||||
|
|
||||||
SDL_SetRenderDrawColor(renderer, 0xa0, 0xa0, 0xa0, 0xff);
|
SDL_SetRenderDrawColor(renderer, 0xa0, 0xa0, 0xa0, 0xff);
|
||||||
if (last_touching) {
|
if (last_touching) {
|
||||||
SDL_FRect rect;
|
SDL_FRect rect;
|
||||||
|
|
||||||
rect.x = 0;
|
rect.x = 0;
|
||||||
rect.y = 0;
|
rect.y = 0;
|
||||||
rect.w = 2.0f * X - 1.0f;
|
rect.w = 2.0f * X - 1.0f;
|
||||||
rect.h = 2.0f * Y - 1.0f;
|
rect.h = 2.0f * Y - 1.0f;
|
||||||
|
|
||||||
SDL_RenderRect(renderer, &rect);
|
SDL_RenderRect(renderer, &rect);
|
||||||
} else {
|
} else {
|
||||||
/* Show where the pen is rotating when it isn't touching the surface.
|
/* Show where the pen is rotating when it isn't touching the surface.
|
||||||
Otherwise we draw the rotation angle below together with pressure information. */
|
Otherwise we draw the rotation angle below together with pressure information. */
|
||||||
float rot_vecx = SDL_sinf(last_rotation / 180.0f * SDL_PI_F);
|
float rot_vecx = SDL_sinf(last_rotation / 180.0f * SDL_PI_F);
|
||||||
float rot_vecy = -SDL_cosf(last_rotation / 180.0f * SDL_PI_F);
|
float rot_vecy = -SDL_cosf(last_rotation / 180.0f * SDL_PI_F);
|
||||||
float px = X + rot_vecx * 100.0f;
|
float px = X + rot_vecx * 100.0f;
|
||||||
float py = Y + rot_vecy * 100.0f;
|
float py = Y + rot_vecy * 100.0f;
|
||||||
float px2 = X + rot_vecx * 80.0f;
|
float px2 = X + rot_vecx * 80.0f;
|
||||||
float py2 = Y + rot_vecy * 80.0f;
|
float py2 = Y + rot_vecy * 80.0f;
|
||||||
|
|
||||||
SDL_RenderLine(renderer,
|
SDL_RenderLine(renderer,
|
||||||
px, py,
|
px, py,
|
||||||
px2 + rot_vecy * 20.0f,
|
px2 + rot_vecy * 20.0f,
|
||||||
py2 - rot_vecx * 20.0f);
|
py2 - rot_vecx * 20.0f);
|
||||||
SDL_RenderLine(renderer,
|
SDL_RenderLine(renderer,
|
||||||
px, py,
|
px, py,
|
||||||
px2 - rot_vecy * 20.0f,
|
px2 - rot_vecy * 20.0f,
|
||||||
py2 + rot_vecx * 20.0f);
|
py2 + rot_vecx * 20.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (last_was_eraser) {
|
if (last_was_eraser) {
|
||||||
@@ -359,7 +359,7 @@ static void process_event(SDL_Event event)
|
|||||||
SDL_HideCursor();
|
SDL_HideCursor();
|
||||||
last_x = ev->x;
|
last_x = ev->x;
|
||||||
last_y = ev->y;
|
last_y = ev->y;
|
||||||
update_axes(ev->axes);
|
update_axes(ev->axes);
|
||||||
last_was_eraser = ev->pen_state & SDL_PEN_ERASER_MASK;
|
last_was_eraser = ev->pen_state & SDL_PEN_ERASER_MASK;
|
||||||
#if VERBOSE
|
#if VERBOSE
|
||||||
SDL_Log("[%lu] pen motion: %s %u at (%.4f, %.4f); pressure=%.3f, tilt=%.3f/%.3f, dist=%.3f [buttons=%02x]\n",
|
SDL_Log("[%lu] pen motion: %s %u at (%.4f, %.4f); pressure=%.3f, tilt=%.3f/%.3f, dist=%.3f [buttons=%02x]\n",
|
||||||
@@ -375,7 +375,7 @@ static void process_event(SDL_Event event)
|
|||||||
SDL_PenTipEvent *ev = &event.ptip;
|
SDL_PenTipEvent *ev = &event.ptip;
|
||||||
last_x = ev->x;
|
last_x = ev->x;
|
||||||
last_y = ev->y;
|
last_y = ev->y;
|
||||||
update_axes(ev->axes);
|
update_axes(ev->axes);
|
||||||
last_was_eraser = ev->tip == SDL_PEN_TIP_ERASER;
|
last_was_eraser = ev->tip == SDL_PEN_TIP_ERASER;
|
||||||
last_button = ev->pen_state & 0xf; /* button mask */
|
last_button = ev->pen_state & 0xf; /* button mask */
|
||||||
last_touching = (event.type == SDL_EVENT_PEN_DOWN);
|
last_touching = (event.type == SDL_EVENT_PEN_DOWN);
|
||||||
@@ -389,7 +389,7 @@ static void process_event(SDL_Event event)
|
|||||||
SDL_HideCursor();
|
SDL_HideCursor();
|
||||||
last_x = ev->x;
|
last_x = ev->x;
|
||||||
last_y = ev->y;
|
last_y = ev->y;
|
||||||
update_axes(ev->axes);
|
update_axes(ev->axes);
|
||||||
if (last_pressure > 0.0f && !last_touching) {
|
if (last_pressure > 0.0f && !last_touching) {
|
||||||
SDL_LogWarn(SDL_LOG_CATEGORY_TEST,
|
SDL_LogWarn(SDL_LOG_CATEGORY_TEST,
|
||||||
"[%lu] : reported pressure %.5f even though pen is not touching surface",
|
"[%lu] : reported pressure %.5f even though pen is not touching surface",
|
||||||
|
|||||||
Reference in New Issue
Block a user