原创 weightSum 和 layout_weight 以及 爲什麼有時要設置0dp

線性佈局(水平爲例)的weightSum  定義子控件weight的最大值, 如果未指定,則等於 所有子視圖的 layout_weight累加和。 子視圖的layout_weight  佔用父視圖的空間比重。 一個線性佈局的子視圖真正寬

原创 SDL_Texture與SDL_Renderer示例

#include <stdio.h> #include <stdlib.h> #include <SDL2/SDL.h> SDL_Window * window; SDL_Renderer * renderer; SDL_Texture

原创 SDL按鍵檢測

檢測ESC鍵的按下擡起,擡起後退出窗口。 #include <stdio.h> #include <stdlib.h> #include <SDL.h> int SDL_main(int argc, char * argv[]) {

原创 SDL窗口的創建、顯示和銷燬

<pre name="code" class="cpp">#include <stdio.h> #include <stdlib.h> #include <SDL.h> int SDL_main(int argc, char * arg

原创 Network code notes

UDP報文接收BUF長度小於實際報文長度,剩餘的會被丟棄。 發送廣播時需要設置:     int option = 1;     setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &option, siz

原创 minix文件系統格式分析

參考 https://www.zybuluo.com/harpsword/note/207478https://blog.csdn.net/hejinjing_tom_com/article/details/52319189http://

原创 編譯Android 8.1 並刷入Nexus 6P

-----------------AOSP Android源碼---------------- 源碼下載: https://lug.ustc.edu.cn/wiki/mirrors/help/aosp cd ~/bin #curl h

原创 Unity中用觸摸控制物體旋轉和放大

using UnityEngine; using System.Collections; using System.IO; public class ScaleAndRotate : MonoBehaviour { private T

原创 ARM同步原語 摘要

http://infocenter.arm.com/help/topic/com.arm.doc.dht0008a/DHT0008A_arm_synchronization_primitives.pdf   一、軟件同步 當訪問共享資源必

原创 ffmpeg編譯成一個Android libffmpeg.so庫

update 2018:  生成工具鏈 # NDK version = 14 # cd $NDK_DIR INSTALL_DIR=/home/konga/bin ARM_TOOLCHAIN="arm-linux-androideab

原创 SDL子系統初始化檢測及中途去初始化

#include <stdio.h> #include <stdlib.h> #include <SDL.h> int main(int argc, char * argv[]) { Uint32 ret; if(SDL_Ini

原创 SDL Event Handling 事件處理

http://wiki.libsdl.org/CategoryEvents 事件處理允許應用程序接收用戶輸入。事件處理是在調用  SDL_Init(SDL_INIT_VIDEO); 時隨着視頻子系統一起被初始化。 在內部,SDL把所有事件

原创 Shell筆記

打印命令   echo echo -e "\e[1;31m" 設置打印爲紅色 echo -e "\e[0m" 恢復默認顏色   printf  "%d,%d\n"  200 300  查找進程  pgrep  字符串替換 tr cat

原创 使用SDL_Surface顯示BMP位圖

#include <stdio.h> #include <stdlib.h> #include <SDL.h> int SDL_main(int argc, char * argv[]) { SDL_Window *window =

原创 讀文件時收到信號,read函數部分成功

#include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <errno