mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 20:18:47 +02:00
@ -1,4 +1,3 @@
|
||||
|
||||
#import <TargetConditionals.h>
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
#import "AppDelegate.h"
|
||||
|
||||
@implementation AppDelegate
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
#import <MetalKit/MetalKit.h>
|
||||
|
||||
@interface Renderer : NSObject <MTKViewDelegate>
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
#import "Renderer.h"
|
||||
#import <Metal/Metal.h>
|
||||
|
||||
@ -50,7 +49,7 @@
|
||||
io.DeltaTime = 1 / float(view.preferredFramesPerSecond ?: 60);
|
||||
|
||||
id<MTLCommandBuffer> commandBuffer = [self.commandQueue commandBuffer];
|
||||
|
||||
|
||||
static bool show_demo_window = true;
|
||||
static bool show_another_window = false;
|
||||
static float clear_color[4] = { 0.28f, 0.36f, 0.5f, 1.0f };
|
||||
@ -87,7 +86,7 @@
|
||||
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
|
||||
ImGui::Checkbox("Another Window", &show_another_window);
|
||||
|
||||
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
||||
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
||||
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
||||
|
||||
if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
|
||||
@ -113,13 +112,13 @@
|
||||
ImGui::Render();
|
||||
ImDrawData *drawData = ImGui::GetDrawData();
|
||||
ImGui_ImplMetal_RenderDrawData(drawData, commandBuffer, renderEncoder);
|
||||
|
||||
|
||||
[renderEncoder popDebugGroup];
|
||||
[renderEncoder endEncoding];
|
||||
|
||||
[commandBuffer presentDrawable:view.currentDrawable];
|
||||
}
|
||||
|
||||
|
||||
[commandBuffer commit];
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
#import <Metal/Metal.h>
|
||||
#import <MetalKit/MetalKit.h>
|
||||
#import "Renderer.h"
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
#import "ViewController.h"
|
||||
#import "Renderer.h"
|
||||
#include "imgui.h"
|
||||
@ -21,9 +20,9 @@
|
||||
- (void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
|
||||
|
||||
self.mtkView.device = MTLCreateSystemDefaultDevice();
|
||||
|
||||
|
||||
if (!self.mtkView.device) {
|
||||
NSLog(@"Metal is not supported");
|
||||
abort();
|
||||
@ -42,7 +41,7 @@
|
||||
owner:self
|
||||
userInfo:nil];
|
||||
[self.view addTrackingArea:trackingArea];
|
||||
|
||||
|
||||
// If we want to receive key events, we either need to be in the responder chain of the key view,
|
||||
// or else we can install a local monitor. The consequence of this heavy-handed approach is that
|
||||
// we receive events for all controls, not just Dear ImGui widgets. If we had native controls in our
|
||||
@ -56,9 +55,9 @@
|
||||
} else {
|
||||
return event;
|
||||
}
|
||||
|
||||
|
||||
}];
|
||||
|
||||
|
||||
ImGui_ImplOSX_Init();
|
||||
#endif
|
||||
}
|
||||
@ -97,7 +96,7 @@
|
||||
CGPoint touchLocation = [anyTouch locationInView:self.view];
|
||||
ImGuiIO &io = ImGui::GetIO();
|
||||
io.MousePos = ImVec2(touchLocation.x, touchLocation.y);
|
||||
|
||||
|
||||
BOOL hasActiveTouch = NO;
|
||||
for (UITouch *touch in event.allTouches) {
|
||||
if (touch.phase != UITouchPhaseEnded && touch.phase != UITouchPhaseCancelled) {
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
#import <TargetConditionals.h>
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
|
Reference in New Issue
Block a user