1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

sokol: remove an absolute import

This commit is contained in:
Alexander Medvednikov 2021-01-23 10:32:00 +01:00
parent d991712b3c
commit 45cc3ec664
4 changed files with 27 additions and 40 deletions

View File

@ -2863,34 +2863,31 @@ _SAPP_OBJC_RELEASE( menu_bar );
*/
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
// Create a child view for native rendering
CGRect wRect = _sapp.macos.window.frame;
NSView *contentView =_sapp.macos.window.contentView;
CGRect cRect = contentView.frame;
CGRect wRect = _sapp.macos.window.frame;
NSView *contentView =_sapp.macos.window.contentView;
CGRect cRect = contentView.frame;
CGRect rect = CGRectMake(wRect.origin.x, wRect.origin.y, cRect.size.width, cRect.size.height);
NSWindow *overlayWindow = [[NSWindow alloc]initWithContentRect:rect
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:NO];
//overlayWindow.backgroundColor = [NSColor whiteColor];
CGRect rect = CGRectMake(wRect.origin.x, wRect.origin.y, cRect.size.width, cRect.size.height);
NSWindow *overlayWindow = [[NSWindow alloc]initWithContentRect:rect
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:NO];
//overlayWindow.backgroundColor = [NSColor whiteColor];
//overlayWindow.backgroundColor = [[NSColor whiteColor] colorWithAlphaComponent:0];
[overlayWindow setOpaque:YES];
[_sapp.macos.window setIgnoresMouseEvents:NO];
//[_sapp.macos.window setOpaque:NO];
//overlayWindow.alphaValue =0.1f;///.1f;
//overlayWindow.backgroundColor = [[NSColor whiteColor] colorWithAlphaComponent:0];
[overlayWindow setOpaque:YES];
[_sapp.macos.window setIgnoresMouseEvents:NO];
//[_sapp.macos.window setOpaque:NO];
g_view = [[MyView2 alloc] init];
overlayWindow.contentView = g_view;
//overlayWindow.alphaValue =0.1f;///.1f;
g_view = [[MyView2 alloc] init];
overlayWindow.contentView = g_view;
[ contentView addSubview:g_view];
[ contentView addSubview:g_view];
//[ _sapp.macos.window addChildWindow:overlayWindow ordered:NSWindowAbove];
//////////////////////////////////
@ -2913,7 +2910,8 @@ g_view = [[MyView2 alloc] init];
}
@end
#include "/Users/alex/code/v/thirdparty/sokol/sokol_app2.h"
//#include "/Users/alex/code/v/thirdparty/sokol/sokol_app2.h"
#include "sokol_app2.h"
@implementation _sapp_macos_window_delegate
- (BOOL)windowShouldClose:(id)sender {

View File

@ -396,7 +396,7 @@ pub fn is_file(path string) bool {
// is_abs_path returns `true` if `path` is absolute.
pub fn is_abs_path(path string) bool {
$if windows {
return path[0] == `/` || // incase we're in MingGW bash
return path[0] == `/` || // incase we're in MingGW bash
(path[0].is_letter() && path[1] == `:`)
}
return path[0] == `/`
@ -458,10 +458,10 @@ pub fn walk(path string, f fn (string)) {
// log will print "os.log: "+`s` ...
pub fn log(s string) {
//$if macos {
// Use NSLog() on macos
//C.darwin_log(s)
// Use NSLog() on macos
// C.darwin_log(s)
//} $else {
println('os.log: ' + s)
println('os.log: ' + s)
//}
}

View File

@ -1,36 +1,29 @@
module c
pub const (
used_import = 1
used_import = 1
)
#flag -I @VROOT/thirdparty/sokol
#flag -I @VROOT/thirdparty/sokol/util
#flag freebsd -I /usr/local/include
#flag darwin -fobjc-arc
#flag linux -lX11 -lGL -lXcursor -lXi
#flag freebsd -L/usr/local/lib -lX11 -lGL -lXcursor -lXi
#flag windows -lgdi32
// METAL
#flag darwin -DSOKOL_METAL
#flag darwin -framework Metal -framework Cocoa -framework MetalKit -framework QuartzCore
// OPENGL
#flag linux -DSOKOL_GLCORE33
#flag freebsd -DSOKOL_GLCORE33
//#flag darwin -framework OpenGL -framework Cocoa -framework QuartzCore
// D3D
#flag windows -DSOKOL_GLCORE33
//#flag windows -DSOKOL_D3D11
// for simplicity, all header includes are here because import order matters and we dont have any way
// to ensure import order with V yet
#define SOKOL_IMPL
// TODO should not be defined for android graphic (apk/aab using sokol) builds, but we have no ways to undefine
//#define SOKOL_NO_ENTRY
#flag linux -DSOKOL_NO_ENTRY
@ -40,14 +33,10 @@ pub const (
#flag freebsd -DSOKOL_NO_ENTRY
#flag solaris -DSOKOL_NO_ENTRY
// TODO end
#include "sokol_v.h"
#include "sokol_app.h"
#define SOKOL_IMPL
#define SOKOL_NO_DEPRECATED
#include "sokol_gfx.h"
#define SOKOL_GL_IMPL
#include "util/sokol_gl.h"

View File

@ -1964,7 +1964,7 @@ fn (mut p Parser) const_decl() ast.ConstDecl {
}
pos := p.tok.position()
name := p.check_name()
if false && util.contains_capital(name) {
if util.contains_capital(name) {
p.warn_with_pos('$p.file_name_dir const names cannot contain uppercase letters, use snake_case instead',
pos)
}