绘图基础,Linux中如何配置sudo用户

2019-11-19 02:57 来源:未知

Linux中的sudo文件在/etc/sudoers,但不建议直接修改此文件;

图片 1图片 2

目录

1. 安装 Flutter SDK2. 设置环境变量3. Flutter doctor4. 安装 Android Studio5. 启动 Android Studio, 安装 Android SDK6. 再次运行 Flutter doctor 查看依赖项7. 设置 Android emulator8. 配置编辑器8.1 Android Studio8.2 Visual Studio Code (VS Code)

第一次接触移动开发, 纯小白一枚, 慢慢摸索, 记录安装.

可以在/etc/sudoers.d文件夹中新建文件,文件名随意,在文件中添加内容如下:

  1 /*-----------------------------
  2 BEZIER.C -- Bezier Splines Demo
  3 (c) Charles Petzold, 1998
  4 -----------------------------*/
  5 
  6 #include <Windows.h>
  7 
  8 LRESULT CALLBACK WndPorc(HWND, UINT, WPARAM, LPARAM);
  9 
 10 int WINAPI WinMain( __in HINSTANCE hInstance
 11                     , __in_opt HINSTANCE hPrevInstance
 12                     , __in LPSTR lpCmdLine
 13                     , __in int nShowCmd )
 14 {
 15     static TCHAR szAppName[] = TEXT("Bezier");
 16     HWND hwnd;
 17     MSG msg;
 18     WNDCLASS wndclass;
 19 
 20     wndclass.style = CS_HREDRAW | CS_VREDRAW;
 21     wndclass.lpfnWndProc = WndPorc;
 22     wndclass.cbClsExtra = 0;
 23     wndclass.cbWndExtra = 0;
 24     wndclass.hInstance = hInstance;
 25     wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
 26     wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
 27     wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
 28     wndclass.lpszMenuName = NULL;
 29     wndclass.lpszClassName = szAppName;
 30 
 31     if (!RegisterClass(&wndclass))
 32     {
 33         MessageBox(NULL, TEXT("Program requires Windows NT!")
 34             , szAppName, MB_ICONERROR);
 35         return 0;
 36     }
 37 
 38     hwnd = CreateWindow(szAppName, TEXT("Bezier Splines")
 39         , WS_OVERLAPPEDWINDOW
 40         , CW_USEDEFAULT, CW_USEDEFAULT
 41         , CW_USEDEFAULT, CW_USEDEFAULT
 42         , NULL, NULL, hInstance, NULL);
 43 
 44     ShowWindow(hwnd, nShowCmd);
 45     UpdateWindow(hwnd);
 46 
 47     while (GetMessage(&msg, NULL, 0, 0))
 48     {
 49         TranslateMessage(&msg);
 50         DispatchMessage(&msg);
 51     }
 52 
 53     return msg.wParam;
 54 }
 55 
 56 void DrawBezier(HDC hdc, POINT apt[])
 57 {
 58     PolyBezier(hdc, apt, 4);
 59 
 60     MoveToEx(hdc, apt[0].x, apt[0].y, NULL);
 61     LineTo(hdc, apt[1].x, apt[1].y);
 62 
 63     MoveToEx(hdc, apt[2].x, apt[2].y, NULL);
 64     LineTo(hdc, apt[3].x, apt[3].y);
 65 }
 66 
 67 LRESULT CALLBACK WndPorc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 68 {
 69     static POINT apt[4];
 70     HDC hdc;
 71     int cxClient, cyClient;
 72     PAINTSTRUCT ps;
 73 
 74     switch (message)
 75     {
 76     case WM_SIZE:
 77         cxClient = LOWORD(lParam);
 78         cyClient = HIWORD(lParam);
 79 
 80         apt[0].x = cxClient / 4;
 81         apt[0].y = cyClient / 2;
 82         
 83         apt[1].x = cxClient / 2;
 84         apt[1].y = cyClient / 4;
 85 
 86         apt[2].x = cxClient / 2;
 87         apt[2].y = 3 * cyClient / 4;
 88 
 89         apt[3].x = 3 * cxClient / 4;
 90         apt[3].y = cyClient / 2;
 91 
 92         return 0;
 93 
 94     case WM_LBUTTONDOWN:
 95     case WM_RBUTTONDOWN:
 96     case WM_MOUSEMOVE:
 97         if (wParam & MK_LBUTTON || wParam & MK_RBUTTON)
 98         {
 99             hdc = GetDC(hwnd);
100             SelectObject(hdc, GetStockObject(WHITE_PEN));
101 
102             DrawBezier(hdc, apt);
103 
104             if (wParam & MK_LBUTTON)
105             {
106                 apt[1].x = LOWORD(lParam);
107                 apt[1].y = HIWORD(lParam);
108             }
109 
110             if (wParam & MK_RBUTTON)
111             {
112                 apt[2].x = LOWORD(lParam);
113                 apt[2].y = HIWORD(lParam);
114             }
115 
116             SelectObject(hdc, GetStockObject(BLACK_PEN));
117 
118             DrawBezier(hdc, apt);
119 
120             ReleaseDC(hwnd, hdc);
121         }
122         return 0;
123 
124     case WM_PAINT:
125         InvalidateRect(hwnd, NULL, TRUE);
126         hdc = BeginPaint(hwnd, &ps);
127 
128         DrawBezier(hdc, apt);
129 
130         EndPaint(hwnd, &ps);
131         return 0;
132 
133     case WM_DESTROY:
134         PostQuitMessage(0);
135         return 0;
136     }
137 
138     return DefWindowProc(hwnd, message, wParam, lParam);
139 }

1. 安装 Flutter SDK

如果不能直接下载 Flutter SDK, 可以通过github安装, 请参考 Using Flutter in China.

下载 Flutter SDK (flutter_windows_v0.2.8-beta.zip), 解压到指定目录, 双击运行flutter_console.bat, 完成sdk安装, 如图.

图片 3

图片 4

用户名 ALL=(ALL) ALL

BEZIER.C

2. 设置环境变量

在Path下增加到flutter/bin的目录, 如图:

图片 5

然后给文件增加权限chmod 400即可

BEZIER程序的显示结果

3. Flutter doctor

在flutter控制台运行 flutter doctor 命令, 检测是否有依赖项未安装.

图片 6

其中带X的表示需要安装的东西, 如我这里需要再安装Android toolchain 与 Android Studio.

安装Android Studio时,会默认下载安装Android SDK,所以下一步直接安装Android Studio.

TAG标签:
版权声明:本文由澳门金莎娱乐网站发布于澳门金莎娱乐网站,转载请注明出处:绘图基础,Linux中如何配置sudo用户