├── .gitignore ├── .gitmodules ├── .travis.yml ├── .yotta_ignore ├── CMakeLists.txt ├── CODE_OF_CONDUCT.md ├── FindSDL2.cmake ├── LICENSE.txt ├── Makefile ├── README.md ├── example ├── include │ ├── circle_window.h │ ├── layer_window.h │ ├── line_window.h │ ├── menu_window.h │ └── text_window.h └── source │ ├── circle_window.c │ ├── layer_window.c │ ├── line_window.c │ ├── main.c │ ├── menu_window.c │ └── text_window.c ├── info.sh ├── module.json ├── resources ├── Thumbs.db └── fonts │ ├── RobotoMono-Regular.ttf │ ├── bmfont2c.cfg │ ├── bmfont2c.py │ ├── robotomono_regular_16.c │ └── robotomono_regular_18.c ├── scripts ├── build-font.py ├── build-iconic.py ├── font-template.c ├── font-template.h ├── icon-template.c └── icon-template.h ├── source ├── bmp.c ├── buffer.c ├── font.c ├── fonts │ ├── robotomono_regular_16.c │ ├── robotomono_regular_18.c │ ├── robotomono_regular_24.c │ └── robotomono_regular_32.c ├── graphics.c ├── icons │ ├── icons_1x.c │ ├── icons_2x.c │ ├── icons_4x.c │ ├── icons_6x.c │ └── icons_8x.c ├── layer.c ├── sprite.c ├── ugui.c ├── ugui_sdl.c ├── widgets │ ├── menu_widget.c │ └── text_widget.c └── window.c ├── ugui.cmake └── ugui ├── bmp.h ├── buffer.h ├── config.h ├── font.h ├── fonts ├── font_manager.h ├── robotomono_regular_16.h ├── robotomono_regular_18.h ├── robotomono_regular_24.h └── robotomono_regular_32.h ├── graphics.h ├── icons ├── icons_1x.h ├── icons_2x.h ├── icons_4x.h ├── icons_6x.h └── icons_8x.h ├── layer.h ├── sprite.h ├── types.h ├── ugui.h ├── ugui_sdl.h ├── widgets ├── menu_widget.h └── text_widget.h └── window.h /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.DS_Store 3 | *.bmp 4 | ugui.o.dSYM 5 | build/ 6 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "resources/open-iconic"] 2 | path = resources/open-iconic 3 | url = https://github.com/iconic/open-iconic.git 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | addons: 3 | apt: 4 | packages: 5 | - cmake 6 | - make 7 | compiler: 8 | - clang 9 | script: 10 | - mkdir build 11 | - cd build && cmake -DNO_SDL2=1 .. && make 12 | notifications: 13 | email: false 14 | slack: 15 | secure: BBXFfx5jmBiqsmHK0Jl+rT0CE2Mwot9hj8z1UGQ2bwSExidzQ7Ll5UNZfnaintqMSF6z/uJAMtV2R34a/cXOtWhw4QWxhexkxoOjybJlY/7OHykkqwELYIm74neoTuRmoYOKxTA8D+8zpCVddbjz1yP9KiZ49CYWXD0CWsP+1lhlWTL7FlpZLaLVkTCJq85SyUT42jUDaR4AhKa9G/J6XkY0FdU6gDNWSDobei6gYAJABAlXLgioneVuqw2IPt+sCkqhfj+WK6vqXkIiUjhtt+YRXcYeeyIFAvHdBCP+qJJE91LhGjsTHSLoh3PpfGzSjvM8gwdOjXkNTuElNrerEQSgPO0FvqyIr+Buk++tEPPYliJ4ek/O/I0NOG/n2eZXMANNocQjhD6kMGUvJ+PSompCoP2KeA0yG5q49qEIsvbr1twn9AiSTemMQnp4yQGKtxqjlNrHxfDcqRq4d3k7b7JzHF/BKtO8JKy/HXSmFRaCpnVGOFFlBBjpcApj7YV/WamxzgbaOfRkB0OkK0e1f8PW2hc31Xow5SThnHPvjqyE/roXjj6xdFpOcBaSagLrDrV2fMy7ypw+eTfgvY0eKAqz2Ouixe9YW1Je+ISYZ2lMF0AcJRcP9ADMZJPyRDFKZXMMirIWz/C4dfy5bwb9QNdJgVvQ6vfAvNAQJzCHyHI= 16 | -------------------------------------------------------------------------------- /.yotta_ignore: -------------------------------------------------------------------------------- 1 | example 2 | example/ 3 | example/* 4 | example/CMakeLists.txt 5 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # CMake Build File 2 | 3 | cmake_minimum_required (VERSION 2.8.7) 4 | 5 | project (ugui-example) 6 | 7 | # Find SDL2 if required 8 | if(NOT DEFINED NO_SDL2) 9 | set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) 10 | find_package(SDL2 REQUIRED) 11 | add_definitions("-DUSE_SDL2=1") 12 | endif() 13 | 14 | include_directories(${SDL2_INCLUDE_DIR}) 15 | 16 | include(${CMAKE_CURRENT_SOURCE_DIR}/ugui.cmake) 17 | 18 | set(CMAKE_C_FLAGS "-std=gnu11 -g") 19 | 20 | set(APP_SOURCES 21 | example/source/main.c 22 | example/source/menu_window.c 23 | example/source/line_window.c 24 | example/source/circle_window.c 25 | example/source/layer_window.c 26 | example/source/text_window.c 27 | ) 28 | 29 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/example/include) 30 | 31 | add_executable (${CMAKE_PROJECT_NAME} ${APP_SOURCES}) 32 | target_link_libraries(${CMAKE_PROJECT_NAME} ugui ${SDL2_LIBRARY}) 33 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at ryan@kurte.nz. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /FindSDL2.cmake: -------------------------------------------------------------------------------- 1 | # Locate SDL2 library 2 | # This module defines 3 | # SDL2_LIBRARY, the name of the library to link against 4 | # SDL2_FOUND, if false, do not try to link to SDL2 5 | # SDL2_INCLUDE_DIR, where to find SDL.h 6 | # 7 | # This module responds to the the flag: 8 | # SDL2_BUILDING_LIBRARY 9 | # If this is defined, then no SDL2main will be linked in because 10 | # only applications need main(). 11 | # Otherwise, it is assumed you are building an application and this 12 | # module will attempt to locate and set the the proper link flags 13 | # as part of the returned SDL2_LIBRARY variable. 14 | # 15 | # Don't forget to include SDLmain.h and SDLmain.m your project for the 16 | # OS X framework based version. (Other versions link to -lSDL2main which 17 | # this module will try to find on your behalf.) Also for OS X, this 18 | # module will automatically add the -framework Cocoa on your behalf. 19 | # 20 | # 21 | # Additional Note: If you see an empty SDL2_LIBRARY_TEMP in your configuration 22 | # and no SDL2_LIBRARY, it means CMake did not find your SDL2 library 23 | # (SDL2.dll, libsdl2.so, SDL2.framework, etc). 24 | # Set SDL2_LIBRARY_TEMP to point to your SDL2 library, and configure again. 25 | # Similarly, if you see an empty SDL2MAIN_LIBRARY, you should set this value 26 | # as appropriate. These values are used to generate the final SDL2_LIBRARY 27 | # variable, but when these values are unset, SDL2_LIBRARY does not get created. 28 | # 29 | # 30 | # $SDL2DIR is an environment variable that would 31 | # correspond to the ./configure --prefix=$SDL2DIR 32 | # used in building SDL2. 33 | # l.e.galup 9-20-02 34 | # 35 | # Modified by Eric Wing. 36 | # Added code to assist with automated building by using environmental variables 37 | # and providing a more controlled/consistent search behavior. 38 | # Added new modifications to recognize OS X frameworks and 39 | # additional Unix paths (FreeBSD, etc). 40 | # Also corrected the header search path to follow "proper" SDL guidelines. 41 | # Added a search for SDL2main which is needed by some platforms. 42 | # Added a search for threads which is needed by some platforms. 43 | # Added needed compile switches for MinGW. 44 | # 45 | # On OSX, this will prefer the Framework version (if found) over others. 46 | # People will have to manually change the cache values of 47 | # SDL2_LIBRARY to override this selection or set the CMake environment 48 | # CMAKE_INCLUDE_PATH to modify the search paths. 49 | # 50 | # Note that the header path has changed from SDL2/SDL.h to just SDL.h 51 | # This needed to change because "proper" SDL convention 52 | # is #include "SDL.h", not . This is done for portability 53 | # reasons because not all systems place things in SDL2/ (see FreeBSD). 54 | 55 | #============================================================================= 56 | # Copyright 2003-2009 Kitware, Inc. 57 | # 58 | # Distributed under the OSI-approved BSD License (the "License"); 59 | # see accompanying file Copyright.txt for details. 60 | # 61 | # This software is distributed WITHOUT ANY WARRANTY; without even the 62 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 63 | # See the License for more information. 64 | #============================================================================= 65 | # (To distribute this file outside of CMake, substitute the full 66 | # License text for the above reference.) 67 | 68 | SET(SDL2_SEARCH_PATHS 69 | ~/Library/Frameworks 70 | /Library/Frameworks 71 | /usr/local 72 | /usr 73 | /sw # Fink 74 | /opt/local # DarwinPorts 75 | /opt/csw # Blastwave 76 | /opt 77 | ) 78 | 79 | FIND_PATH(SDL2_INCLUDE_DIR SDL.h 80 | HINTS 81 | $ENV{SDL2DIR} 82 | PATH_SUFFIXES include/SDL2 include 83 | PATHS ${SDL2_SEARCH_PATHS} 84 | ) 85 | 86 | FIND_LIBRARY(SDL2_LIBRARY_TEMP 87 | NAMES SDL2 88 | HINTS 89 | $ENV{SDL2DIR} 90 | PATH_SUFFIXES lib64 lib 91 | PATHS ${SDL2_SEARCH_PATHS} 92 | ) 93 | 94 | IF(NOT SDL2_BUILDING_LIBRARY) 95 | IF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework") 96 | # Non-OS X framework versions expect you to also dynamically link to 97 | # SDL2main. This is mainly for Windows and OS X. Other (Unix) platforms 98 | # seem to provide SDL2main for compatibility even though they don't 99 | # necessarily need it. 100 | FIND_LIBRARY(SDL2MAIN_LIBRARY 101 | NAMES SDL2main 102 | HINTS 103 | $ENV{SDL2DIR} 104 | PATH_SUFFIXES lib64 lib 105 | PATHS ${SDL2_SEARCH_PATHS} 106 | ) 107 | ENDIF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework") 108 | ENDIF(NOT SDL2_BUILDING_LIBRARY) 109 | 110 | # SDL2 may require threads on your system. 111 | # The Apple build may not need an explicit flag because one of the 112 | # frameworks may already provide it. 113 | # But for non-OSX systems, I will use the CMake Threads package. 114 | IF(NOT APPLE) 115 | FIND_PACKAGE(Threads) 116 | ENDIF(NOT APPLE) 117 | 118 | # MinGW needs an additional library, mwindows 119 | # It's total link flags should look like -lmingw32 -lSDL2main -lSDL2 -lmwindows 120 | # (Actually on second look, I think it only needs one of the m* libraries.) 121 | IF(MINGW) 122 | SET(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW") 123 | ENDIF(MINGW) 124 | 125 | IF(SDL2_LIBRARY_TEMP) 126 | # For SDL2main 127 | IF(NOT SDL2_BUILDING_LIBRARY) 128 | IF(SDL2MAIN_LIBRARY) 129 | SET(SDL2_LIBRARY_TEMP ${SDL2MAIN_LIBRARY} ${SDL2_LIBRARY_TEMP}) 130 | ENDIF(SDL2MAIN_LIBRARY) 131 | ENDIF(NOT SDL2_BUILDING_LIBRARY) 132 | 133 | # For OS X, SDL2 uses Cocoa as a backend so it must link to Cocoa. 134 | # CMake doesn't display the -framework Cocoa string in the UI even 135 | # though it actually is there if I modify a pre-used variable. 136 | # I think it has something to do with the CACHE STRING. 137 | # So I use a temporary variable until the end so I can set the 138 | # "real" variable in one-shot. 139 | IF(APPLE) 140 | SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework Cocoa") 141 | ENDIF(APPLE) 142 | 143 | # For threads, as mentioned Apple doesn't need this. 144 | # In fact, there seems to be a problem if I used the Threads package 145 | # and try using this line, so I'm just skipping it entirely for OS X. 146 | IF(NOT APPLE) 147 | SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT}) 148 | ENDIF(NOT APPLE) 149 | 150 | # For MinGW library 151 | IF(MINGW) 152 | SET(SDL2_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARY_TEMP}) 153 | ENDIF(MINGW) 154 | 155 | # Set the final string here so the GUI reflects the final state. 156 | SET(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL2 Library can be found") 157 | # Set the temp variable to INTERNAL so it is not seen in the CMake GUI 158 | SET(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "") 159 | ENDIF(SDL2_LIBRARY_TEMP) 160 | 161 | INCLUDE(FindPackageHandleStandardArgs) 162 | 163 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR) -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) [year] [fullname] 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Micro-gui makefile 2 | # Demonstrates building the library 3 | # and the font/icon pipeline 4 | 5 | lib: 6 | mkdir -p build; cd build; cmake .. && make; cd .. 7 | 8 | all: icons fonts lib 9 | 10 | icons: icons_1x icons_2x icons_4x icons_6x icons_8x 11 | 12 | fonts: roboto_16 roboto_18 roboto_24 roboto_32 13 | 14 | clean: 15 | rm -rf build/* 16 | 17 | icons_1x: ./ugui/icons/icons_1x.h ./source/icons/icons_1x.c 18 | python3 ./scripts/build-iconic.py --scale=1 --folder=./resources/open-iconic/png --template=./scripts/icon-template.h --output=./ugui/icons/icons_1x.h 19 | python3 ./scripts/build-iconic.py --scale=1 --folder=./resources/open-iconic/png --template=./scripts/icon-template.c --output=./source/icons/icons_1x.c 20 | 21 | icons_2x: 22 | python3 ./scripts/build-iconic.py --scale=2 --folder=./resources/open-iconic/png --template=./scripts/icon-template.h --output=./ugui/icons/icons_2x.h 23 | python3 ./scripts/build-iconic.py --scale=2 --folder=./resources/open-iconic/png --template=./scripts/icon-template.c --output=./source/icons/icons_2x.c 24 | 25 | icons_4x: 26 | python3 ./scripts/build-iconic.py --scale=4 --folder=./resources/open-iconic/png --template=./scripts/icon-template.h --output=./ugui/icons/icons_4x.h 27 | python3 ./scripts/build-iconic.py --scale=4 --folder=./resources/open-iconic/png --template=./scripts/icon-template.c --output=./source/icons/icons_4x.c 28 | 29 | icons_6x: 30 | python3 ./scripts/build-iconic.py --scale=6 --folder=./resources/open-iconic/png --template=./scripts/icon-template.h --output=./ugui/icons/icons_6x.h 31 | python3 ./scripts/build-iconic.py --scale=6 --folder=./resources/open-iconic/png --template=./scripts/icon-template.c --output=./source/icons/icons_6x.c 32 | 33 | icons_8x: 34 | python3 ./scripts/build-iconic.py --scale=8 --folder=./resources/open-iconic/png --template=./scripts/icon-template.h --output=./ugui/icons/icons_8x.h 35 | python3 ./scripts/build-iconic.py --scale=8 --folder=./resources/open-iconic/png --template=./scripts/icon-template.c --output=./source/icons/icons_8x.c 36 | 37 | roboto_16: 38 | python3 ./scripts/build-font.py --size=16 --font=./resources/fonts/RobotoMono-Regular.ttf --template=./scripts/font-template.c --output=./source/fonts/robotomono_regular_16.c 39 | python3 ./scripts/build-font.py --size=16 --font=./resources/fonts/RobotoMono-Regular.ttf --template=./scripts/font-template.h --output=./ugui/fonts/robotomono_regular_16.h 40 | 41 | roboto_18: 42 | python3 ./scripts/build-font.py --size=18 --font=./resources/fonts/RobotoMono-Regular.ttf --template=./scripts/font-template.c --output=./source/fonts/robotomono_regular_18.c 43 | python3 ./scripts/build-font.py --size=18 --font=./resources/fonts/RobotoMono-Regular.ttf --template=./scripts/font-template.h --output=./ugui/fonts/robotomono_regular_18.h 44 | 45 | roboto_24: 46 | python3 ./scripts/build-font.py --size=24 --font=./resources/fonts/RobotoMono-Regular.ttf --template=./scripts/font-template.c --output=./source/fonts/robotomono_regular_24.c 47 | python3 ./scripts/build-font.py --size=24 --font=./resources/fonts/RobotoMono-Regular.ttf --template=./scripts/font-template.h --output=./ugui/fonts/robotomono_regular_24.h 48 | 49 | roboto_32: 50 | python3 ./scripts/build-font.py --size=32 --font=./resources/fonts/RobotoMono-Regular.ttf --template=./scripts/font-template.c --output=./source/fonts/robotomono_regular_32.c 51 | python3 ./scripts/build-font.py --size=32 --font=./resources/fonts/RobotoMono-Regular.ttf --template=./scripts/font-template.h --output=./ugui/fonts/robotomono_regular_32.h -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Micro-GUI (ugui) 2 | 3 | Micro-GUI (ugui) is a minimal GUI framework for embedded systems, because there seems to be a lack of open source embedded gui tools, and we should share more. 4 | 5 | Heavily inspired by the [Pebble](https://getpebble.com) User Interface API (which is seriously great, and you can check out [here](https://developer.getpebble.com/docs/c/User_Interface/)). 6 | 7 | It provides a simple window stack, layers for composition of windows, graphics functions for rendering primitives and text, and widgets to simplify commonly used functions. 8 | 9 | If you have any issues or feature requests, feel free to open an issue or a pull request. And, if you find yourself using this in a project, I would love to know about it! 10 | 11 | ## Alternatives 12 | - [u8glib](https://github.com/olikraus/u8glib) A graphics library with support for many different displays. 13 | - [m2tklib](https://github.com/olikraus/m2tklib) Mini Interative Interface Toolkit Library. A portable graphical and character user interface (GUI+CUI) library for embedded systems 14 | - [UGUI](https://github.com/achimdoebler/UGUI) A free and open source graphic library for embedded systems 15 | - [ttf2ugui](https://github.com/AriZuu/ttf2ugui) A free and open source ttf to font array converter for UGUI above 16 | 17 | ## Build Status 18 | [![Build Status](https://travis-ci.org/ryankurte/micro-gui.svg)](https://travis-ci.org/ryankurte/micro-gui) 19 | 20 | ## Goals 21 | - Simple to embed 22 | - No (or minor) external dependencies 23 | - Permissive licensing (MIT) 24 | - C compliant, doesn't force the use of c++ 25 | - Simple to use 26 | - Minimal API 27 | - Widgets for common functions 28 | - Examples for all components 29 | - API documentation? 30 | - Simple to develop 31 | - Object Oriented C 32 | - Clearly defined modules 33 | - Simple to test 34 | - Compiles for any platform (bmp export requires file.h) 35 | 36 | ## Status 37 | 38 | - Window stack / top level interface working 39 | - Layers mostly working 40 | - Graphics module 41 | - layer offsets implemented, need to implement bounds 42 | - text rendering implemented 43 | - Asset pipeline 44 | - OpenIconic - generation complete, needs functions to convert to sprites 45 | - Fonts - complete, converts .ttf fonts to directly compatible c source/header files 46 | - Widgets 47 | - working on menu 48 | - todo: progress bar, alert/message box, buttons 49 | - Testing, needs to be implemented (w/ CI) 50 | - Example, work in progress using SDL2 51 | 52 | ## Getting Started 53 | 54 | - Checkout project with `git clone git@github.com:ryankurte/micro-gui.git` 55 | - Create build directory with `mkdir build` 56 | - Change to build directory with `cd build` 57 | - Initialize cmake with `cmake ..` 58 | - Build with `make` 59 | - Run with `./ugui` 60 | 61 | ## Examples 62 | 63 | For an example application see the `example/` folder. This application will update a bmp file each rendering call, and can be interacted with using the command line. 64 | 65 | ## Credits 66 | 67 | - [Pebble](https://getpebble.com) for inspiration 68 | - Line and Ellipse functions adapted from [here](https://www.opengl.org/discussion_boards/showthread.php/168761-Drawing-Line-Bresenhem-midpoint-algorithm) 69 | - Fonts from [here](https://github.com/dhepper/font8x8) 70 | 71 | ## License 72 | 73 | This project is experimentally licensed under the terms of the MIT license, because LGPL even with a static linker exception requires you to provide tools to relink your application against the library, which in my opinion is too greater barrier to usage/adoption. 74 | 75 | As such, if you make improvements to this library, it would be awesome if you would contribute them back. If that doesn't work, well, we will have to switch to something like the LGPL. 76 | 77 | See LICENSE.TXT for more information 78 | 79 | -------------------------------------------------------------------------------- /example/include/circle_window.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef CIRCLE_WINDOW_H 3 | #define CIRCLE_WINDOW_H 4 | 5 | #include "ugui/ugui.h" 6 | #include 7 | 8 | ugui_window_t* circle_window_create(uint32_t w, uint32_t h); 9 | void circle_window_destroy(); 10 | 11 | #endif -------------------------------------------------------------------------------- /example/include/layer_window.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef LAYER_WINDOW_H 3 | #define LAYER_WINDOW_H 4 | 5 | #include "ugui/ugui.h" 6 | #include 7 | 8 | ugui_window_t *layer_window_create(uint32_t w, uint32_t h); 9 | void layer_window_destroy(); 10 | 11 | #endif -------------------------------------------------------------------------------- /example/include/line_window.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef LINE_WINDOW_H 3 | #define LINE_WINDOW_H 4 | 5 | #include "ugui/ugui.h" 6 | #include 7 | 8 | ugui_window_t* line_window_create(uint32_t w, uint32_t h); 9 | void line_window_destroy(); 10 | 11 | #endif -------------------------------------------------------------------------------- /example/include/menu_window.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef MENU_WINDOW_H 3 | #define MENU_WINDOW_H 4 | 5 | #include "ugui/ugui.h" 6 | #include 7 | 8 | ugui_window_t* menu_window_create(uint32_t w, uint32_t h); 9 | void menu_window_destroy(); 10 | 11 | #endif -------------------------------------------------------------------------------- /example/include/text_window.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef TEXT_WINDOW_H 3 | #define TEXT_WINDOW_H 4 | 5 | #include "ugui/ugui.h" 6 | #include 7 | 8 | ugui_window_t* text_window_create(uint32_t w, uint32_t h); 9 | void text_window_destroy(); 10 | 11 | #endif -------------------------------------------------------------------------------- /example/source/circle_window.c: -------------------------------------------------------------------------------- 1 | 2 | #include "circle_window.h" 3 | 4 | #include "ugui/ugui.h" 5 | 6 | ugui_window_t *circle_window; 7 | ugui_layer_t* circle_layer; 8 | 9 | 10 | /*** Internal Functions ***/ 11 | 12 | static void circle_layer_update(ugui_layer_t* layer, void* graphics_ctx, void* layer_ctx) 13 | { 14 | ugui_rect_t* bounds = ugui_layer_get_bounds(layer); 15 | 16 | int w = bounds->w; 17 | int h = bounds->h; 18 | 19 | //Full size ellipse 20 | ugui_graphics_draw_ellipse(graphics_ctx, (ugui_rect_t) { 21 | .x = 0, .y = 0, .w = w - 1, .h = h - 1 22 | }); 23 | 24 | //Circle 25 | int center_x = w / 2; 26 | int center_y = h / 2; 27 | int size = (h > w) ? w / 2 : h / 2; 28 | ugui_graphics_draw_ellipse(graphics_ctx, (ugui_rect_t) { 29 | .x = center_x - size / 2, .y = center_y - size / 2, .w = size, .h = size 30 | }); 31 | 32 | ugui_layer_set_dirty(layer); 33 | } 34 | 35 | /*** External Functions ***/ 36 | 37 | ugui_window_t *circle_window_create(uint32_t w, uint32_t h) 38 | { 39 | circle_window = ugui_window_create(w, h); 40 | 41 | circle_layer = ugui_layer_create((ugui_rect_t) {.x = 0, .y = 0, .w = w, .h = h}); 42 | 43 | ugui_layer_t* base_layer = ugui_window_get_base_layer(circle_window); 44 | 45 | ugui_layer_set_update(circle_layer, circle_layer_update); 46 | 47 | ugui_layer_add_child(base_layer, circle_layer); 48 | 49 | return circle_window; 50 | } 51 | 52 | void circle_window_destroy() 53 | { 54 | ugui_layer_destroy(circle_layer); 55 | 56 | ugui_window_destroy(circle_window); 57 | } 58 | 59 | 60 | -------------------------------------------------------------------------------- /example/source/layer_window.c: -------------------------------------------------------------------------------- 1 | 2 | #include "layer_window.h" 3 | 4 | #include "ugui/ugui.h" 5 | 6 | ugui_window_t *layer_example_window; 7 | ugui_layer_t* quadrant_layers[4]; 8 | 9 | 10 | /*** Internal Functions ***/ 11 | 12 | static void quadrant_layer_update(ugui_layer_t* layer, void* graphics_ctx, void* layer_ctx) 13 | { 14 | ugui_rect_t* bounds = ugui_layer_get_bounds(layer); 15 | 16 | int w = bounds->w; 17 | int h = bounds->h; 18 | 19 | ugui_graphics_draw_text(graphics_ctx, 20 | (char*)layer_ctx, 21 | &font_robotomono_regular_18, 22 | (ugui_point_t) { 23 | .x = 0, .y = 0 24 | }); 25 | 26 | ugui_graphics_draw_line(graphics_ctx, (ugui_point_t) { 27 | .x = 0, .y = 0 28 | }, (ugui_point_t) { 29 | .x = w, .y = h 30 | }); 31 | 32 | ugui_graphics_draw_line(graphics_ctx, (ugui_point_t) { 33 | .x = 0, .y = h 34 | }, (ugui_point_t) { 35 | .x = w, .y = 0 36 | }); 37 | 38 | ugui_layer_set_dirty(layer); 39 | } 40 | 41 | char *layer_names[4] = { 42 | "top left", 43 | "top right", 44 | "bottom left", 45 | "bottom right" 46 | }; 47 | 48 | static void main_layer_update(ugui_layer_t* layer, void* graphics_ctx, void* layer_ctx) 49 | { 50 | ugui_rect_t* bounds = ugui_layer_get_bounds(layer); 51 | 52 | int w = bounds->w; 53 | int h = bounds->h; 54 | 55 | ugui_size_t text_size; 56 | ugui_font_get_text_size(&font_robotomono_regular_32, 57 | "Layer Demo", 58 | &text_size); 59 | 60 | ugui_graphics_draw_text(graphics_ctx, 61 | "Layer Demo", 62 | &font_robotomono_regular_32, 63 | (ugui_point_t) { 64 | .x = w / 2 - text_size.w / 2, .y = h / 4 65 | }); 66 | 67 | ugui_graphics_draw_line(graphics_ctx, (ugui_point_t) { 68 | .x = w / 2, .y = 0 69 | }, (ugui_point_t) { 70 | .x = w / 2, .y = h - 1 71 | }); 72 | 73 | ugui_graphics_draw_line(graphics_ctx, (ugui_point_t) { 74 | .x = 0, .y = h / 2 75 | }, (ugui_point_t) { 76 | .x = w - 1, .y = h / 2 77 | }); 78 | 79 | #if 0 80 | //Inverse a bit, this is decidedly not working 81 | ugui_graphics_inverse_rect(graphics_ctx, (ugui_point_t) { 82 | .x = 0, .y = 0 83 | }, (ugui_size_t) { 84 | .w = w - 1, .h = h - 1 85 | }); 86 | #endif 87 | 88 | ugui_layer_set_dirty(layer); 89 | } 90 | 91 | /*** External Functions ***/ 92 | 93 | ugui_window_t* layer_window_create(uint32_t w, uint32_t h) 94 | { 95 | layer_example_window = ugui_window_create(w, h); 96 | 97 | ugui_layer_t* base_layer = ugui_window_get_base_layer(layer_example_window); 98 | 99 | ugui_layer_set_update(base_layer, main_layer_update); 100 | 101 | for (int i = 0; i < 2; i++) { 102 | for (int j = 0; j < 2; j++) { 103 | quadrant_layers[i * 2 + j] = ugui_layer_create((ugui_rect_t) { 104 | .x = w / 2 * j, 105 | .y = h / 2 * i, 106 | .w = w / 2, 107 | .h = h / 2 108 | }); 109 | 110 | ugui_layer_set_update(quadrant_layers[i * 2 + j], quadrant_layer_update); 111 | 112 | ugui_layer_set_ctx(quadrant_layers[i * 2 + j], (void*)layer_names[i * 2 + j]); 113 | 114 | ugui_layer_add_child(base_layer, quadrant_layers[i * 2 + j]); 115 | 116 | } 117 | } 118 | 119 | return layer_example_window; 120 | } 121 | 122 | void layer_window_destroy() 123 | { 124 | for (int i = 0; i < 2; i++) { 125 | for (int j = 0; j < 2; j++) { 126 | ugui_layer_destroy(quadrant_layers[i * 2 + j]); 127 | } 128 | } 129 | 130 | ugui_window_destroy(layer_example_window); 131 | } 132 | 133 | 134 | -------------------------------------------------------------------------------- /example/source/line_window.c: -------------------------------------------------------------------------------- 1 | 2 | #include "line_window.h" 3 | 4 | #include "ugui/ugui.h" 5 | #include "ugui/font.h" 6 | 7 | ugui_window_t *line_window; 8 | ugui_layer_t* line_layer; 9 | 10 | 11 | /*** Internal Functions ***/ 12 | 13 | static void line_layer_update(ugui_layer_t* layer, void* graphics_ctx, void* layer_ctx) 14 | { 15 | ugui_rect_t* bounds = ugui_layer_get_bounds(layer); 16 | 17 | int w = bounds->w; 18 | int h = bounds->h; 19 | 20 | //Horizontal 21 | ugui_graphics_draw_line(graphics_ctx, (ugui_point_t) { 22 | .x = 0, .y = h / 2 23 | }, (ugui_point_t) { 24 | .x = w - 1, .y = h / 2 25 | }); 26 | 27 | //Vertical 28 | ugui_graphics_draw_line(graphics_ctx, (ugui_point_t) { 29 | .x = w / 2, .y = 0 30 | }, (ugui_point_t) { 31 | .x = w / 2, .y = h - 1 32 | }); 33 | 34 | //Diagonal gentle down 35 | ugui_graphics_draw_line(graphics_ctx, (ugui_point_t) { 36 | .x = 0, .y = 0 37 | }, (ugui_point_t) { 38 | .x = w - 1, .y = h / 2 39 | }); 40 | 41 | //Diagonal gentle up 42 | ugui_graphics_draw_line(graphics_ctx, (ugui_point_t) { 43 | .x = 0, .y = h - 1 44 | }, (ugui_point_t) { 45 | .x = w - 1, .y = h / 2 46 | }); 47 | 48 | //Diagonal sharp down 49 | ugui_graphics_draw_line(graphics_ctx, (ugui_point_t) { 50 | .x = 0, .y = 0 51 | }, (ugui_point_t) { 52 | .x = w / 2, .y = h - 1 53 | }); 54 | 55 | //Diagonal sharp up 56 | ugui_graphics_draw_line(graphics_ctx, (ugui_point_t) { 57 | .x = w / 2, .y = h - 1 58 | }, (ugui_point_t) { 59 | .x = w - 1, .y = 0 60 | }); 61 | 62 | ugui_graphics_draw_text(graphics_ctx, 63 | "test", 64 | &font_robotomono_regular_18, 65 | (ugui_point_t) { 66 | .x = w / 2, .y = h / 2 67 | }); 68 | 69 | ugui_layer_set_dirty(layer); 70 | } 71 | 72 | /*** External Functions ***/ 73 | 74 | ugui_window_t *line_window_create(uint32_t w, uint32_t h) 75 | { 76 | line_window = ugui_window_create(w, h); 77 | 78 | line_layer = ugui_layer_create((ugui_rect_t) {.x = 0, .y = 0, .w = w, .h = h}); 79 | 80 | ugui_layer_t* base_layer = ugui_window_get_base_layer(line_window); 81 | 82 | ugui_layer_set_update(line_layer, line_layer_update); 83 | 84 | ugui_layer_add_child(base_layer, line_layer); 85 | 86 | return line_window; 87 | } 88 | 89 | void line_window_destroy() 90 | { 91 | ugui_layer_destroy(line_layer); 92 | 93 | ugui_window_destroy(line_window); 94 | } 95 | 96 | 97 | -------------------------------------------------------------------------------- /example/source/main.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | 6 | #include "ugui/ugui.h" 7 | 8 | #include "ugui/ugui_sdl.h" 9 | #include "ugui/bmp.h" 10 | 11 | #include "menu_window.h" 12 | 13 | #define GUI_WIDTH 640 14 | #define GUI_HEIGHT 480 15 | 16 | ugui_t* gui; 17 | ugui_window_t* menu_test_window; 18 | int running; 19 | 20 | int get_input_event() 21 | { 22 | int event = UGUI_EVT_NONE; 23 | int input = getchar(); 24 | switch (input) { 25 | case 'a': 26 | event = UGUI_EVT_LEFT; 27 | break; 28 | case 'd': 29 | event = UGUI_EVT_RIGHT; 30 | break; 31 | case 'w': 32 | event = UGUI_EVT_UP; 33 | break; 34 | case 's': 35 | event = UGUI_EVT_DOWN; 36 | break; 37 | case 'e': 38 | event = UGUI_EVT_SELECT; 39 | break; 40 | case 'q': 41 | event = UGUI_EVT_BACK; 42 | break; 43 | } 44 | 45 | return event; 46 | } 47 | 48 | int main(int argc, char *argv[]) 49 | { 50 | 51 | #ifdef USE_SDL2 52 | printf("\r\n------------------------------------\r\n"); 53 | printf("micro-gui (ugui) example application\r\n"); 54 | printf("Output will appear in an SDL window and real time in ./test.bmp\r\n"); 55 | printf("Use arrow keys for directional navigation\r\n"); 56 | 57 | #else 58 | printf("\r\n------------------------------------\r\n"); 59 | printf("micro-gui (ugui) example application\r\n"); 60 | printf("Output will appear (while running) in ./test.bmp\r\n"); 61 | printf("You may need to refresh this image manually.\r\n"); 62 | printf("Alternately, compile without -DNO_SDL2 to enable SDL2 based rendering\r\n"); 63 | printf("Use wasd to for directional navigation, q for back, and e for select\r\n"); 64 | printf("Note that you will need to press enter following each command\r\n"); 65 | #endif 66 | 67 | #ifdef USE_SDL2 68 | ugui_sdl_t *sdl_ctx = ugui_sdl_init("micro-gui example", GUI_WIDTH, GUI_HEIGHT); 69 | #endif 70 | 71 | gui = ugui_create(GUI_WIDTH, GUI_HEIGHT); 72 | running = 1; 73 | 74 | menu_test_window = menu_window_create(GUI_WIDTH, GUI_HEIGHT); 75 | //ugui_window_set_event_handler(menu_test_window, handle_event, NULL); 76 | #if 0 77 | 78 | #endif 79 | ugui_window_stack_push(gui, menu_test_window); 80 | 81 | ugui_render(gui); 82 | 83 | while (running > 0) { 84 | 85 | //Process input events 86 | #ifdef USE_SDL2 87 | int event = ugui_sdl_get_event(sdl_ctx); 88 | #else 89 | int event = get_input_event(); 90 | #endif 91 | if (event == UGUI_EVT_EXIT) { 92 | break; 93 | } 94 | 95 | ugui_put_event(gui, event); 96 | 97 | ugui_render(gui); 98 | 99 | uint8_t *img = ugui_get_image(gui); 100 | 101 | bmp_create_bw("test.bmp", GUI_WIDTH, GUI_HEIGHT, img); 102 | 103 | #ifdef USE_SDL2 104 | ugui_sdl_render_bmp(sdl_ctx, "test.bmp"); 105 | #endif 106 | 107 | usleep(1000); 108 | } 109 | 110 | ugui_destroy(gui); 111 | 112 | #ifdef USE_SDL2 113 | ugui_sdl_close(sdl_ctx); 114 | #endif 115 | 116 | return 0; 117 | } 118 | 119 | -------------------------------------------------------------------------------- /example/source/menu_window.c: -------------------------------------------------------------------------------- 1 | 2 | #include "menu_window.h" 3 | 4 | #include 5 | #include 6 | 7 | #include "ugui/ugui.h" 8 | #include "ugui/font.h" 9 | 10 | #include "ugui/widgets/menu_widget.h" 11 | 12 | #include "line_window.h" 13 | #include "circle_window.h" 14 | #include "layer_window.h" 15 | #include "text_window.h" 16 | 17 | //Demo type for use in menu widget 18 | typedef struct demo_s { 19 | char* name; 20 | char* desc; 21 | ugui_window_t** window; 22 | } demo_t; 23 | 24 | //External (static) gui context 25 | //TODO: could make this prettier 26 | extern ugui_t* gui; 27 | 28 | //Parent (this) window and widget 29 | ugui_window_t *menu_window; 30 | ugui_menu_widget_t *menu_widget; 31 | 32 | //Child windows 33 | ugui_window_t* line_test_window; 34 | ugui_window_t* circle_test_window; 35 | ugui_window_t* layer_test_window; 36 | ugui_window_t* text_test_window; 37 | 38 | 39 | //Demo list (for use in menu widget) 40 | demo_t demos[] = { 41 | {"Layer Demo", "Demonstrates layered rendering contexts", &layer_test_window}, 42 | {"Ellipse Demo", "Demonstrates rendering of ellipses", &circle_test_window}, 43 | {"Line Demo", "Demonstrates rendering of lines", &line_test_window}, 44 | {"Text Demo", "Demonstrates rendering of text", &text_test_window} 45 | }; 46 | 47 | char* title = "Micro-GUI (ugui) Demo Application"; 48 | 49 | /*** Internal Functions ***/ 50 | 51 | //TODO: unused 52 | static uint32_t example_menu_get_num_sections(void *menu_layer, void* data) 53 | { 54 | return 0; 55 | } 56 | 57 | //Row count handler for menu widget 58 | //Lets the menu widget know how many rows of data are available 59 | static uint32_t example_menu_get_num_rows(void *menu_layer, void* data) 60 | { 61 | return sizeof(demos) / sizeof(demo_t); 62 | } 63 | 64 | static void example_menu_get_header(void* menu_layer, char* header) 65 | { 66 | strncpy(header, title, strlen(title) + 1); 67 | } 68 | 69 | //Data handler for demo menu 70 | //Provides data for display in the menu widget 71 | static void example_menu_get_data(void* menu_layer, uint16_t index, char* title, char* data) 72 | { 73 | //TODO: sort it out, shit is unsafe. 74 | strncpy(title, demos[index].name, strlen(demos[index].name) + 1); 75 | strncpy(data, demos[index].desc, strlen(demos[index].desc) + 1); 76 | } 77 | 78 | //Select handler for demo menu 79 | //Pushes the selected demo window onto the stack 80 | static void example_menu_select(void *menu_layer, uint16_t index, void *callback_context) 81 | { 82 | ugui_window_t* new_window = *(demos[index].window); 83 | ugui_window_stack_push(gui, new_window); 84 | } 85 | 86 | //Event handler for demo screens 87 | //This pops the demo window off the stack to return to this menu 88 | static void demo_handle_event(ugui_window_t* window, int event, void* ctx) 89 | { 90 | if ((event == UGUI_EVT_BACK) || event == UGUI_EVT_LEFT) { 91 | ugui_window_stack_pop(gui); 92 | } 93 | } 94 | 95 | /*** External Functions ***/ 96 | 97 | ugui_window_t *menu_window_create(uint32_t w, uint32_t h) 98 | { 99 | menu_window = ugui_window_create(w, h); 100 | 101 | 102 | //Setup widget 103 | menu_widget = ugui_menu_widget_create((ugui_rect_t) { 104 | .w = w, 105 | .h = h 106 | }); 107 | 108 | ugui_menu_widget_data_callbacks_t example_callbacks; 109 | example_callbacks.get_num_sections = example_menu_get_num_sections; 110 | example_callbacks.get_num_rows = example_menu_get_num_rows; 111 | example_callbacks.get_header = example_menu_get_header; 112 | example_callbacks.get_data = example_menu_get_data; 113 | example_callbacks.select = example_menu_select; 114 | 115 | ugui_menu_widget_set_callbacks(menu_widget, &example_callbacks); 116 | 117 | 118 | //Bind widget to layer and window context 119 | ugui_layer_t* base_layer = ugui_window_get_base_layer(menu_window); 120 | 121 | ugui_layer_t* widget_layer = ugui_menu_widget_get_layer(menu_widget); 122 | 123 | ugui_layer_add_child(base_layer, widget_layer); 124 | 125 | ugui_menu_widget_attach_to_window(menu_widget, menu_window); 126 | 127 | 128 | //Create child layers 129 | line_test_window = line_window_create(w, h); 130 | ugui_window_set_event_handler(line_test_window, demo_handle_event, NULL); 131 | 132 | circle_test_window = circle_window_create(w, h); 133 | ugui_window_set_event_handler(circle_test_window, demo_handle_event, NULL); 134 | 135 | layer_test_window = layer_window_create(w, h); 136 | ugui_window_set_event_handler(layer_test_window, demo_handle_event, NULL); 137 | 138 | text_test_window = text_window_create(w, h); 139 | ugui_window_set_event_handler(text_test_window, demo_handle_event, NULL); 140 | 141 | return menu_window; 142 | } 143 | 144 | void menu_window_destroy() 145 | { 146 | line_window_destroy(); 147 | circle_window_destroy(); 148 | layer_window_destroy(); 149 | 150 | ugui_menu_widget_destroy(menu_widget); 151 | 152 | ugui_window_destroy(menu_window); 153 | } 154 | 155 | 156 | -------------------------------------------------------------------------------- /example/source/text_window.c: -------------------------------------------------------------------------------- 1 | 2 | #include "text_window.h" 3 | 4 | #include "ugui/ugui.h" 5 | #include "ugui/font.h" 6 | 7 | #include "ugui/widgets/text_widget.h" 8 | 9 | ugui_window_t *text_window; 10 | ugui_text_widget_t* text_widget; 11 | 12 | const char* sample_one = "This is a sample text area, with a long string that will be \ 13 | automatically wrapped to fit the defined area. This determines the longest sequence of \ 14 | words that can be displayed in the defined space and splits the text into lines to maximise \ 15 | the data that can be displayed.\n\nNewlines are also supported in the text widget using \ 16 | a single '\\n'"; 17 | 18 | /*** Internal Functions ***/ 19 | 20 | 21 | 22 | /*** External Functions ***/ 23 | 24 | ugui_window_t *text_window_create(uint32_t w, uint32_t h) 25 | { 26 | text_window = ugui_window_create(w, h); 27 | 28 | text_widget = ugui_text_widget_create((ugui_rect_t) {.x = w / 8, .y = h / 8, .w = w / 8 * 6, .h = h / 8 * 6}); 29 | 30 | ugui_text_widget_set_text(text_widget, &font_robotomono_regular_18, sample_one, 0); 31 | 32 | ugui_layer_t* base_layer = ugui_window_get_base_layer(text_window); 33 | 34 | ugui_layer_t* text_widget_layer = ugui_text_widget_get_layer(text_widget); 35 | 36 | ugui_layer_add_child(base_layer, text_widget_layer); 37 | 38 | return text_window; 39 | } 40 | 41 | void text_window_destroy() 42 | { 43 | ugui_text_widget_destroy(text_widget); 44 | 45 | ugui_window_destroy(text_window); 46 | } 47 | 48 | 49 | -------------------------------------------------------------------------------- /info.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "System information" 4 | echo `uname -a` 5 | 6 | echo "Package information" 7 | echo `ls /etc/` 8 | echo `ls /etc/apt/` 9 | 10 | echo "SDL information" 11 | echo `pkg-config --cflags sdl2` 12 | echo `apt-cache search sdl2` 13 | -------------------------------------------------------------------------------- /module.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "micro-gui", 3 | "version": "0.0.1", 4 | "description": "Minimal GUI library for embedded systems", 5 | "keywords": [ 6 | "GUI", 7 | "rendering" 8 | ], 9 | "author": "Ryan Kurte", 10 | "repository": { 11 | "type": "git", 12 | "url": "git@github.com:ryankurte/micro-gui.git" 13 | }, 14 | "homepage": "https://github.com/ryankurte/micro-gui", 15 | "license": "MIT", 16 | "dependencies": {} 17 | } 18 | -------------------------------------------------------------------------------- /resources/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryankurte/micro-gui/2f30aff2d4bcb63b10eee770d898171298c08602/resources/Thumbs.db -------------------------------------------------------------------------------- /resources/fonts/RobotoMono-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryankurte/micro-gui/2f30aff2d4bcb63b10eee770d898171298c08602/resources/fonts/RobotoMono-Regular.ttf -------------------------------------------------------------------------------- /resources/fonts/bmfont2c.cfg: -------------------------------------------------------------------------------- 1 | [General] 2 | OutputHeader = fontlibrary.h 3 | OutputSource = fontlibrary.c 4 | 5 | [Font1] 6 | InputFile = robotomono-regular-18.fnt 7 | CFontName = robotomono_regular_18 8 | FirstAscii = 32 9 | LastAscii = 122 10 | BytesWidth = 2 11 | BytesHeight = 15 12 | CropX = 0 13 | CropY = 2 -------------------------------------------------------------------------------- /resources/fonts/bmfont2c.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | 4 | # Filename : bmfont2c.py 5 | # Description : Converts bitmap font(s) generated by BMFont to C code 6 | # Author : Lars Ole Pontoppidan, 2014 7 | # URL : http://larsee.dk/ 8 | 9 | script_revision = '2014-05-24' 10 | 11 | # -------------------------------- LICENSE ----------------------------------- 12 | # 13 | # Copyright (c) 2014, Lars Ole Pontoppidan 14 | # All rights reserved. 15 | # 16 | # Redistribution and use in source and binary forms, with or without 17 | # modification, are permitted provided that the following conditions are met: 18 | # * Redistributions of source code must retain the above copyright 19 | # notice, this list of conditions and the following disclaimer. 20 | # * Redistributions in binary form must reproduce the above copyright 21 | # notice, this list of conditions and the following disclaimer in the 22 | # documentation and/or other materials provided with the distribution. 23 | # * Neither the name of the original author (Lars Ole Pontoppidan) nor the 24 | # names of its contributors may be used to endorse or promote products 25 | # derived from this software without specific prior written permission. 26 | # 27 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 28 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 29 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 30 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 31 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 32 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 33 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 34 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 36 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | # 38 | 39 | # -------------------------------- READ ME ------------------------------------ 40 | # 41 | # bmfont2c.py reads bitmap font output from the Bitmap Font Generator by 42 | # AngelCode: http://www.angelcode.com/products/bmfont/ and outputs byte table 43 | # arrays in C language suitable for rendering on monochrome matrix LCD. 44 | # 45 | # The conversion process is configured in a configuration file. Multiple font 46 | # conversions can be specified, which will result in multiple fonts being output 47 | # in the same C header and source file. 48 | # 49 | # Usage: python bmfont2c.py 50 | # or: python bmfont2c.py (will use "bmfont2c.cfg" as config filename) 51 | # 52 | # NOTE: When generating the font in BMFont remember to select XML format as the 53 | # font descriptor format. 54 | # 55 | # The script requires Pillow Python module for image processing, and should work 56 | # in both Python 2 and 3. 57 | # 58 | # 59 | # Example config file: 60 | # --------------------- 61 | # 62 | # [General] 63 | # OutputHeader = fontlibrary.h 64 | # OutputSource = fontlibrary.c 65 | # 66 | # [Font1] 67 | # InputFile = somefont.fnt 68 | # CFontName = SomeFont 69 | # FirstAscii = 32 70 | # LastAscii = 126 71 | # BytesWidth = 2 72 | # BytesHeight = 16 73 | # CropX = 0 74 | # CropY = 3 75 | # FixedWidth = 0 76 | # 77 | # [Font2] 78 | # InputFile = otherfont.fnt 79 | # CFontName = OtherFont 80 | # (...) 81 | # 82 | 83 | try: 84 | import configparser 85 | except ImportError: 86 | import ConfigParser as configparser 87 | 88 | from PIL import Image as image 89 | from xml.dom import minidom 90 | import sys 91 | import os 92 | 93 | 94 | header_start = """ 95 | // 96 | // Bitmap font C header file generated by bmfont2c.py 97 | // 98 | 99 | #ifndef FONTLIBRARY_H_ 100 | #define FONTLIBRARY_H_ 101 | 102 | #include 103 | 104 | typedef struct 105 | { 106 | uint8_t GlyphCount; 107 | uint8_t FirstAsciiCode; 108 | uint8_t GlyphBytesWidth; 109 | uint8_t GlyphHeight; 110 | uint8_t FixedWidth; 111 | uint8_t const *GlyphWidth; 112 | uint8_t const *GlyphBitmaps; 113 | } fontStyle_t; 114 | 115 | """ 116 | 117 | header_end = """ 118 | 119 | #endif /* FONTLIBRARY_H_ */ 120 | """ 121 | 122 | 123 | source_start = """ 124 | // 125 | // Bitmap font C source generated by bmfont2c.py 126 | // 127 | 128 | #include 129 | #include 130 | """ 131 | 132 | c_datatype = "static uint8_t const PROGMEM" 133 | 134 | total_ram = 0 135 | 136 | 137 | class Config: 138 | def __init__(self, cfg, section): 139 | self.font_input = cfg.get(section, "InputFile") 140 | self.c_fontname = cfg.get(section, "CFontName") 141 | 142 | # Ascii range to grab 143 | self.first_ascii = cfg.getint(section, "FirstAscii") 144 | self.last_ascii = cfg.getint(section, "LastAscii") 145 | 146 | # Glyph sizing 147 | self.bytes_width = cfg.getint(section, "BytesWidth") 148 | self.bytes_height = cfg.getint(section, "BytesHeight") 149 | self.crop_x = cfg.getint(section, "CropX") 150 | self.crop_y = cfg.getint(section, "CropY") 151 | 152 | if cfg.has_option(section, "FixedWidth"): 153 | self.fixed_width = cfg.getint(section, "FixedWidth") 154 | else: 155 | self.fixed_width = 0; 156 | 157 | 158 | def makeFontStyleDecl(config): 159 | s = "\nfontStyle_t FontStyle_%s = \n" % config.c_fontname 160 | s += "{\n" 161 | s += " %d, // Glyph count\n" % (config.last_ascii - config.first_ascii + 1) 162 | s += " %d, // First ascii code\n" % config.first_ascii 163 | s += " %d, // Glyph width (bytes)\n" % config.bytes_width 164 | s += " %d, // Glyph height (bytes)\n" % config.bytes_height 165 | s += " %d, // Fixed width or 0 if variable\n" % config.fixed_width 166 | if config.fixed_width == 0: 167 | s += " %s_Widths,\n" % config.c_fontname 168 | else: 169 | s += " (void*)0,\n" 170 | s += " %s_Bitmaps\n" % config.c_fontname 171 | s += "};\n" 172 | return s 173 | 174 | def makeFontStyleHeader(config): 175 | return "\nextern fontStyle_t FontStyle_%s;" % config.c_fontname 176 | 177 | 178 | def makeBitmapsTable(config, img, glyphs): 179 | size = (config.last_ascii - config.first_ascii + 1) * config.bytes_width * config.bytes_height 180 | s = "\n%s %s_Bitmaps[%u] = \n{" % (c_datatype, config.c_fontname, size) 181 | global total_ram 182 | total_ram += size 183 | 184 | for ascii in range(config.first_ascii, config.last_ascii + 1): 185 | # Find the glyph 186 | glyph_found = None 187 | for glyph in glyphs: 188 | if glyph.id == ascii: 189 | glyph_found = glyph 190 | break 191 | 192 | if glyph_found is None: 193 | print("INFO: No glyph for ASCII: %d, using substitute" % ascii) 194 | s += "\n // No glyph for ASCII: %d, using substitute:" % ascii 195 | # We use first glyph instead 196 | glyph_found = glyphs[0] 197 | 198 | s += glyph_found.makeBitmapCode(img, config.bytes_width * 8, config.bytes_height, 199 | config.crop_x, config.crop_y) 200 | 201 | s += "};\n" 202 | 203 | return s 204 | 205 | 206 | def makeWidthsTable(config, glyphs): 207 | count = config.last_ascii - config.first_ascii + 1 208 | s = "\n%s %s_Widths[%u] = \n{" % (c_datatype, config.c_fontname, count) 209 | i = 0 210 | global total_ram 211 | total_ram += count 212 | 213 | for ascii in range(config.first_ascii, config.last_ascii + 1): 214 | # Find the glyph 215 | glyph_found = None 216 | for glyph in glyphs: 217 | if glyph.id == ascii: 218 | glyph_found = glyph 219 | break 220 | 221 | if glyph_found is None: 222 | # We use first glyph instead 223 | glyph_found = glyphs[0] 224 | 225 | if i == 0: 226 | s += "\n " 227 | 228 | i = (i + 1) % 8 229 | s += glyph_found.makeWidthCode() 230 | 231 | s += "\n};\n" 232 | return s 233 | 234 | 235 | def loadFont(config): 236 | # Open xml 237 | print("Reading font description: " + config.font_input) 238 | font = minidom.parse(config.font_input) 239 | 240 | # Open page 0 image: 241 | file = font.getElementsByTagName('page')[0].attributes['file'].value 242 | print("Reading font bitmap: " + file) 243 | img = image.open(file) 244 | 245 | # Get the glyphs 246 | chars = font.getElementsByTagName('char') 247 | 248 | glyphs = [] 249 | for char in chars: 250 | glyphs.append(Glyph(char)) 251 | 252 | return (img, glyphs) 253 | 254 | def makeFontSource(config): 255 | img, glyphs = loadFont(config) 256 | 257 | source = makeBitmapsTable(config, img, glyphs) 258 | 259 | if config.fixed_width == 0: 260 | source += makeWidthsTable(config, glyphs) 261 | 262 | source += makeFontStyleDecl(config) 263 | 264 | return source 265 | 266 | def processConfig(cfg): 267 | # Get the general configuration 268 | output_header = cfg.get("General", "OutputHeader") 269 | output_source = cfg.get("General", "OutputSource") 270 | 271 | # Start up the header and source file 272 | header = header_start 273 | source = source_start 274 | source += '#include "%s"\n' % output_header 275 | 276 | font_no = 1 277 | 278 | global total_ram 279 | total_ram = 0 280 | 281 | while cfg.has_section("Font%d" % font_no): 282 | config = Config(cfg, "Font%d" % font_no) 283 | source = source + makeFontSource(config) 284 | header = header + makeFontStyleHeader(config) 285 | font_no += 1 286 | 287 | header += header_end 288 | 289 | print("INFO: Font tables use: %u bytes" % total_ram) 290 | 291 | print("Writing output: " + output_source) 292 | 293 | with open(output_source, "w") as text_file: 294 | text_file.write(source) 295 | 296 | print("Writing output: " + output_header) 297 | 298 | with open(output_header, "w") as text_file: 299 | text_file.write(header) 300 | 301 | 302 | class Glyph: 303 | def __init__(self, char): 304 | self.id = int(char.attributes['id'].value) 305 | self.x = int(char.attributes['x'].value) 306 | self.y = int(char.attributes['y'].value) 307 | self.width = int(char.attributes['width'].value) 308 | self.height = int(char.attributes['height'].value) 309 | self.xoffset = int(char.attributes['xoffset'].value) 310 | self.yoffset = int(char.attributes['yoffset'].value) 311 | self.xadvance = int(char.attributes['xadvance'].value) 312 | 313 | def printRaw(self, img): 314 | print("id: %d, width: %d, height: %d" % (self.id, self.width, self.height)) 315 | print("xoffset: %d, yoffset: %d, xadvance: %d" % (self.xoffset, self.yoffset, self.xadvance)) 316 | for y in range(self.y, self.y + self.height): 317 | s = "" 318 | for x in range(self.x, self.x + self.width): 319 | if img.getpixel((x,y)) > 127: 320 | s += '1' 321 | else: 322 | s += '0' 323 | print(s) 324 | 325 | def printNormalized(self, img, width, height, crop_x = 0, crop_y = 0): 326 | for y in range(0, height): 327 | s = "" 328 | for x in range(0, width): 329 | use_x = x - self.xoffset + crop_x 330 | use_y = y - self.yoffset + crop_y 331 | pixel = '0' 332 | if (use_x >= 0) and (use_x < self.width) and (use_y >= 0) and (use_y < self.height): 333 | if img.getpixel((use_x + self.x, use_y + self.y)) > 127: 334 | pixel = '1' 335 | 336 | s += pixel 337 | print(s) 338 | 339 | def makeBitmapCode(self, img, width, height, crop_x = 0, crop_y = 0): 340 | s = '\n // ASCII: %d, char width: %d' % (self.id, self.xadvance) 341 | for y in range(0, height): 342 | comment = "" 343 | bytestring = "" 344 | byte = 0 345 | mask = 128 346 | for x in range(0, width): 347 | use_x = x - self.xoffset + crop_x 348 | use_y = y - self.yoffset + crop_y 349 | pixel = 0 350 | if (use_x >= 0) and (use_x < self.width) and (use_y >= 0) and (use_y < self.height): 351 | if img.getpixel((use_x + self.x, use_y + self.y)) > 127: 352 | pixel = 1 353 | 354 | if pixel != 0: 355 | comment += 'O' 356 | byte |= mask 357 | else: 358 | if x >= self.xadvance: 359 | comment += '.' 360 | else: 361 | comment += '-' 362 | 363 | mask = mask // 2 364 | 365 | if mask == 0: 366 | bytestring += "0x%02x, " % byte 367 | mask = 128 368 | byte = 0 369 | 370 | if mask != 128: 371 | bytestring += "0x%02x, " % byte 372 | 373 | s += "\n " + bytestring + " // " + comment 374 | 375 | return s + "\n" 376 | 377 | def makeWidthCode(self): 378 | return '%2d, ' % (self.xadvance) 379 | 380 | if __name__ == "__main__": 381 | print("BMFont to C source converter by Lars Ole Pontoppidan, %s\n" % script_revision) 382 | 383 | if len(sys.argv) == 2: 384 | cfgfile = sys.argv[1] 385 | elif len(sys.argv) == 1: 386 | cfgfile = 'bmfont2c.cfg' 387 | else: 388 | print("ERROR: Invalid command line arguments\n") 389 | exit() 390 | 391 | if os.path.isfile(cfgfile): 392 | print("Reading configuration file: " + cfgfile) 393 | cfg = configparser.ConfigParser() 394 | cfg.read(cfgfile) 395 | processConfig(cfg) 396 | else: 397 | print("ERROR: Configuration file '%s' not found\n" % cfgfile) 398 | 399 | -------------------------------------------------------------------------------- /scripts/build-font.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from os import listdir 4 | from os.path import isfile, join 5 | 6 | import argparse 7 | import re 8 | import string 9 | 10 | from PIL import Image, ImageFont, ImageDraw 11 | import pystache 12 | 13 | def print_hex(val): 14 | return "{0:#0{1}x}".format(val,4) 15 | 16 | def process_char(font, char): 17 | # Calculate char info 18 | char_size = font.getsize(char); 19 | char_mask = font.getmask(char); 20 | #Create image 21 | char_image = Image.new('1', char_size, 0); 22 | #Draw font to image 23 | d = ImageDraw.Draw(char_image); 24 | d.fontmode = '1'; 25 | d.text((0, 0), char, font=font, fill=(1)); 26 | return char_image; 27 | 28 | def generate_bin_image(image): 29 | data = image.getdata(); 30 | size = image.size; 31 | 32 | bin_image = [[0 for i in range(size[0])] for j in range(size[1])]; 33 | 34 | for j in range(size[1]): 35 | for i in range(size[0]): 36 | index = j * size[0] + i; 37 | if data[index] == 0: 38 | bin_image[j][i] = '0'; 39 | else: 40 | bin_image[j][i] = '1'; 41 | 42 | return bin_image; 43 | 44 | def bin_to_byte_data(min_width_bytes, min_height, image_bin): 45 | data = []; 46 | for i in range(0, len(image_bin)) : 47 | row = image_bin[i]; 48 | row_data = [] 49 | temp = ''; 50 | for j in range(0, len(row)): 51 | temp += str(row[j]); 52 | if(len(temp) % 8 == 0): 53 | row_data.append(print_hex(int(temp, 2))); 54 | temp = ''; 55 | if len(temp) > 0 : 56 | while len(temp) < 8: 57 | temp += '0'; 58 | row_data.append(print_hex(int(temp, 2))); 59 | 60 | while len(row_data) < min_width_bytes: 61 | row_data.append(print_hex(0)); 62 | 63 | data.append(row_data); 64 | 65 | while(len(data) < min_height): 66 | row_data = [print_hex(0) for i in range(0, min_width_bytes)]; 67 | data.append(row_data) 68 | return data; 69 | 70 | def bytes_to_string(image_bytes): 71 | data = ''; 72 | for i in range(0, len(image_bytes)): 73 | data += ', '.join(image_bytes[i]) + ',\r\n'; 74 | return data; 75 | 76 | 77 | def generate_file(template, name, data): 78 | #print("Writing to output file: " + name) 79 | 80 | template_file = open(template, 'r') 81 | template = template_file.read() 82 | template_file.close() 83 | 84 | output_data = pystache.render(template, data) 85 | 86 | output_file = open(name, 'w') 87 | 88 | output_file.write(output_data) 89 | output_file.close() 90 | 91 | # Setup arguments 92 | parser = argparse.ArgumentParser(description='Process open-iconic png files to c sources') 93 | 94 | parser.add_argument('--size', nargs=1, type=int, default=[16], 95 | help='font size') 96 | 97 | parser.add_argument('--font', nargs=1, default=["../resources/RobotoMono-Regular.ttf"], 98 | help='ttf font file to generate from') 99 | 100 | parser.add_argument('--template', nargs=1, default=['font-template.c'], 101 | help='mustache template to fill') 102 | 103 | parser.add_argument('--output', nargs=1, default=['font.c'], 104 | help='output file name') 105 | 106 | parser.add_argument('--start', nargs=1, type=int, default=[32], 107 | help='start character') 108 | 109 | parser.add_argument('--end', nargs=1, type=int, default=[127], 110 | help='end character') 111 | 112 | # Parse arguments 113 | args = parser.parse_args() 114 | 115 | font_file = args.font[0]; 116 | font_path = font_file.split('/'); 117 | font_name = font_path[len(font_path) - 1].split('.')[0].replace('-', '_').lower(); 118 | 119 | font_size = args.size[0]; 120 | 121 | # Generate char list 122 | chars = [chr(c) for c in range(args.start[0], args.end[0])]; 123 | 124 | font = ImageFont.truetype(font=font_file, size=font_size); 125 | 126 | images = {}; 127 | 128 | # Generate character images 129 | for c in chars: 130 | images[c] = process_char(font, c); 131 | 132 | #print("Created: " + str(len(images)) + " sprites"); 133 | 134 | # Determine minimum height and width 135 | min_width = 0; 136 | min_height = 0; 137 | 138 | for i in images: 139 | if min_width < images[i].size[0]: 140 | min_width = images[i].size[0]; 141 | if min_height < images[i].size[1]: 142 | min_height = images[i].size[1]; 143 | 144 | #print("Minimum width: " + str(min_width) + " pixels"); 145 | #print("Minimum height: " + str(min_height) + " pixels"); 146 | 147 | # Calculate minimum common image width 148 | min_width_bytes = int(min_width / 8); 149 | if min_width % 8 != 0: 150 | min_width_bytes += 1; 151 | 152 | # Generate image data 153 | image_data = {}; 154 | for i in chars: 155 | image_data[i] = generate_bin_image(images[i]); 156 | 157 | # Convert into bytes 158 | image_bytes = {}; 159 | for i in chars: 160 | image_bytes[i] = bin_to_byte_data(min_width_bytes, min_height, image_data[i]); 161 | 162 | # Generate character data strings 163 | image_strings = {}; 164 | for i in chars: 165 | image_strings[i] = bytes_to_string(image_bytes[i]); 166 | 167 | # Combine into structure for template use 168 | template_data = {}; 169 | template_data['chars'] = []; 170 | template_data['size'] = font_size; 171 | template_data['name'] = font_name; 172 | template_data['NAME'] = font_name.upper(); 173 | template_data['start'] = ord(chars[0]); 174 | template_data['end'] = ord(chars[len(chars) - 1]); 175 | template_data['count'] = args.end[0] - args.start[0]; 176 | template_data['char_height'] = min_height; 177 | template_data['char_width'] = min_width_bytes; 178 | 179 | for i in chars: 180 | char_data = {}; 181 | 182 | char_data['char'] = i; 183 | char_data['code'] = ord(i); 184 | char_data['bin'] = image_data[i]; 185 | char_data['byte'] = image_bytes[i]; 186 | char_data['string'] = image_strings[i]; 187 | char_data['width'] = images[i].size[0]; 188 | char_data['height'] = images[i].size[1]; 189 | 190 | template_data['chars'].append(char_data); 191 | 192 | #print(template_data); 193 | 194 | generate_file(args.template[0], args.output[0], template_data); 195 | -------------------------------------------------------------------------------- /scripts/build-iconic.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from os import listdir 4 | from os.path import isfile, join 5 | 6 | import argparse 7 | import re 8 | 9 | from PIL import Image 10 | import pystache 11 | 12 | 13 | def process_image(filename): 14 | image = Image.open(args.folder[0] + '/' + filename) 15 | data = list(image.getdata()) 16 | return filename.split('.')[0].replace('-', '_'), data 17 | 18 | def generate_data(data): 19 | data_array = [] 20 | for a in data: 21 | data_array.append(hex(a[3])) 22 | return ', '.join(data_array) 23 | 24 | def generate_file(template, name, data): 25 | # print("Writing to output file: " + name) 26 | 27 | template_file = open(template, 'r') 28 | template = template_file.read() 29 | template_file.close() 30 | 31 | output_data = pystache.render(template, data) 32 | 33 | output_file = open(name, 'w') 34 | 35 | output_file.write(output_data) 36 | output_file.close() 37 | 38 | 39 | # Setup arguments 40 | parser = argparse.ArgumentParser(description='Process open-iconic png files to c sources') 41 | 42 | parser.add_argument('--scale', nargs=1, type=int, default=1, 43 | help='icon scale, either 1, 2, 3, 4, 6, 8') 44 | 45 | parser.add_argument('--folder', nargs=1, default=['./png'], 46 | help='folder to look for icons') 47 | 48 | parser.add_argument('--template', nargs=1, default=['icon-template.h'], 49 | help='mustache template to fill') 50 | 51 | parser.add_argument('--output', nargs=1, default=['icons.h'], 52 | help='output file') 53 | 54 | parser.add_argument('--debug', 55 | help='debug mode') 56 | 57 | args = parser.parse_args() 58 | 59 | 60 | # Create filter for scale setting 61 | if args.scale[0] == 1: 62 | filter = re.compile('^([a-z\-]+).png') 63 | else: 64 | filter = re.compile('^([a-z\-]+)-' + str(args.scale) + 'x.png') 65 | 66 | # Parse folder 67 | files = [f for f in listdir(args.folder[0]) if isfile(join(args.folder[0], f))] 68 | 69 | # Filter files based on scale 70 | filtered_files = [f for f in files if filter.match(f)] 71 | 72 | file_data = {} 73 | 74 | file_data['template'] = args.template[0] 75 | file_data['scale'] = args.scale[0] 76 | file_data['icons'] = [] 77 | 78 | for f in filtered_files: 79 | name, data = process_image(f) 80 | icon = {} 81 | icon['name'] = name 82 | icon['data'] = generate_data(data) 83 | icon['size'] = len(data) 84 | file_data['icons'].append(icon) 85 | 86 | generate_file(args.template[0], args.output[0], file_data) 87 | -------------------------------------------------------------------------------- /scripts/font-template.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Font source template 3 | * For use with the ugui python ttf font -> c font generator 4 | * See build-font.py 5 | * 6 | * Font name: {{name}} 7 | * Font size: {{size}} 8 | * Start char: {{start}} 9 | * End char: {{end}} 10 | */ 11 | 12 | #include "ugui/fonts/{{name}}_{{size}}.h" 13 | 14 | #include 15 | 16 | #include "ugui/font.h" 17 | 18 | 19 | static const uint8_t font_{{name}}_{{size}}_map[] = { 20 | {{#chars}} 21 | // Symbol: {{char}} Code: {{code}} Width: {{width}} 22 | {{string}} 23 | {{/chars}} 24 | }; 25 | 26 | static uint8_t const font_{{name}}_{{size}}_widths[{{count}}] = 27 | { 28 | {{#chars}} 29 | {{width}}, 30 | {{/chars}} 31 | }; 32 | 33 | font_style_t font_{{name}}_{{size}} = 34 | { 35 | {{count}}, // Glyph count 36 | {{start}}, // First ascii code 37 | {{char_width}}, // Glyph width (bytes) 38 | {{char_height}}, // Glyph height (bytes) 39 | 0, // Fixed width or 0 if variable 40 | font_{{name}}_{{size}}_widths, 41 | font_{{name}}_{{size}}_map 42 | }; 43 | -------------------------------------------------------------------------------- /scripts/font-template.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Font header template 3 | * For use with the ugui python ttf font -> sprite generator 4 | * See build-font.py 5 | * 6 | * Font name: {{name}} 7 | * Font size: {{size}} 8 | * Start char: {{start}} 9 | * End char: {{end}} 10 | */ 11 | 12 | #include 13 | 14 | #include "ugui/font.h" 15 | 16 | #ifndef FONT_{{NAME}}_{{size}}_H 17 | #define FONT_{{NAME}}_{{size}}_H 18 | 19 | font_style_t font_{{name}}_{{size}}; 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /scripts/icon-template.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Icon source template 3 | * For use with the ugui python openiconic -> sprite generator 4 | * See build-iconic.py 5 | */ 6 | 7 | #include 8 | 9 | {{#icons}} 10 | uint8_t icon_{{name}}_x{{scale}}[] = { {{data}} }; 11 | {{/icons}} 12 | -------------------------------------------------------------------------------- /scripts/icon-template.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Icon header template 3 | * For use with the ugui python open-iconic -> sprite generator 4 | * See build-iconic.py 5 | * 6 | * Template: {{template}} 7 | * Scale: {{scale}} 8 | */ 9 | 10 | #include 11 | 12 | #ifndef ICONS_{{scale}}X_H 13 | #define ICONS_{{scale}}X_H 14 | 15 | {{#icons}} 16 | uint8_t icon_{{name}}[{{size}}]; 17 | {{/icons}} 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /source/bmp.c: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * @brief Pure C Bitmap writer 4 | * 5 | * Based on: https://stackoverflow.com/questions/2654480/writing-bmp-image-in-pure-c-c-without-other-libraries 6 | */ 7 | 8 | #include "ugui/bmp.h" 9 | 10 | #define BMP_FILE_HEADER_SIZE 14 11 | #define BMP_INFO_HEADER_SIZE 40 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | static int create_header(char* filename, uint32_t w, uint32_t h, uint8_t* data) { 20 | 21 | uint32_t filesize = BMP_FILE_HEADER_SIZE + BMP_INFO_HEADER_SIZE + w * h * 3; 22 | 23 | unsigned char bmpfileheader[14] = {'B', 'M', 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0}; 24 | unsigned char bmpinfoheader[40] = {40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 24, 0}; 25 | unsigned char bmppad[3] = {0, 0, 0}; 26 | 27 | int index = 0; 28 | 29 | //Write file header 30 | bmpfileheader[ 2] = (unsigned char)(filesize); 31 | bmpfileheader[ 3] = (unsigned char)(filesize >> 8); 32 | bmpfileheader[ 4] = (unsigned char)(filesize >> 16); 33 | bmpfileheader[ 5] = (unsigned char)(filesize >> 24); 34 | 35 | memcpy(data + index, bmpfileheader, sizeof(bmpfileheader)); 36 | index += sizeof(bmpfileheader); 37 | 38 | //Write info header 39 | bmpinfoheader[ 4] = (unsigned char)(w); 40 | bmpinfoheader[ 5] = (unsigned char)(w >> 8); 41 | bmpinfoheader[ 6] = (unsigned char)(w >> 16); 42 | bmpinfoheader[ 7] = (unsigned char)(w >> 24); 43 | bmpinfoheader[ 8] = (unsigned char)(h); 44 | bmpinfoheader[ 9] = (unsigned char)(h >> 8); 45 | bmpinfoheader[10] = (unsigned char)(h >> 16); 46 | bmpinfoheader[11] = (unsigned char)(h >> 24); 47 | 48 | memcpy(data + index, bmpinfoheader, sizeof(bmpinfoheader)); 49 | index += sizeof(bmpinfoheader); 50 | 51 | return index; 52 | } 53 | 54 | int bmp_create_bw(char* filename, uint32_t w, uint32_t h, uint8_t* data) { 55 | 56 | FILE *f; 57 | int index = 0; 58 | 59 | uint32_t filesize = BMP_FILE_HEADER_SIZE + BMP_INFO_HEADER_SIZE + w * h * 3; 60 | uint8_t* filedata = (uint8_t*)malloc(filesize); 61 | 62 | //Create header 63 | index += create_header(filename, w, h, filedata); 64 | 65 | //Write data 66 | for (int i = h - 1; i >= 0; i--) { 67 | for (int j = 0; j < w; j++) { 68 | 69 | uint8_t byte = data[i * (w / 8) + (j / 8)]; 70 | uint8_t mask = 1 << (j % 8); 71 | 72 | if ((byte & mask) != 0) { 73 | filedata[index + 0] = 0x00; 74 | filedata[index + 1] = 0x00; 75 | filedata[index + 2] = 0x00; 76 | } else { 77 | filedata[index + 0] = 0xFF; 78 | filedata[index + 1] = 0xFF; 79 | filedata[index + 2] = 0xFF; 80 | } 81 | index += 3; 82 | } 83 | 84 | //Padding should ensure each section is word aligned 85 | //TODO: this is broken 86 | index += (w % 4 != 0) ? 4 - (w % 4) : 0; 87 | } 88 | 89 | //Write file 90 | f = fopen(filename, "w"); 91 | fwrite(filedata, 1, filesize, f); 92 | fclose(f); 93 | 94 | free(filedata); 95 | 96 | return 0; 97 | } 98 | 99 | int bmp_create_bool(char* filename, uint32_t w, uint32_t h, bool* data) { 100 | 101 | FILE *f; 102 | int index = 0; 103 | 104 | uint32_t filesize = BMP_FILE_HEADER_SIZE + BMP_INFO_HEADER_SIZE + w * h * 3; 105 | uint8_t* filedata = (uint8_t*)malloc(filesize); 106 | 107 | //Create header 108 | index += create_header(filename, w, h, filedata); 109 | 110 | //Write data 111 | for (int i = h - 1; i >= 0; i--) { 112 | for (int j = 0; j < w; j++) { 113 | if (data[i * w + j] == true) { 114 | filedata[index + 0] = 0x00; 115 | filedata[index + 1] = 0x00; 116 | filedata[index + 2] = 0x00; 117 | } else { 118 | filedata[index + 0] = 0xFF; 119 | filedata[index + 1] = 0xFF; 120 | filedata[index + 2] = 0xFF; 121 | } 122 | index += 3; 123 | } 124 | 125 | //Padding should ensure each section is word aligned 126 | //TODO: this is broken 127 | index += (w % 4 != 0) ? 4 - (w % 4) : 0; 128 | } 129 | 130 | //Write file 131 | f = fopen(filename, "w"); 132 | fwrite(filedata, 1, filesize, f); 133 | fclose(f); 134 | 135 | free(filedata); 136 | 137 | return 0; 138 | } 139 | -------------------------------------------------------------------------------- /source/buffer.c: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "ugui/buffer.h" 4 | 5 | #include 6 | 7 | struct ugui_buffer_s { 8 | uint16_t w; //!< Buffer width in pixels 9 | uint16_t h; //!< Buffer height in pixels 10 | 11 | uint16_t row_width_bytes; //!< Width of a buffer row in bytes 12 | 13 | uint8_t porch; //!< Padding before each row in the buffer 14 | uint8_t trailer; //!< Padding after each row in the buffer 15 | 16 | uint8_t* data; //!< Storage of pixel data 17 | }; 18 | 19 | ugui_buffer_t* _ugui_buffer_create(uint16_t w, uint16_t h, uint16_t porch, uint16_t trailer) { 20 | ugui_buffer_t* buffer = (ugui_buffer_t*)malloc(sizeof(ugui_buffer_t)); 21 | if (buffer == NULL) return NULL; 22 | 23 | buffer->h = h; 24 | buffer->w = w; 25 | 26 | buffer->porch = porch; 27 | buffer->trailer = trailer; 28 | 29 | //Calculate row length in bytes (with padding) 30 | //TODO: probably need to pad to 32-bit alignment 31 | //TODO: could allow porch and trailers to streamline DMA to display 32 | //TODO: prove either of these things are useful before implementing 33 | #ifdef UGUI_COLOUR 34 | buffer->row_width_bytes = (w * sizeof(ugui_pixel_t)) + porch + trailer; 35 | int size = buffer->row_width_bytes * h; 36 | 37 | #else 38 | int row_width = w / 8 + porch + trailer; 39 | buffer->row_width_bytes = row_width + ((w % 8 > 0) ? 1 : 0); 40 | 41 | int size = buffer->row_width_bytes * h; 42 | #endif 43 | 44 | //Allocate pixel memory 45 | //TODO: this may need to be injected for use with DMA 46 | buffer->data = (uint8_t*)malloc(size); 47 | if (buffer->data == NULL) { 48 | free(buffer); 49 | return NULL; 50 | } 51 | 52 | return buffer; 53 | } 54 | 55 | uint8_t* _ugui_buffer_get_row(ugui_buffer_t* buffer, uint16_t index) 56 | { 57 | return buffer->data + buffer->row_width_bytes * index + buffer->porch; 58 | } 59 | 60 | void _ugui_buffer_set(ugui_buffer_t* buffer, ugui_point_t* point, ugui_pixel_t value) { 61 | #ifdef UGUI_COLOUR 62 | int y = point->y; 63 | int x = point->x; 64 | 65 | int index = buffer->row_width_bytes * y 66 | + x * sizeof(ugui_pixel_t) + 67 | buffer->porch + 68 | i; 69 | memcpy(buffer->data[index], 70 | &value, 71 | sizeof(ugui_pixel_t)); 72 | #else 73 | int y = point->y; 74 | int x = point->x / 8; 75 | int shift = point->x % 8; 76 | 77 | if (value) { 78 | buffer->data[buffer->row_width_bytes * y + x] |= (value << shift); 79 | } else { 80 | buffer->data[buffer->row_width_bytes * y + x] &= ~(value << shift); 81 | } 82 | 83 | #endif 84 | } 85 | 86 | void _ugui_buffer_get(ugui_buffer_t* buffer, ugui_point_t* point, ugui_pixel_t* value) { 87 | #ifdef UGUI_COLOUR 88 | int y = point->y; 89 | int x = point->x; 90 | 91 | int index = buffer->row_width_bytes * y 92 | + x * sizeof(ugui_pixel_t) + 93 | buffer->porch + 94 | i; 95 | memcpy(&value, 96 | buffer->data[index], 97 | sizeof(ugui_pixel_t)); 98 | #else 99 | int y = point->y; 100 | int x = point->x / 8; 101 | int shift = point->x % 8; 102 | 103 | *value = ((buffer->data[buffer->row_width_bytes * y + x] & (1 << shift)) != 0); 104 | #endif 105 | } 106 | 107 | void _ugui_buffer_inverse(ugui_buffer_t* buffer, ugui_point_t* point) { 108 | #ifdef UGUI_COLOUR 109 | int x = point->x; 110 | int y = point->y; 111 | 112 | for (int i = 0; i < sizeof(ugui_pixel_t); i++) { 113 | int index = buffer->row_width_bytes * y 114 | + x * sizeof(ugui_pixel_t) + 115 | buffer->porch + 116 | i; 117 | uint8_t* ptr = buffer->data[index]; 118 | *ptr ^= *ptr; 119 | } 120 | #else 121 | int y = point->y; 122 | int x = point->x / 8; 123 | int shift = point->x % 8; 124 | 125 | buffer->data[buffer->row_width_bytes * y + x] ^= (1 << shift); 126 | #endif 127 | } 128 | 129 | void _ugui_buffer_clear(ugui_buffer_t* buffer) { 130 | for (int i = 0; i < buffer->h; i++) { 131 | for (int j = 0; j < buffer->row_width_bytes; j++) { 132 | buffer->data[i * buffer->row_width_bytes + j] = 0; 133 | } 134 | } 135 | } 136 | 137 | uint8_t* _ugui_buffer_get_data(ugui_buffer_t* buffer) { 138 | return buffer->data; 139 | } 140 | 141 | void _ugui_buffer_destroy(ugui_buffer_t* buffer) 142 | { 143 | free(buffer->data); 144 | 145 | free(buffer); 146 | } 147 | 148 | -------------------------------------------------------------------------------- /source/font.c: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "ugui/font.h" 4 | 5 | #include 6 | 7 | #include "ugui/types.h" 8 | 9 | int ugui_font_get_text_size(font_style_t *font, char *c, ugui_size_t* size) { 10 | uint16_t len = strlen(c); 11 | 12 | size->h = font->glyph_height; 13 | size->w = 0; 14 | 15 | for(uint16_t i=0; ifirst_ascii_code; 17 | size->w += font->glyph_width[index]; 18 | } 19 | 20 | return 0; 21 | } 22 | 23 | int _ugui_font_get_glyph(font_style_t *font, char c, ugui_sprite_t* glyph) 24 | { 25 | //Calculate font index 26 | uint16_t index = c - font->first_ascii_code; 27 | 28 | //Check index is within bounds for the style 29 | if(index >= font->glyph_count) { 30 | return 0; 31 | } 32 | 33 | //Calculate character offset in memory 34 | //TODO: either make this more efficient or remove and use only fixed width 35 | uint16_t offset = index * font->glyph_height * font->glyph_width_bytes; 36 | 37 | glyph->w_bytes = font->glyph_width_bytes; 38 | glyph->h = font->glyph_height; 39 | glyph->w = font->glyph_width[index]; 40 | glyph->data = font->glyph_bitmaps + font->glyph_height * font->glyph_width_bytes * index; 41 | 42 | return 1; 43 | } 44 | 45 | -------------------------------------------------------------------------------- /source/fonts/robotomono_regular_16.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Font source template 3 | * For use with the ugui python ttf font -> c font generator 4 | * See build-font.py 5 | * 6 | * Font name: robotomono_regular 7 | * Font size: 16 8 | * Start char: 32 9 | * End char: 126 10 | */ 11 | 12 | #include "ugui/fonts/robotomono_regular_16.h" 13 | 14 | #include 15 | 16 | #include "ugui/font.h" 17 | 18 | 19 | static const uint8_t font_robotomono_regular_16_map[] = { 20 | // Symbol: Code: 32 Width: 10 21 | 0x00, 0x00, 22 | 0x00, 0x00, 23 | 0x00, 0x00, 24 | 0x00, 0x00, 25 | 0x00, 0x00, 26 | 0x00, 0x00, 27 | 0x00, 0x00, 28 | 0x00, 0x00, 29 | 0x00, 0x00, 30 | 0x00, 0x00, 31 | 0x00, 0x00, 32 | 0x00, 0x00, 33 | 0x00, 0x00, 34 | 0x00, 0x00, 35 | 0x00, 0x00, 36 | 0x00, 0x00, 37 | 0x00, 0x00, 38 | 0x00, 0x00, 39 | 0x00, 0x00, 40 | 41 | // Symbol: ! Code: 33 Width: 10 42 | 0x00, 0x00, 43 | 0x00, 0x00, 44 | 0x00, 0x00, 45 | 0x08, 0x00, 46 | 0x08, 0x00, 47 | 0x08, 0x00, 48 | 0x08, 0x00, 49 | 0x08, 0x00, 50 | 0x08, 0x00, 51 | 0x08, 0x00, 52 | 0x08, 0x00, 53 | 0x00, 0x00, 54 | 0x00, 0x00, 55 | 0x00, 0x00, 56 | 0x0c, 0x00, 57 | 0x00, 0x00, 58 | 0x00, 0x00, 59 | 0x00, 0x00, 60 | 0x00, 0x00, 61 | 62 | // Symbol: " Code: 34 Width: 10 63 | 0x00, 0x00, 64 | 0x00, 0x00, 65 | 0x00, 0x00, 66 | 0x12, 0x00, 67 | 0x12, 0x00, 68 | 0x12, 0x00, 69 | 0x12, 0x00, 70 | 0x00, 0x00, 71 | 0x00, 0x00, 72 | 0x00, 0x00, 73 | 0x00, 0x00, 74 | 0x00, 0x00, 75 | 0x00, 0x00, 76 | 0x00, 0x00, 77 | 0x00, 0x00, 78 | 0x00, 0x00, 79 | 0x00, 0x00, 80 | 0x00, 0x00, 81 | 0x00, 0x00, 82 | 83 | // Symbol: # Code: 35 Width: 10 84 | 0x00, 0x00, 85 | 0x00, 0x00, 86 | 0x00, 0x00, 87 | 0x09, 0x00, 88 | 0x09, 0x00, 89 | 0x19, 0x00, 90 | 0x7f, 0x80, 91 | 0x12, 0x00, 92 | 0x12, 0x00, 93 | 0x12, 0x00, 94 | 0xff, 0x80, 95 | 0x26, 0x00, 96 | 0x24, 0x00, 97 | 0x24, 0x00, 98 | 0x24, 0x00, 99 | 0x00, 0x00, 100 | 0x00, 0x00, 101 | 0x00, 0x00, 102 | 0x00, 0x00, 103 | 104 | // Symbol: $ Code: 36 Width: 10 105 | 0x00, 0x00, 106 | 0x00, 0x00, 107 | 0x0c, 0x00, 108 | 0x0c, 0x00, 109 | 0x1e, 0x00, 110 | 0x33, 0x00, 111 | 0x21, 0x00, 112 | 0x20, 0x00, 113 | 0x30, 0x00, 114 | 0x1e, 0x00, 115 | 0x03, 0x00, 116 | 0x01, 0x00, 117 | 0x61, 0x80, 118 | 0x21, 0x00, 119 | 0x3f, 0x00, 120 | 0x0c, 0x00, 121 | 0x0c, 0x00, 122 | 0x00, 0x00, 123 | 0x00, 0x00, 124 | 125 | // Symbol: % Code: 37 Width: 10 126 | 0x00, 0x00, 127 | 0x00, 0x00, 128 | 0x00, 0x00, 129 | 0x70, 0x00, 130 | 0xd0, 0x00, 131 | 0x9b, 0x00, 132 | 0xd2, 0x00, 133 | 0x74, 0x00, 134 | 0x04, 0x00, 135 | 0x08, 0x00, 136 | 0x0b, 0x80, 137 | 0x14, 0x80, 138 | 0x34, 0x80, 139 | 0x04, 0x80, 140 | 0x03, 0x80, 141 | 0x00, 0x00, 142 | 0x00, 0x00, 143 | 0x00, 0x00, 144 | 0x00, 0x00, 145 | 146 | // Symbol: & Code: 38 Width: 10 147 | 0x00, 0x00, 148 | 0x00, 0x00, 149 | 0x00, 0x00, 150 | 0x1c, 0x00, 151 | 0x36, 0x00, 152 | 0x22, 0x00, 153 | 0x22, 0x00, 154 | 0x34, 0x00, 155 | 0x18, 0x00, 156 | 0x38, 0x00, 157 | 0x6c, 0x80, 158 | 0x47, 0x80, 159 | 0x43, 0x00, 160 | 0x63, 0x00, 161 | 0x3d, 0x80, 162 | 0x00, 0x00, 163 | 0x00, 0x00, 164 | 0x00, 0x00, 165 | 0x00, 0x00, 166 | 167 | // Symbol: ' Code: 39 Width: 10 168 | 0x00, 0x00, 169 | 0x00, 0x00, 170 | 0x00, 0x00, 171 | 0x08, 0x00, 172 | 0x08, 0x00, 173 | 0x08, 0x00, 174 | 0x08, 0x00, 175 | 0x00, 0x00, 176 | 0x00, 0x00, 177 | 0x00, 0x00, 178 | 0x00, 0x00, 179 | 0x00, 0x00, 180 | 0x00, 0x00, 181 | 0x00, 0x00, 182 | 0x00, 0x00, 183 | 0x00, 0x00, 184 | 0x00, 0x00, 185 | 0x00, 0x00, 186 | 0x00, 0x00, 187 | 188 | // Symbol: ( Code: 40 Width: 10 189 | 0x00, 0x00, 190 | 0x00, 0x00, 191 | 0x02, 0x00, 192 | 0x04, 0x00, 193 | 0x0c, 0x00, 194 | 0x08, 0x00, 195 | 0x18, 0x00, 196 | 0x18, 0x00, 197 | 0x10, 0x00, 198 | 0x10, 0x00, 199 | 0x10, 0x00, 200 | 0x10, 0x00, 201 | 0x10, 0x00, 202 | 0x18, 0x00, 203 | 0x18, 0x00, 204 | 0x08, 0x00, 205 | 0x0c, 0x00, 206 | 0x06, 0x00, 207 | 0x02, 0x00, 208 | 209 | // Symbol: ) Code: 41 Width: 10 210 | 0x00, 0x00, 211 | 0x00, 0x00, 212 | 0x10, 0x00, 213 | 0x10, 0x00, 214 | 0x08, 0x00, 215 | 0x0c, 0x00, 216 | 0x04, 0x00, 217 | 0x04, 0x00, 218 | 0x04, 0x00, 219 | 0x06, 0x00, 220 | 0x06, 0x00, 221 | 0x06, 0x00, 222 | 0x04, 0x00, 223 | 0x04, 0x00, 224 | 0x04, 0x00, 225 | 0x0c, 0x00, 226 | 0x08, 0x00, 227 | 0x10, 0x00, 228 | 0x10, 0x00, 229 | 230 | // Symbol: * Code: 42 Width: 10 231 | 0x00, 0x00, 232 | 0x00, 0x00, 233 | 0x00, 0x00, 234 | 0x00, 0x00, 235 | 0x00, 0x00, 236 | 0x0c, 0x00, 237 | 0x0c, 0x00, 238 | 0x4c, 0x80, 239 | 0x7f, 0x80, 240 | 0x0c, 0x00, 241 | 0x1e, 0x00, 242 | 0x32, 0x00, 243 | 0x13, 0x00, 244 | 0x00, 0x00, 245 | 0x00, 0x00, 246 | 0x00, 0x00, 247 | 0x00, 0x00, 248 | 0x00, 0x00, 249 | 0x00, 0x00, 250 | 251 | // Symbol: + Code: 43 Width: 10 252 | 0x00, 0x00, 253 | 0x00, 0x00, 254 | 0x00, 0x00, 255 | 0x00, 0x00, 256 | 0x00, 0x00, 257 | 0x0c, 0x00, 258 | 0x0c, 0x00, 259 | 0x0c, 0x00, 260 | 0x0c, 0x00, 261 | 0x7f, 0x80, 262 | 0x0c, 0x00, 263 | 0x0c, 0x00, 264 | 0x0c, 0x00, 265 | 0x0c, 0x00, 266 | 0x00, 0x00, 267 | 0x00, 0x00, 268 | 0x00, 0x00, 269 | 0x00, 0x00, 270 | 0x00, 0x00, 271 | 272 | // Symbol: , Code: 44 Width: 10 273 | 0x00, 0x00, 274 | 0x00, 0x00, 275 | 0x00, 0x00, 276 | 0x00, 0x00, 277 | 0x00, 0x00, 278 | 0x00, 0x00, 279 | 0x00, 0x00, 280 | 0x00, 0x00, 281 | 0x00, 0x00, 282 | 0x00, 0x00, 283 | 0x00, 0x00, 284 | 0x00, 0x00, 285 | 0x00, 0x00, 286 | 0x18, 0x00, 287 | 0x18, 0x00, 288 | 0x18, 0x00, 289 | 0x10, 0x00, 290 | 0x10, 0x00, 291 | 0x00, 0x00, 292 | 293 | // Symbol: - Code: 45 Width: 10 294 | 0x00, 0x00, 295 | 0x00, 0x00, 296 | 0x00, 0x00, 297 | 0x00, 0x00, 298 | 0x00, 0x00, 299 | 0x00, 0x00, 300 | 0x00, 0x00, 301 | 0x00, 0x00, 302 | 0x3f, 0x00, 303 | 0x00, 0x00, 304 | 0x00, 0x00, 305 | 0x00, 0x00, 306 | 0x00, 0x00, 307 | 0x00, 0x00, 308 | 0x00, 0x00, 309 | 0x00, 0x00, 310 | 0x00, 0x00, 311 | 0x00, 0x00, 312 | 0x00, 0x00, 313 | 314 | // Symbol: . Code: 46 Width: 10 315 | 0x00, 0x00, 316 | 0x00, 0x00, 317 | 0x00, 0x00, 318 | 0x00, 0x00, 319 | 0x00, 0x00, 320 | 0x00, 0x00, 321 | 0x00, 0x00, 322 | 0x00, 0x00, 323 | 0x00, 0x00, 324 | 0x00, 0x00, 325 | 0x00, 0x00, 326 | 0x00, 0x00, 327 | 0x0c, 0x00, 328 | 0x0c, 0x00, 329 | 0x00, 0x00, 330 | 0x00, 0x00, 331 | 0x00, 0x00, 332 | 0x00, 0x00, 333 | 0x00, 0x00, 334 | 335 | // Symbol: / Code: 47 Width: 10 336 | 0x00, 0x00, 337 | 0x00, 0x00, 338 | 0x00, 0x00, 339 | 0x01, 0x00, 340 | 0x02, 0x00, 341 | 0x02, 0x00, 342 | 0x06, 0x00, 343 | 0x04, 0x00, 344 | 0x04, 0x00, 345 | 0x0c, 0x00, 346 | 0x08, 0x00, 347 | 0x08, 0x00, 348 | 0x18, 0x00, 349 | 0x10, 0x00, 350 | 0x10, 0x00, 351 | 0x20, 0x00, 352 | 0x00, 0x00, 353 | 0x00, 0x00, 354 | 0x00, 0x00, 355 | 356 | // Symbol: 0 Code: 48 Width: 10 357 | 0x00, 0x00, 358 | 0x00, 0x00, 359 | 0x00, 0x00, 360 | 0x1e, 0x00, 361 | 0x33, 0x00, 362 | 0x61, 0x00, 363 | 0x61, 0x00, 364 | 0x63, 0x00, 365 | 0x65, 0x80, 366 | 0x79, 0x80, 367 | 0x71, 0x00, 368 | 0x61, 0x00, 369 | 0x61, 0x00, 370 | 0x33, 0x00, 371 | 0x1e, 0x00, 372 | 0x00, 0x00, 373 | 0x00, 0x00, 374 | 0x00, 0x00, 375 | 0x00, 0x00, 376 | 377 | // Symbol: 1 Code: 49 Width: 10 378 | 0x00, 0x00, 379 | 0x00, 0x00, 380 | 0x00, 0x00, 381 | 0x04, 0x00, 382 | 0x3c, 0x00, 383 | 0x24, 0x00, 384 | 0x04, 0x00, 385 | 0x04, 0x00, 386 | 0x04, 0x00, 387 | 0x04, 0x00, 388 | 0x04, 0x00, 389 | 0x04, 0x00, 390 | 0x04, 0x00, 391 | 0x04, 0x00, 392 | 0x04, 0x00, 393 | 0x00, 0x00, 394 | 0x00, 0x00, 395 | 0x00, 0x00, 396 | 0x00, 0x00, 397 | 398 | // Symbol: 2 Code: 50 Width: 10 399 | 0x00, 0x00, 400 | 0x00, 0x00, 401 | 0x00, 0x00, 402 | 0x3c, 0x00, 403 | 0x66, 0x00, 404 | 0x43, 0x00, 405 | 0x43, 0x00, 406 | 0x03, 0x00, 407 | 0x02, 0x00, 408 | 0x04, 0x00, 409 | 0x0c, 0x00, 410 | 0x18, 0x00, 411 | 0x30, 0x00, 412 | 0x60, 0x00, 413 | 0x7f, 0x00, 414 | 0x00, 0x00, 415 | 0x00, 0x00, 416 | 0x00, 0x00, 417 | 0x00, 0x00, 418 | 419 | // Symbol: 3 Code: 51 Width: 10 420 | 0x00, 0x00, 421 | 0x00, 0x00, 422 | 0x00, 0x00, 423 | 0x3c, 0x00, 424 | 0x62, 0x00, 425 | 0x43, 0x00, 426 | 0x03, 0x00, 427 | 0x02, 0x00, 428 | 0x1c, 0x00, 429 | 0x06, 0x00, 430 | 0x03, 0x00, 431 | 0x03, 0x00, 432 | 0x43, 0x00, 433 | 0x62, 0x00, 434 | 0x3c, 0x00, 435 | 0x00, 0x00, 436 | 0x00, 0x00, 437 | 0x00, 0x00, 438 | 0x00, 0x00, 439 | 440 | // Symbol: 4 Code: 52 Width: 10 441 | 0x00, 0x00, 442 | 0x00, 0x00, 443 | 0x00, 0x00, 444 | 0x06, 0x00, 445 | 0x06, 0x00, 446 | 0x0e, 0x00, 447 | 0x0a, 0x00, 448 | 0x12, 0x00, 449 | 0x32, 0x00, 450 | 0x22, 0x00, 451 | 0x42, 0x00, 452 | 0x7f, 0x80, 453 | 0x02, 0x00, 454 | 0x02, 0x00, 455 | 0x02, 0x00, 456 | 0x00, 0x00, 457 | 0x00, 0x00, 458 | 0x00, 0x00, 459 | 0x00, 0x00, 460 | 461 | // Symbol: 5 Code: 53 Width: 10 462 | 0x00, 0x00, 463 | 0x00, 0x00, 464 | 0x00, 0x00, 465 | 0x3f, 0x00, 466 | 0x30, 0x00, 467 | 0x30, 0x00, 468 | 0x20, 0x00, 469 | 0x3e, 0x00, 470 | 0x33, 0x00, 471 | 0x01, 0x00, 472 | 0x01, 0x80, 473 | 0x41, 0x80, 474 | 0x21, 0x00, 475 | 0x33, 0x00, 476 | 0x1e, 0x00, 477 | 0x00, 0x00, 478 | 0x00, 0x00, 479 | 0x00, 0x00, 480 | 0x00, 0x00, 481 | 482 | // Symbol: 6 Code: 54 Width: 10 483 | 0x00, 0x00, 484 | 0x00, 0x00, 485 | 0x00, 0x00, 486 | 0x0e, 0x00, 487 | 0x18, 0x00, 488 | 0x30, 0x00, 489 | 0x20, 0x00, 490 | 0x7e, 0x00, 491 | 0x73, 0x00, 492 | 0x61, 0x00, 493 | 0x61, 0x00, 494 | 0x61, 0x00, 495 | 0x61, 0x00, 496 | 0x33, 0x00, 497 | 0x1e, 0x00, 498 | 0x00, 0x00, 499 | 0x00, 0x00, 500 | 0x00, 0x00, 501 | 0x00, 0x00, 502 | 503 | // Symbol: 7 Code: 55 Width: 10 504 | 0x00, 0x00, 505 | 0x00, 0x00, 506 | 0x00, 0x00, 507 | 0x7f, 0x80, 508 | 0x01, 0x00, 509 | 0x03, 0x00, 510 | 0x02, 0x00, 511 | 0x02, 0x00, 512 | 0x06, 0x00, 513 | 0x04, 0x00, 514 | 0x0c, 0x00, 515 | 0x08, 0x00, 516 | 0x18, 0x00, 517 | 0x10, 0x00, 518 | 0x30, 0x00, 519 | 0x00, 0x00, 520 | 0x00, 0x00, 521 | 0x00, 0x00, 522 | 0x00, 0x00, 523 | 524 | // Symbol: 8 Code: 56 Width: 10 525 | 0x00, 0x00, 526 | 0x00, 0x00, 527 | 0x00, 0x00, 528 | 0x1e, 0x00, 529 | 0x33, 0x00, 530 | 0x21, 0x00, 531 | 0x21, 0x00, 532 | 0x33, 0x00, 533 | 0x1e, 0x00, 534 | 0x33, 0x00, 535 | 0x21, 0x00, 536 | 0x61, 0x80, 537 | 0x61, 0x80, 538 | 0x33, 0x00, 539 | 0x1e, 0x00, 540 | 0x00, 0x00, 541 | 0x00, 0x00, 542 | 0x00, 0x00, 543 | 0x00, 0x00, 544 | 545 | // Symbol: 9 Code: 57 Width: 10 546 | 0x00, 0x00, 547 | 0x00, 0x00, 548 | 0x00, 0x00, 549 | 0x1e, 0x00, 550 | 0x32, 0x00, 551 | 0x63, 0x00, 552 | 0x61, 0x00, 553 | 0x61, 0x00, 554 | 0x61, 0x00, 555 | 0x23, 0x00, 556 | 0x3d, 0x00, 557 | 0x01, 0x00, 558 | 0x03, 0x00, 559 | 0x06, 0x00, 560 | 0x1c, 0x00, 561 | 0x00, 0x00, 562 | 0x00, 0x00, 563 | 0x00, 0x00, 564 | 0x00, 0x00, 565 | 566 | // Symbol: : Code: 58 Width: 10 567 | 0x00, 0x00, 568 | 0x00, 0x00, 569 | 0x00, 0x00, 570 | 0x00, 0x00, 571 | 0x00, 0x00, 572 | 0x0c, 0x00, 573 | 0x0c, 0x00, 574 | 0x00, 0x00, 575 | 0x00, 0x00, 576 | 0x00, 0x00, 577 | 0x00, 0x00, 578 | 0x00, 0x00, 579 | 0x0c, 0x00, 580 | 0x0c, 0x00, 581 | 0x00, 0x00, 582 | 0x00, 0x00, 583 | 0x00, 0x00, 584 | 0x00, 0x00, 585 | 0x00, 0x00, 586 | 587 | // Symbol: ; Code: 59 Width: 10 588 | 0x00, 0x00, 589 | 0x00, 0x00, 590 | 0x00, 0x00, 591 | 0x00, 0x00, 592 | 0x00, 0x00, 593 | 0x0c, 0x00, 594 | 0x00, 0x00, 595 | 0x00, 0x00, 596 | 0x00, 0x00, 597 | 0x00, 0x00, 598 | 0x00, 0x00, 599 | 0x0c, 0x00, 600 | 0x0c, 0x00, 601 | 0x0c, 0x00, 602 | 0x08, 0x00, 603 | 0x08, 0x00, 604 | 0x00, 0x00, 605 | 0x00, 0x00, 606 | 0x00, 0x00, 607 | 608 | // Symbol: < Code: 60 Width: 10 609 | 0x00, 0x00, 610 | 0x00, 0x00, 611 | 0x00, 0x00, 612 | 0x00, 0x00, 613 | 0x00, 0x00, 614 | 0x00, 0x00, 615 | 0x01, 0x00, 616 | 0x07, 0x00, 617 | 0x1e, 0x00, 618 | 0x70, 0x00, 619 | 0x70, 0x00, 620 | 0x0e, 0x00, 621 | 0x03, 0x00, 622 | 0x00, 0x00, 623 | 0x00, 0x00, 624 | 0x00, 0x00, 625 | 0x00, 0x00, 626 | 0x00, 0x00, 627 | 0x00, 0x00, 628 | 629 | // Symbol: = Code: 61 Width: 10 630 | 0x00, 0x00, 631 | 0x00, 0x00, 632 | 0x00, 0x00, 633 | 0x00, 0x00, 634 | 0x00, 0x00, 635 | 0x00, 0x00, 636 | 0x00, 0x00, 637 | 0x7f, 0x00, 638 | 0x00, 0x00, 639 | 0x00, 0x00, 640 | 0x7f, 0x00, 641 | 0x00, 0x00, 642 | 0x00, 0x00, 643 | 0x00, 0x00, 644 | 0x00, 0x00, 645 | 0x00, 0x00, 646 | 0x00, 0x00, 647 | 0x00, 0x00, 648 | 0x00, 0x00, 649 | 650 | // Symbol: > Code: 62 Width: 10 651 | 0x00, 0x00, 652 | 0x00, 0x00, 653 | 0x00, 0x00, 654 | 0x00, 0x00, 655 | 0x00, 0x00, 656 | 0x00, 0x00, 657 | 0x40, 0x00, 658 | 0x70, 0x00, 659 | 0x1c, 0x00, 660 | 0x03, 0x00, 661 | 0x07, 0x00, 662 | 0x1c, 0x00, 663 | 0x70, 0x00, 664 | 0x00, 0x00, 665 | 0x00, 0x00, 666 | 0x00, 0x00, 667 | 0x00, 0x00, 668 | 0x00, 0x00, 669 | 0x00, 0x00, 670 | 671 | // Symbol: ? Code: 63 Width: 10 672 | 0x00, 0x00, 673 | 0x00, 0x00, 674 | 0x00, 0x00, 675 | 0x1e, 0x00, 676 | 0x33, 0x00, 677 | 0x21, 0x00, 678 | 0x01, 0x00, 679 | 0x03, 0x00, 680 | 0x02, 0x00, 681 | 0x06, 0x00, 682 | 0x0c, 0x00, 683 | 0x08, 0x00, 684 | 0x00, 0x00, 685 | 0x00, 0x00, 686 | 0x0c, 0x00, 687 | 0x00, 0x00, 688 | 0x00, 0x00, 689 | 0x00, 0x00, 690 | 0x00, 0x00, 691 | 692 | // Symbol: @ Code: 64 Width: 10 693 | 0x00, 0x00, 694 | 0x00, 0x00, 695 | 0x00, 0x00, 696 | 0x1e, 0x00, 697 | 0x33, 0x00, 698 | 0x6e, 0x80, 699 | 0x5a, 0x80, 700 | 0x52, 0x80, 701 | 0x52, 0x80, 702 | 0x52, 0x80, 703 | 0x54, 0x80, 704 | 0x5b, 0x00, 705 | 0x40, 0x00, 706 | 0x22, 0x00, 707 | 0x1e, 0x00, 708 | 0x00, 0x00, 709 | 0x00, 0x00, 710 | 0x00, 0x00, 711 | 0x00, 0x00, 712 | 713 | // Symbol: A Code: 65 Width: 10 714 | 0x00, 0x00, 715 | 0x00, 0x00, 716 | 0x00, 0x00, 717 | 0x0c, 0x00, 718 | 0x0c, 0x00, 719 | 0x0c, 0x00, 720 | 0x1e, 0x00, 721 | 0x16, 0x00, 722 | 0x12, 0x00, 723 | 0x32, 0x00, 724 | 0x33, 0x00, 725 | 0x3f, 0x00, 726 | 0x61, 0x00, 727 | 0x61, 0x80, 728 | 0x40, 0x80, 729 | 0x00, 0x00, 730 | 0x00, 0x00, 731 | 0x00, 0x00, 732 | 0x00, 0x00, 733 | 734 | // Symbol: B Code: 66 Width: 10 735 | 0x00, 0x00, 736 | 0x00, 0x00, 737 | 0x00, 0x00, 738 | 0x7e, 0x00, 739 | 0x63, 0x00, 740 | 0x61, 0x00, 741 | 0x61, 0x00, 742 | 0x63, 0x00, 743 | 0x7e, 0x00, 744 | 0x63, 0x00, 745 | 0x61, 0x80, 746 | 0x61, 0x80, 747 | 0x61, 0x80, 748 | 0x63, 0x00, 749 | 0x7e, 0x00, 750 | 0x00, 0x00, 751 | 0x00, 0x00, 752 | 0x00, 0x00, 753 | 0x00, 0x00, 754 | 755 | // Symbol: C Code: 67 Width: 10 756 | 0x00, 0x00, 757 | 0x00, 0x00, 758 | 0x00, 0x00, 759 | 0x1e, 0x00, 760 | 0x33, 0x00, 761 | 0x61, 0x00, 762 | 0x41, 0x80, 763 | 0x40, 0x00, 764 | 0x40, 0x00, 765 | 0x40, 0x00, 766 | 0x40, 0x00, 767 | 0x41, 0x80, 768 | 0x61, 0x00, 769 | 0x33, 0x00, 770 | 0x1e, 0x00, 771 | 0x00, 0x00, 772 | 0x00, 0x00, 773 | 0x00, 0x00, 774 | 0x00, 0x00, 775 | 776 | // Symbol: D Code: 68 Width: 10 777 | 0x00, 0x00, 778 | 0x00, 0x00, 779 | 0x00, 0x00, 780 | 0x7c, 0x00, 781 | 0x67, 0x00, 782 | 0x61, 0x00, 783 | 0x61, 0x80, 784 | 0x61, 0x80, 785 | 0x61, 0x80, 786 | 0x61, 0x80, 787 | 0x61, 0x80, 788 | 0x61, 0x80, 789 | 0x61, 0x00, 790 | 0x67, 0x00, 791 | 0x7c, 0x00, 792 | 0x00, 0x00, 793 | 0x00, 0x00, 794 | 0x00, 0x00, 795 | 0x00, 0x00, 796 | 797 | // Symbol: E Code: 69 Width: 10 798 | 0x00, 0x00, 799 | 0x00, 0x00, 800 | 0x00, 0x00, 801 | 0x7f, 0x00, 802 | 0x60, 0x00, 803 | 0x60, 0x00, 804 | 0x60, 0x00, 805 | 0x60, 0x00, 806 | 0x7f, 0x00, 807 | 0x60, 0x00, 808 | 0x60, 0x00, 809 | 0x60, 0x00, 810 | 0x60, 0x00, 811 | 0x60, 0x00, 812 | 0x7f, 0x00, 813 | 0x00, 0x00, 814 | 0x00, 0x00, 815 | 0x00, 0x00, 816 | 0x00, 0x00, 817 | 818 | // Symbol: F Code: 70 Width: 10 819 | 0x00, 0x00, 820 | 0x00, 0x00, 821 | 0x00, 0x00, 822 | 0x3f, 0x00, 823 | 0x20, 0x00, 824 | 0x20, 0x00, 825 | 0x20, 0x00, 826 | 0x20, 0x00, 827 | 0x20, 0x00, 828 | 0x3f, 0x00, 829 | 0x20, 0x00, 830 | 0x20, 0x00, 831 | 0x20, 0x00, 832 | 0x20, 0x00, 833 | 0x20, 0x00, 834 | 0x00, 0x00, 835 | 0x00, 0x00, 836 | 0x00, 0x00, 837 | 0x00, 0x00, 838 | 839 | // Symbol: G Code: 71 Width: 10 840 | 0x00, 0x00, 841 | 0x00, 0x00, 842 | 0x00, 0x00, 843 | 0x1e, 0x00, 844 | 0x33, 0x00, 845 | 0x61, 0x80, 846 | 0x41, 0x80, 847 | 0x40, 0x00, 848 | 0x40, 0x00, 849 | 0x47, 0x80, 850 | 0x41, 0x80, 851 | 0x61, 0x80, 852 | 0x61, 0x80, 853 | 0x31, 0x80, 854 | 0x1e, 0x00, 855 | 0x00, 0x00, 856 | 0x00, 0x00, 857 | 0x00, 0x00, 858 | 0x00, 0x00, 859 | 860 | // Symbol: H Code: 72 Width: 10 861 | 0x00, 0x00, 862 | 0x00, 0x00, 863 | 0x00, 0x00, 864 | 0x41, 0x80, 865 | 0x41, 0x80, 866 | 0x41, 0x80, 867 | 0x41, 0x80, 868 | 0x41, 0x80, 869 | 0x7f, 0x80, 870 | 0x41, 0x80, 871 | 0x41, 0x80, 872 | 0x41, 0x80, 873 | 0x41, 0x80, 874 | 0x41, 0x80, 875 | 0x41, 0x80, 876 | 0x00, 0x00, 877 | 0x00, 0x00, 878 | 0x00, 0x00, 879 | 0x00, 0x00, 880 | 881 | // Symbol: I Code: 73 Width: 10 882 | 0x00, 0x00, 883 | 0x00, 0x00, 884 | 0x00, 0x00, 885 | 0x7f, 0x00, 886 | 0x0c, 0x00, 887 | 0x0c, 0x00, 888 | 0x0c, 0x00, 889 | 0x0c, 0x00, 890 | 0x0c, 0x00, 891 | 0x0c, 0x00, 892 | 0x0c, 0x00, 893 | 0x0c, 0x00, 894 | 0x0c, 0x00, 895 | 0x0c, 0x00, 896 | 0x7f, 0x00, 897 | 0x00, 0x00, 898 | 0x00, 0x00, 899 | 0x00, 0x00, 900 | 0x00, 0x00, 901 | 902 | // Symbol: J Code: 74 Width: 10 903 | 0x00, 0x00, 904 | 0x00, 0x00, 905 | 0x00, 0x00, 906 | 0x01, 0x00, 907 | 0x01, 0x00, 908 | 0x01, 0x00, 909 | 0x01, 0x00, 910 | 0x01, 0x00, 911 | 0x01, 0x00, 912 | 0x01, 0x00, 913 | 0x01, 0x00, 914 | 0x41, 0x00, 915 | 0x43, 0x00, 916 | 0x62, 0x00, 917 | 0x1c, 0x00, 918 | 0x00, 0x00, 919 | 0x00, 0x00, 920 | 0x00, 0x00, 921 | 0x00, 0x00, 922 | 923 | // Symbol: K Code: 75 Width: 10 924 | 0x00, 0x00, 925 | 0x00, 0x00, 926 | 0x00, 0x00, 927 | 0x61, 0x80, 928 | 0x63, 0x00, 929 | 0x66, 0x00, 930 | 0x64, 0x00, 931 | 0x6c, 0x00, 932 | 0x78, 0x00, 933 | 0x7c, 0x00, 934 | 0x64, 0x00, 935 | 0x66, 0x00, 936 | 0x63, 0x00, 937 | 0x61, 0x00, 938 | 0x61, 0x80, 939 | 0x00, 0x00, 940 | 0x00, 0x00, 941 | 0x00, 0x00, 942 | 0x00, 0x00, 943 | 944 | // Symbol: L Code: 76 Width: 10 945 | 0x00, 0x00, 946 | 0x00, 0x00, 947 | 0x00, 0x00, 948 | 0x20, 0x00, 949 | 0x20, 0x00, 950 | 0x20, 0x00, 951 | 0x20, 0x00, 952 | 0x20, 0x00, 953 | 0x20, 0x00, 954 | 0x20, 0x00, 955 | 0x20, 0x00, 956 | 0x20, 0x00, 957 | 0x20, 0x00, 958 | 0x20, 0x00, 959 | 0x3f, 0x80, 960 | 0x00, 0x00, 961 | 0x00, 0x00, 962 | 0x00, 0x00, 963 | 0x00, 0x00, 964 | 965 | // Symbol: M Code: 77 Width: 10 966 | 0x00, 0x00, 967 | 0x00, 0x00, 968 | 0x00, 0x00, 969 | 0x61, 0x80, 970 | 0x63, 0x80, 971 | 0x73, 0x80, 972 | 0x53, 0x80, 973 | 0x57, 0x80, 974 | 0x7d, 0x80, 975 | 0x6d, 0x80, 976 | 0x6d, 0x80, 977 | 0x69, 0x80, 978 | 0x61, 0x80, 979 | 0x61, 0x80, 980 | 0x61, 0x80, 981 | 0x00, 0x00, 982 | 0x00, 0x00, 983 | 0x00, 0x00, 984 | 0x00, 0x00, 985 | 986 | // Symbol: N Code: 78 Width: 10 987 | 0x00, 0x00, 988 | 0x00, 0x00, 989 | 0x00, 0x00, 990 | 0x61, 0x00, 991 | 0x61, 0x00, 992 | 0x71, 0x00, 993 | 0x71, 0x00, 994 | 0x79, 0x00, 995 | 0x69, 0x00, 996 | 0x6d, 0x00, 997 | 0x65, 0x00, 998 | 0x67, 0x00, 999 | 0x63, 0x00, 1000 | 0x63, 0x00, 1001 | 0x61, 0x00, 1002 | 0x00, 0x00, 1003 | 0x00, 0x00, 1004 | 0x00, 0x00, 1005 | 0x00, 0x00, 1006 | 1007 | // Symbol: O Code: 79 Width: 10 1008 | 0x00, 0x00, 1009 | 0x00, 0x00, 1010 | 0x00, 0x00, 1011 | 0x1e, 0x00, 1012 | 0x33, 0x00, 1013 | 0x61, 0x00, 1014 | 0x41, 0x80, 1015 | 0x41, 0x80, 1016 | 0x41, 0x80, 1017 | 0x41, 0x80, 1018 | 0x41, 0x80, 1019 | 0x41, 0x80, 1020 | 0x61, 0x00, 1021 | 0x33, 0x00, 1022 | 0x1e, 0x00, 1023 | 0x00, 0x00, 1024 | 0x00, 0x00, 1025 | 0x00, 0x00, 1026 | 0x00, 0x00, 1027 | 1028 | // Symbol: P Code: 80 Width: 10 1029 | 0x00, 0x00, 1030 | 0x00, 0x00, 1031 | 0x00, 0x00, 1032 | 0x3e, 0x00, 1033 | 0x23, 0x00, 1034 | 0x21, 0x80, 1035 | 0x21, 0x80, 1036 | 0x21, 0x80, 1037 | 0x21, 0x00, 1038 | 0x3f, 0x00, 1039 | 0x20, 0x00, 1040 | 0x20, 0x00, 1041 | 0x20, 0x00, 1042 | 0x20, 0x00, 1043 | 0x20, 0x00, 1044 | 0x00, 0x00, 1045 | 0x00, 0x00, 1046 | 0x00, 0x00, 1047 | 0x00, 0x00, 1048 | 1049 | // Symbol: Q Code: 81 Width: 10 1050 | 0x00, 0x00, 1051 | 0x00, 0x00, 1052 | 0x00, 0x00, 1053 | 0x1e, 0x00, 1054 | 0x33, 0x00, 1055 | 0x61, 0x00, 1056 | 0x41, 0x80, 1057 | 0x41, 0x80, 1058 | 0x41, 0x80, 1059 | 0x41, 0x80, 1060 | 0x41, 0x80, 1061 | 0x41, 0x80, 1062 | 0x61, 0x00, 1063 | 0x33, 0x00, 1064 | 0x1e, 0x00, 1065 | 0x01, 0x80, 1066 | 0x00, 0x80, 1067 | 0x00, 0x00, 1068 | 0x00, 0x00, 1069 | 1070 | // Symbol: R Code: 82 Width: 10 1071 | 0x00, 0x00, 1072 | 0x00, 0x00, 1073 | 0x00, 0x00, 1074 | 0x7e, 0x00, 1075 | 0x63, 0x00, 1076 | 0x61, 0x00, 1077 | 0x61, 0x80, 1078 | 0x61, 0x80, 1079 | 0x63, 0x00, 1080 | 0x7e, 0x00, 1081 | 0x66, 0x00, 1082 | 0x62, 0x00, 1083 | 0x63, 0x00, 1084 | 0x61, 0x00, 1085 | 0x61, 0x80, 1086 | 0x00, 0x00, 1087 | 0x00, 0x00, 1088 | 0x00, 0x00, 1089 | 0x00, 0x00, 1090 | 1091 | // Symbol: S Code: 83 Width: 10 1092 | 0x00, 0x00, 1093 | 0x00, 0x00, 1094 | 0x00, 0x00, 1095 | 0x1e, 0x00, 1096 | 0x33, 0x00, 1097 | 0x61, 0x80, 1098 | 0x60, 0x00, 1099 | 0x30, 0x00, 1100 | 0x3c, 0x00, 1101 | 0x0f, 0x00, 1102 | 0x01, 0x80, 1103 | 0x41, 0x80, 1104 | 0x61, 0x80, 1105 | 0x33, 0x00, 1106 | 0x1e, 0x00, 1107 | 0x00, 0x00, 1108 | 0x00, 0x00, 1109 | 0x00, 0x00, 1110 | 0x00, 0x00, 1111 | 1112 | // Symbol: T Code: 84 Width: 10 1113 | 0x00, 0x00, 1114 | 0x00, 0x00, 1115 | 0x00, 0x00, 1116 | 0x7f, 0x80, 1117 | 0x0c, 0x00, 1118 | 0x0c, 0x00, 1119 | 0x0c, 0x00, 1120 | 0x0c, 0x00, 1121 | 0x0c, 0x00, 1122 | 0x0c, 0x00, 1123 | 0x0c, 0x00, 1124 | 0x0c, 0x00, 1125 | 0x0c, 0x00, 1126 | 0x0c, 0x00, 1127 | 0x0c, 0x00, 1128 | 0x00, 0x00, 1129 | 0x00, 0x00, 1130 | 0x00, 0x00, 1131 | 0x00, 0x00, 1132 | 1133 | // Symbol: U Code: 85 Width: 10 1134 | 0x00, 0x00, 1135 | 0x00, 0x00, 1136 | 0x00, 0x00, 1137 | 0x41, 0x80, 1138 | 0x41, 0x80, 1139 | 0x41, 0x80, 1140 | 0x41, 0x80, 1141 | 0x61, 0x80, 1142 | 0x61, 0x80, 1143 | 0x61, 0x80, 1144 | 0x61, 0x80, 1145 | 0x61, 0x00, 1146 | 0x61, 0x00, 1147 | 0x33, 0x00, 1148 | 0x1e, 0x00, 1149 | 0x00, 0x00, 1150 | 0x00, 0x00, 1151 | 0x00, 0x00, 1152 | 0x00, 0x00, 1153 | 1154 | // Symbol: V Code: 86 Width: 10 1155 | 0x00, 0x00, 1156 | 0x00, 0x00, 1157 | 0x00, 0x00, 1158 | 0x41, 0x80, 1159 | 0x61, 0x80, 1160 | 0x61, 0x00, 1161 | 0x23, 0x00, 1162 | 0x23, 0x00, 1163 | 0x32, 0x00, 1164 | 0x12, 0x00, 1165 | 0x16, 0x00, 1166 | 0x1c, 0x00, 1167 | 0x1c, 0x00, 1168 | 0x0c, 0x00, 1169 | 0x0c, 0x00, 1170 | 0x00, 0x00, 1171 | 0x00, 0x00, 1172 | 0x00, 0x00, 1173 | 0x00, 0x00, 1174 | 1175 | // Symbol: W Code: 87 Width: 10 1176 | 0x00, 0x00, 1177 | 0x00, 0x00, 1178 | 0x00, 0x00, 1179 | 0x4c, 0x80, 1180 | 0x4c, 0x80, 1181 | 0x4c, 0x80, 1182 | 0x4c, 0x80, 1183 | 0x4d, 0x80, 1184 | 0x5f, 0x80, 1185 | 0x77, 0x00, 1186 | 0x73, 0x00, 1187 | 0x33, 0x00, 1188 | 0x33, 0x00, 1189 | 0x33, 0x00, 1190 | 0x33, 0x00, 1191 | 0x00, 0x00, 1192 | 0x00, 0x00, 1193 | 0x00, 0x00, 1194 | 0x00, 0x00, 1195 | 1196 | // Symbol: X Code: 88 Width: 10 1197 | 0x00, 0x00, 1198 | 0x00, 0x00, 1199 | 0x00, 0x00, 1200 | 0x61, 0x80, 1201 | 0x21, 0x00, 1202 | 0x33, 0x00, 1203 | 0x16, 0x00, 1204 | 0x1e, 0x00, 1205 | 0x0c, 0x00, 1206 | 0x0c, 0x00, 1207 | 0x1e, 0x00, 1208 | 0x12, 0x00, 1209 | 0x33, 0x00, 1210 | 0x21, 0x00, 1211 | 0x61, 0x80, 1212 | 0x00, 0x00, 1213 | 0x00, 0x00, 1214 | 0x00, 0x00, 1215 | 0x00, 0x00, 1216 | 1217 | // Symbol: Y Code: 89 Width: 10 1218 | 0x00, 0x00, 1219 | 0x00, 0x00, 1220 | 0x00, 0x00, 1221 | 0xc1, 0x80, 1222 | 0x61, 0x00, 1223 | 0x23, 0x00, 1224 | 0x32, 0x00, 1225 | 0x16, 0x00, 1226 | 0x1c, 0x00, 1227 | 0x0c, 0x00, 1228 | 0x08, 0x00, 1229 | 0x08, 0x00, 1230 | 0x08, 0x00, 1231 | 0x08, 0x00, 1232 | 0x08, 0x00, 1233 | 0x00, 0x00, 1234 | 0x00, 0x00, 1235 | 0x00, 0x00, 1236 | 0x00, 0x00, 1237 | 1238 | // Symbol: Z Code: 90 Width: 10 1239 | 0x00, 0x00, 1240 | 0x00, 0x00, 1241 | 0x00, 0x00, 1242 | 0x7f, 0x00, 1243 | 0x03, 0x00, 1244 | 0x02, 0x00, 1245 | 0x06, 0x00, 1246 | 0x04, 0x00, 1247 | 0x0c, 0x00, 1248 | 0x18, 0x00, 1249 | 0x10, 0x00, 1250 | 0x30, 0x00, 1251 | 0x20, 0x00, 1252 | 0x60, 0x00, 1253 | 0x7f, 0x00, 1254 | 0x00, 0x00, 1255 | 0x00, 0x00, 1256 | 0x00, 0x00, 1257 | 0x00, 0x00, 1258 | 1259 | // Symbol: [ Code: 91 Width: 10 1260 | 0x1c, 0x00, 1261 | 0x18, 0x00, 1262 | 0x18, 0x00, 1263 | 0x18, 0x00, 1264 | 0x18, 0x00, 1265 | 0x18, 0x00, 1266 | 0x18, 0x00, 1267 | 0x18, 0x00, 1268 | 0x18, 0x00, 1269 | 0x18, 0x00, 1270 | 0x18, 0x00, 1271 | 0x18, 0x00, 1272 | 0x18, 0x00, 1273 | 0x18, 0x00, 1274 | 0x18, 0x00, 1275 | 0x1c, 0x00, 1276 | 0x00, 0x00, 1277 | 0x00, 0x00, 1278 | 0x00, 0x00, 1279 | 1280 | // Symbol: \ Code: 92 Width: 10 1281 | 0x00, 0x00, 1282 | 0x00, 0x00, 1283 | 0x00, 0x00, 1284 | 0x20, 0x00, 1285 | 0x30, 0x00, 1286 | 0x10, 0x00, 1287 | 0x10, 0x00, 1288 | 0x18, 0x00, 1289 | 0x08, 0x00, 1290 | 0x08, 0x00, 1291 | 0x04, 0x00, 1292 | 0x04, 0x00, 1293 | 0x06, 0x00, 1294 | 0x02, 0x00, 1295 | 0x02, 0x00, 1296 | 0x03, 0x00, 1297 | 0x00, 0x00, 1298 | 0x00, 0x00, 1299 | 0x00, 0x00, 1300 | 1301 | // Symbol: ] Code: 93 Width: 10 1302 | 0x1c, 0x00, 1303 | 0x04, 0x00, 1304 | 0x04, 0x00, 1305 | 0x04, 0x00, 1306 | 0x04, 0x00, 1307 | 0x04, 0x00, 1308 | 0x04, 0x00, 1309 | 0x04, 0x00, 1310 | 0x04, 0x00, 1311 | 0x04, 0x00, 1312 | 0x04, 0x00, 1313 | 0x04, 0x00, 1314 | 0x04, 0x00, 1315 | 0x04, 0x00, 1316 | 0x04, 0x00, 1317 | 0x1c, 0x00, 1318 | 0x00, 0x00, 1319 | 0x00, 0x00, 1320 | 0x00, 0x00, 1321 | 1322 | // Symbol: ^ Code: 94 Width: 10 1323 | 0x00, 0x00, 1324 | 0x00, 0x00, 1325 | 0x00, 0x00, 1326 | 0x08, 0x00, 1327 | 0x0c, 0x00, 1328 | 0x1c, 0x00, 1329 | 0x16, 0x00, 1330 | 0x12, 0x00, 1331 | 0x33, 0x00, 1332 | 0x00, 0x00, 1333 | 0x00, 0x00, 1334 | 0x00, 0x00, 1335 | 0x00, 0x00, 1336 | 0x00, 0x00, 1337 | 0x00, 0x00, 1338 | 0x00, 0x00, 1339 | 0x00, 0x00, 1340 | 0x00, 0x00, 1341 | 0x00, 0x00, 1342 | 1343 | // Symbol: _ Code: 95 Width: 10 1344 | 0x00, 0x00, 1345 | 0x00, 0x00, 1346 | 0x00, 0x00, 1347 | 0x00, 0x00, 1348 | 0x00, 0x00, 1349 | 0x00, 0x00, 1350 | 0x00, 0x00, 1351 | 0x00, 0x00, 1352 | 0x00, 0x00, 1353 | 0x00, 0x00, 1354 | 0x00, 0x00, 1355 | 0x00, 0x00, 1356 | 0x00, 0x00, 1357 | 0x00, 0x00, 1358 | 0x7f, 0x00, 1359 | 0x00, 0x00, 1360 | 0x00, 0x00, 1361 | 0x00, 0x00, 1362 | 0x00, 0x00, 1363 | 1364 | // Symbol: ` Code: 96 Width: 10 1365 | 0x00, 0x00, 1366 | 0x00, 0x00, 1367 | 0x00, 0x00, 1368 | 0x18, 0x00, 1369 | 0x04, 0x00, 1370 | 0x00, 0x00, 1371 | 0x00, 0x00, 1372 | 0x00, 0x00, 1373 | 0x00, 0x00, 1374 | 0x00, 0x00, 1375 | 0x00, 0x00, 1376 | 0x00, 0x00, 1377 | 0x00, 0x00, 1378 | 0x00, 0x00, 1379 | 0x00, 0x00, 1380 | 0x00, 0x00, 1381 | 0x00, 0x00, 1382 | 0x00, 0x00, 1383 | 0x00, 0x00, 1384 | 1385 | // Symbol: a Code: 97 Width: 10 1386 | 0x00, 0x00, 1387 | 0x00, 0x00, 1388 | 0x00, 0x00, 1389 | 0x00, 0x00, 1390 | 0x00, 0x00, 1391 | 0x00, 0x00, 1392 | 0x1e, 0x00, 1393 | 0x63, 0x00, 1394 | 0x01, 0x00, 1395 | 0x1f, 0x00, 1396 | 0x31, 0x00, 1397 | 0x61, 0x00, 1398 | 0x61, 0x00, 1399 | 0x27, 0x00, 1400 | 0x3d, 0x00, 1401 | 0x00, 0x00, 1402 | 0x00, 0x00, 1403 | 0x00, 0x00, 1404 | 0x00, 0x00, 1405 | 1406 | // Symbol: b Code: 98 Width: 10 1407 | 0x00, 0x00, 1408 | 0x00, 0x00, 1409 | 0x00, 0x00, 1410 | 0x60, 0x00, 1411 | 0x60, 0x00, 1412 | 0x60, 0x00, 1413 | 0x7e, 0x00, 1414 | 0x73, 0x00, 1415 | 0x61, 0x00, 1416 | 0x61, 0x00, 1417 | 0x61, 0x80, 1418 | 0x61, 0x00, 1419 | 0x61, 0x00, 1420 | 0x73, 0x00, 1421 | 0x7e, 0x00, 1422 | 0x00, 0x00, 1423 | 0x00, 0x00, 1424 | 0x00, 0x00, 1425 | 0x00, 0x00, 1426 | 1427 | // Symbol: c Code: 99 Width: 10 1428 | 0x00, 0x00, 1429 | 0x00, 0x00, 1430 | 0x00, 0x00, 1431 | 0x00, 0x00, 1432 | 0x00, 0x00, 1433 | 0x00, 0x00, 1434 | 0x1e, 0x00, 1435 | 0x33, 0x00, 1436 | 0x61, 0x00, 1437 | 0x60, 0x00, 1438 | 0x60, 0x00, 1439 | 0x60, 0x00, 1440 | 0x61, 0x00, 1441 | 0x33, 0x00, 1442 | 0x1e, 0x00, 1443 | 0x00, 0x00, 1444 | 0x00, 0x00, 1445 | 0x00, 0x00, 1446 | 0x00, 0x00, 1447 | 1448 | // Symbol: d Code: 100 Width: 10 1449 | 0x00, 0x00, 1450 | 0x00, 0x00, 1451 | 0x00, 0x00, 1452 | 0x01, 0x00, 1453 | 0x01, 0x00, 1454 | 0x01, 0x00, 1455 | 0x1d, 0x00, 1456 | 0x33, 0x00, 1457 | 0x61, 0x00, 1458 | 0x61, 0x00, 1459 | 0x61, 0x00, 1460 | 0x61, 0x00, 1461 | 0x61, 0x00, 1462 | 0x33, 0x00, 1463 | 0x1d, 0x00, 1464 | 0x00, 0x00, 1465 | 0x00, 0x00, 1466 | 0x00, 0x00, 1467 | 0x00, 0x00, 1468 | 1469 | // Symbol: e Code: 101 Width: 10 1470 | 0x00, 0x00, 1471 | 0x00, 0x00, 1472 | 0x00, 0x00, 1473 | 0x00, 0x00, 1474 | 0x00, 0x00, 1475 | 0x00, 0x00, 1476 | 0x1e, 0x00, 1477 | 0x33, 0x00, 1478 | 0x61, 0x00, 1479 | 0x61, 0x00, 1480 | 0x7f, 0x80, 1481 | 0x60, 0x00, 1482 | 0x60, 0x00, 1483 | 0x31, 0x00, 1484 | 0x1e, 0x00, 1485 | 0x00, 0x00, 1486 | 0x00, 0x00, 1487 | 0x00, 0x00, 1488 | 0x00, 0x00, 1489 | 1490 | // Symbol: f Code: 102 Width: 10 1491 | 0x00, 0x00, 1492 | 0x07, 0x80, 1493 | 0x0c, 0x80, 1494 | 0x08, 0x00, 1495 | 0x08, 0x00, 1496 | 0x7f, 0x00, 1497 | 0x08, 0x00, 1498 | 0x08, 0x00, 1499 | 0x08, 0x00, 1500 | 0x08, 0x00, 1501 | 0x08, 0x00, 1502 | 0x08, 0x00, 1503 | 0x08, 0x00, 1504 | 0x08, 0x00, 1505 | 0x00, 0x00, 1506 | 0x00, 0x00, 1507 | 0x00, 0x00, 1508 | 0x00, 0x00, 1509 | 0x00, 0x00, 1510 | 1511 | // Symbol: g Code: 103 Width: 10 1512 | 0x00, 0x00, 1513 | 0x00, 0x00, 1514 | 0x00, 0x00, 1515 | 0x00, 0x00, 1516 | 0x00, 0x00, 1517 | 0x00, 0x00, 1518 | 0x1d, 0x00, 1519 | 0x33, 0x00, 1520 | 0x61, 0x00, 1521 | 0x61, 0x00, 1522 | 0x61, 0x00, 1523 | 0x61, 0x00, 1524 | 0x61, 0x00, 1525 | 0x33, 0x00, 1526 | 0x1d, 0x00, 1527 | 0x01, 0x00, 1528 | 0x23, 0x00, 1529 | 0x1e, 0x00, 1530 | 0x00, 0x00, 1531 | 1532 | // Symbol: h Code: 104 Width: 10 1533 | 0x00, 0x00, 1534 | 0x00, 0x00, 1535 | 0x00, 0x00, 1536 | 0x60, 0x00, 1537 | 0x60, 0x00, 1538 | 0x60, 0x00, 1539 | 0x6e, 0x00, 1540 | 0x73, 0x00, 1541 | 0x61, 0x00, 1542 | 0x61, 0x00, 1543 | 0x61, 0x00, 1544 | 0x61, 0x00, 1545 | 0x61, 0x00, 1546 | 0x61, 0x00, 1547 | 0x61, 0x00, 1548 | 0x00, 0x00, 1549 | 0x00, 0x00, 1550 | 0x00, 0x00, 1551 | 0x00, 0x00, 1552 | 1553 | // Symbol: i Code: 105 Width: 10 1554 | 0x00, 0x00, 1555 | 0x00, 0x00, 1556 | 0x00, 0x00, 1557 | 0x0c, 0x00, 1558 | 0x00, 0x00, 1559 | 0x00, 0x00, 1560 | 0x3c, 0x00, 1561 | 0x0c, 0x00, 1562 | 0x0c, 0x00, 1563 | 0x0c, 0x00, 1564 | 0x0c, 0x00, 1565 | 0x0c, 0x00, 1566 | 0x0c, 0x00, 1567 | 0x0c, 0x00, 1568 | 0x3f, 0x80, 1569 | 0x00, 0x00, 1570 | 0x00, 0x00, 1571 | 0x00, 0x00, 1572 | 0x00, 0x00, 1573 | 1574 | // Symbol: j Code: 106 Width: 10 1575 | 0x00, 0x00, 1576 | 0x00, 0x00, 1577 | 0x00, 0x00, 1578 | 0x06, 0x00, 1579 | 0x00, 0x00, 1580 | 0x00, 0x00, 1581 | 0x3e, 0x00, 1582 | 0x06, 0x00, 1583 | 0x06, 0x00, 1584 | 0x06, 0x00, 1585 | 0x06, 0x00, 1586 | 0x06, 0x00, 1587 | 0x06, 0x00, 1588 | 0x06, 0x00, 1589 | 0x06, 0x00, 1590 | 0x06, 0x00, 1591 | 0x0c, 0x00, 1592 | 0x38, 0x00, 1593 | 0x00, 0x00, 1594 | 1595 | // Symbol: k Code: 107 Width: 10 1596 | 0x00, 0x00, 1597 | 0x00, 0x00, 1598 | 0x00, 0x00, 1599 | 0x60, 0x00, 1600 | 0x60, 0x00, 1601 | 0x60, 0x00, 1602 | 0x63, 0x00, 1603 | 0x66, 0x00, 1604 | 0x6c, 0x00, 1605 | 0x78, 0x00, 1606 | 0x78, 0x00, 1607 | 0x6c, 0x00, 1608 | 0x66, 0x00, 1609 | 0x63, 0x00, 1610 | 0x61, 0x80, 1611 | 0x00, 0x00, 1612 | 0x00, 0x00, 1613 | 0x00, 0x00, 1614 | 0x00, 0x00, 1615 | 1616 | // Symbol: l Code: 108 Width: 10 1617 | 0x00, 0x00, 1618 | 0x00, 0x00, 1619 | 0x00, 0x00, 1620 | 0x3c, 0x00, 1621 | 0x0c, 0x00, 1622 | 0x0c, 0x00, 1623 | 0x0c, 0x00, 1624 | 0x0c, 0x00, 1625 | 0x0c, 0x00, 1626 | 0x0c, 0x00, 1627 | 0x0c, 0x00, 1628 | 0x0c, 0x00, 1629 | 0x0c, 0x00, 1630 | 0x0c, 0x00, 1631 | 0x3f, 0x80, 1632 | 0x00, 0x00, 1633 | 0x00, 0x00, 1634 | 0x00, 0x00, 1635 | 0x00, 0x00, 1636 | 1637 | // Symbol: m Code: 109 Width: 10 1638 | 0x00, 0x00, 1639 | 0x00, 0x00, 1640 | 0x00, 0x00, 1641 | 0x00, 0x00, 1642 | 0x00, 0x00, 1643 | 0x00, 0x00, 1644 | 0x7b, 0x00, 1645 | 0x4d, 0x80, 1646 | 0x4c, 0x80, 1647 | 0x4c, 0x80, 1648 | 0x4c, 0x80, 1649 | 0x4c, 0x80, 1650 | 0x4c, 0x80, 1651 | 0x4c, 0x80, 1652 | 0x4c, 0x80, 1653 | 0x00, 0x00, 1654 | 0x00, 0x00, 1655 | 0x00, 0x00, 1656 | 0x00, 0x00, 1657 | 1658 | // Symbol: n Code: 110 Width: 10 1659 | 0x00, 0x00, 1660 | 0x00, 0x00, 1661 | 0x00, 0x00, 1662 | 0x00, 0x00, 1663 | 0x00, 0x00, 1664 | 0x00, 0x00, 1665 | 0x6e, 0x00, 1666 | 0x73, 0x00, 1667 | 0x61, 0x00, 1668 | 0x61, 0x00, 1669 | 0x61, 0x00, 1670 | 0x61, 0x00, 1671 | 0x61, 0x00, 1672 | 0x61, 0x00, 1673 | 0x61, 0x00, 1674 | 0x00, 0x00, 1675 | 0x00, 0x00, 1676 | 0x00, 0x00, 1677 | 0x00, 0x00, 1678 | 1679 | // Symbol: o Code: 111 Width: 10 1680 | 0x00, 0x00, 1681 | 0x00, 0x00, 1682 | 0x00, 0x00, 1683 | 0x00, 0x00, 1684 | 0x00, 0x00, 1685 | 0x00, 0x00, 1686 | 0x1e, 0x00, 1687 | 0x33, 0x00, 1688 | 0x61, 0x00, 1689 | 0x41, 0x80, 1690 | 0x41, 0x80, 1691 | 0x41, 0x80, 1692 | 0x61, 0x00, 1693 | 0x33, 0x00, 1694 | 0x1e, 0x00, 1695 | 0x00, 0x00, 1696 | 0x00, 0x00, 1697 | 0x00, 0x00, 1698 | 0x00, 0x00, 1699 | 1700 | // Symbol: p Code: 112 Width: 10 1701 | 0x00, 0x00, 1702 | 0x00, 0x00, 1703 | 0x00, 0x00, 1704 | 0x00, 0x00, 1705 | 0x00, 0x00, 1706 | 0x00, 0x00, 1707 | 0x7e, 0x00, 1708 | 0x73, 0x00, 1709 | 0x61, 0x00, 1710 | 0x61, 0x00, 1711 | 0x61, 0x80, 1712 | 0x61, 0x00, 1713 | 0x61, 0x00, 1714 | 0x73, 0x00, 1715 | 0x7e, 0x00, 1716 | 0x60, 0x00, 1717 | 0x60, 0x00, 1718 | 0x60, 0x00, 1719 | 0x00, 0x00, 1720 | 1721 | // Symbol: q Code: 113 Width: 10 1722 | 0x00, 0x00, 1723 | 0x00, 0x00, 1724 | 0x00, 0x00, 1725 | 0x00, 0x00, 1726 | 0x00, 0x00, 1727 | 0x00, 0x00, 1728 | 0x1d, 0x00, 1729 | 0x33, 0x00, 1730 | 0x61, 0x00, 1731 | 0x61, 0x00, 1732 | 0x61, 0x00, 1733 | 0x61, 0x00, 1734 | 0x61, 0x00, 1735 | 0x33, 0x00, 1736 | 0x1d, 0x00, 1737 | 0x01, 0x00, 1738 | 0x01, 0x00, 1739 | 0x01, 0x00, 1740 | 0x00, 0x00, 1741 | 1742 | // Symbol: r Code: 114 Width: 10 1743 | 0x00, 0x00, 1744 | 0x00, 0x00, 1745 | 0x00, 0x00, 1746 | 0x00, 0x00, 1747 | 0x00, 0x00, 1748 | 0x00, 0x00, 1749 | 0x17, 0x00, 1750 | 0x18, 0x00, 1751 | 0x10, 0x00, 1752 | 0x10, 0x00, 1753 | 0x10, 0x00, 1754 | 0x10, 0x00, 1755 | 0x10, 0x00, 1756 | 0x10, 0x00, 1757 | 0x10, 0x00, 1758 | 0x00, 0x00, 1759 | 0x00, 0x00, 1760 | 0x00, 0x00, 1761 | 0x00, 0x00, 1762 | 1763 | // Symbol: s Code: 115 Width: 10 1764 | 0x00, 0x00, 1765 | 0x00, 0x00, 1766 | 0x00, 0x00, 1767 | 0x00, 0x00, 1768 | 0x00, 0x00, 1769 | 0x00, 0x00, 1770 | 0x1e, 0x00, 1771 | 0x33, 0x00, 1772 | 0x21, 0x00, 1773 | 0x30, 0x00, 1774 | 0x1e, 0x00, 1775 | 0x03, 0x00, 1776 | 0x61, 0x00, 1777 | 0x33, 0x00, 1778 | 0x1e, 0x00, 1779 | 0x00, 0x00, 1780 | 0x00, 0x00, 1781 | 0x00, 0x00, 1782 | 0x00, 0x00, 1783 | 1784 | // Symbol: t Code: 116 Width: 10 1785 | 0x00, 0x00, 1786 | 0x00, 0x00, 1787 | 0x00, 0x00, 1788 | 0x00, 0x00, 1789 | 0x18, 0x00, 1790 | 0x18, 0x00, 1791 | 0x7f, 0x00, 1792 | 0x18, 0x00, 1793 | 0x18, 0x00, 1794 | 0x18, 0x00, 1795 | 0x18, 0x00, 1796 | 0x18, 0x00, 1797 | 0x18, 0x00, 1798 | 0x08, 0x00, 1799 | 0x0f, 0x00, 1800 | 0x00, 0x00, 1801 | 0x00, 0x00, 1802 | 0x00, 0x00, 1803 | 0x00, 0x00, 1804 | 1805 | // Symbol: u Code: 117 Width: 10 1806 | 0x00, 0x00, 1807 | 0x00, 0x00, 1808 | 0x00, 0x00, 1809 | 0x00, 0x00, 1810 | 0x00, 0x00, 1811 | 0x00, 0x00, 1812 | 0x61, 0x00, 1813 | 0x61, 0x00, 1814 | 0x61, 0x00, 1815 | 0x61, 0x00, 1816 | 0x61, 0x00, 1817 | 0x61, 0x00, 1818 | 0x21, 0x00, 1819 | 0x33, 0x00, 1820 | 0x1d, 0x00, 1821 | 0x00, 0x00, 1822 | 0x00, 0x00, 1823 | 0x00, 0x00, 1824 | 0x00, 0x00, 1825 | 1826 | // Symbol: v Code: 118 Width: 10 1827 | 0x00, 0x00, 1828 | 0x00, 0x00, 1829 | 0x00, 0x00, 1830 | 0x00, 0x00, 1831 | 0x00, 0x00, 1832 | 0x00, 0x00, 1833 | 0x41, 0x80, 1834 | 0x61, 0x00, 1835 | 0x23, 0x00, 1836 | 0x22, 0x00, 1837 | 0x12, 0x00, 1838 | 0x16, 0x00, 1839 | 0x1c, 0x00, 1840 | 0x0c, 0x00, 1841 | 0x0c, 0x00, 1842 | 0x00, 0x00, 1843 | 0x00, 0x00, 1844 | 0x00, 0x00, 1845 | 0x00, 0x00, 1846 | 1847 | // Symbol: w Code: 119 Width: 10 1848 | 0x00, 0x00, 1849 | 0x00, 0x00, 1850 | 0x00, 0x00, 1851 | 0x00, 0x00, 1852 | 0x00, 0x00, 1853 | 0x00, 0x00, 1854 | 0xc8, 0x80, 1855 | 0x4c, 0x80, 1856 | 0x4c, 0x80, 1857 | 0x4d, 0x80, 1858 | 0x55, 0x00, 1859 | 0x73, 0x00, 1860 | 0x33, 0x00, 1861 | 0x33, 0x00, 1862 | 0x23, 0x00, 1863 | 0x00, 0x00, 1864 | 0x00, 0x00, 1865 | 0x00, 0x00, 1866 | 0x00, 0x00, 1867 | 1868 | // Symbol: x Code: 120 Width: 10 1869 | 0x00, 0x00, 1870 | 0x00, 0x00, 1871 | 0x00, 0x00, 1872 | 0x00, 0x00, 1873 | 0x00, 0x00, 1874 | 0x00, 0x00, 1875 | 0x61, 0x80, 1876 | 0x33, 0x00, 1877 | 0x16, 0x00, 1878 | 0x1c, 0x00, 1879 | 0x0c, 0x00, 1880 | 0x1c, 0x00, 1881 | 0x12, 0x00, 1882 | 0x33, 0x00, 1883 | 0x61, 0x80, 1884 | 0x00, 0x00, 1885 | 0x00, 0x00, 1886 | 0x00, 0x00, 1887 | 0x00, 0x00, 1888 | 1889 | // Symbol: y Code: 121 Width: 10 1890 | 0x00, 0x00, 1891 | 0x00, 0x00, 1892 | 0x00, 0x00, 1893 | 0x00, 0x00, 1894 | 0x00, 0x00, 1895 | 0x00, 0x00, 1896 | 0x41, 0x80, 1897 | 0x61, 0x00, 1898 | 0x23, 0x00, 1899 | 0x33, 0x00, 1900 | 0x12, 0x00, 1901 | 0x16, 0x00, 1902 | 0x1c, 0x00, 1903 | 0x0c, 0x00, 1904 | 0x08, 0x00, 1905 | 0x18, 0x00, 1906 | 0x10, 0x00, 1907 | 0x70, 0x00, 1908 | 0x00, 0x00, 1909 | 1910 | // Symbol: z Code: 122 Width: 10 1911 | 0x00, 0x00, 1912 | 0x00, 0x00, 1913 | 0x00, 0x00, 1914 | 0x00, 0x00, 1915 | 0x00, 0x00, 1916 | 0x00, 0x00, 1917 | 0x7f, 0x00, 1918 | 0x03, 0x00, 1919 | 0x06, 0x00, 1920 | 0x04, 0x00, 1921 | 0x0c, 0x00, 1922 | 0x18, 0x00, 1923 | 0x30, 0x00, 1924 | 0x20, 0x00, 1925 | 0x7f, 0x00, 1926 | 0x00, 0x00, 1927 | 0x00, 0x00, 1928 | 0x00, 0x00, 1929 | 0x00, 0x00, 1930 | 1931 | // Symbol: { Code: 123 Width: 10 1932 | 0x00, 0x00, 1933 | 0x03, 0x00, 1934 | 0x06, 0x00, 1935 | 0x04, 0x00, 1936 | 0x04, 0x00, 1937 | 0x04, 0x00, 1938 | 0x04, 0x00, 1939 | 0x04, 0x00, 1940 | 0x0c, 0x00, 1941 | 0x18, 0x00, 1942 | 0x0c, 0x00, 1943 | 0x04, 0x00, 1944 | 0x04, 0x00, 1945 | 0x04, 0x00, 1946 | 0x04, 0x00, 1947 | 0x06, 0x00, 1948 | 0x03, 0x00, 1949 | 0x00, 0x00, 1950 | 0x00, 0x00, 1951 | 1952 | // Symbol: | Code: 124 Width: 10 1953 | 0x00, 0x00, 1954 | 0x00, 0x00, 1955 | 0x00, 0x00, 1956 | 0x08, 0x00, 1957 | 0x08, 0x00, 1958 | 0x08, 0x00, 1959 | 0x08, 0x00, 1960 | 0x08, 0x00, 1961 | 0x08, 0x00, 1962 | 0x08, 0x00, 1963 | 0x08, 0x00, 1964 | 0x08, 0x00, 1965 | 0x08, 0x00, 1966 | 0x08, 0x00, 1967 | 0x08, 0x00, 1968 | 0x08, 0x00, 1969 | 0x08, 0x00, 1970 | 0x08, 0x00, 1971 | 0x00, 0x00, 1972 | 1973 | // Symbol: } Code: 125 Width: 10 1974 | 0x00, 0x00, 1975 | 0x10, 0x00, 1976 | 0x18, 0x00, 1977 | 0x08, 0x00, 1978 | 0x0c, 0x00, 1979 | 0x0c, 0x00, 1980 | 0x0c, 0x00, 1981 | 0x0c, 0x00, 1982 | 0x04, 0x00, 1983 | 0x03, 0x00, 1984 | 0x04, 0x00, 1985 | 0x0c, 0x00, 1986 | 0x0c, 0x00, 1987 | 0x0c, 0x00, 1988 | 0x0c, 0x00, 1989 | 0x08, 0x00, 1990 | 0x18, 0x00, 1991 | 0x00, 0x00, 1992 | 0x00, 0x00, 1993 | 1994 | // Symbol: ~ Code: 126 Width: 10 1995 | 0x00, 0x00, 1996 | 0x00, 0x00, 1997 | 0x00, 0x00, 1998 | 0x00, 0x00, 1999 | 0x00, 0x00, 2000 | 0x00, 0x00, 2001 | 0x00, 0x00, 2002 | 0x70, 0x80, 2003 | 0x4c, 0x80, 2004 | 0x87, 0x00, 2005 | 0x00, 0x00, 2006 | 0x00, 0x00, 2007 | 0x00, 0x00, 2008 | 0x00, 0x00, 2009 | 0x00, 0x00, 2010 | 0x00, 0x00, 2011 | 0x00, 0x00, 2012 | 0x00, 0x00, 2013 | 0x00, 0x00, 2014 | 2015 | }; 2016 | 2017 | static uint8_t const font_robotomono_regular_16_widths[95] = 2018 | { 2019 | 10, 2020 | 10, 2021 | 10, 2022 | 10, 2023 | 10, 2024 | 10, 2025 | 10, 2026 | 10, 2027 | 10, 2028 | 10, 2029 | 10, 2030 | 10, 2031 | 10, 2032 | 10, 2033 | 10, 2034 | 10, 2035 | 10, 2036 | 10, 2037 | 10, 2038 | 10, 2039 | 10, 2040 | 10, 2041 | 10, 2042 | 10, 2043 | 10, 2044 | 10, 2045 | 10, 2046 | 10, 2047 | 10, 2048 | 10, 2049 | 10, 2050 | 10, 2051 | 10, 2052 | 10, 2053 | 10, 2054 | 10, 2055 | 10, 2056 | 10, 2057 | 10, 2058 | 10, 2059 | 10, 2060 | 10, 2061 | 10, 2062 | 10, 2063 | 10, 2064 | 10, 2065 | 10, 2066 | 10, 2067 | 10, 2068 | 10, 2069 | 10, 2070 | 10, 2071 | 10, 2072 | 10, 2073 | 10, 2074 | 10, 2075 | 10, 2076 | 10, 2077 | 10, 2078 | 10, 2079 | 10, 2080 | 10, 2081 | 10, 2082 | 10, 2083 | 10, 2084 | 10, 2085 | 10, 2086 | 10, 2087 | 10, 2088 | 10, 2089 | 10, 2090 | 10, 2091 | 10, 2092 | 10, 2093 | 10, 2094 | 10, 2095 | 10, 2096 | 10, 2097 | 10, 2098 | 10, 2099 | 10, 2100 | 10, 2101 | 10, 2102 | 10, 2103 | 10, 2104 | 10, 2105 | 10, 2106 | 10, 2107 | 10, 2108 | 10, 2109 | 10, 2110 | 10, 2111 | 10, 2112 | 10, 2113 | 10, 2114 | }; 2115 | 2116 | font_style_t font_robotomono_regular_16 = 2117 | { 2118 | 95, // Glyph count 2119 | 32, // First ascii code 2120 | 2, // Glyph width (bytes) 2121 | 19, // Glyph height (bytes) 2122 | 0, // Fixed width or 0 if variable 2123 | font_robotomono_regular_16_widths, 2124 | font_robotomono_regular_16_map 2125 | }; 2126 | -------------------------------------------------------------------------------- /source/graphics.c: -------------------------------------------------------------------------------- 1 | 2 | #include "ugui/graphics.h" 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | #include "ugui/layer.h" 12 | #include "ugui/font.h" 13 | #include "ugui/sprite.h" 14 | 15 | #define ABS(x) (x < 0 ? -x : x) 16 | #define SIGN(x) (x < 0 ? -1 : (x > 0 ? 1 : 0)) 17 | 18 | #ifdef DEBUG_GRAPHICS 19 | #include 20 | #define GRAPHICS_PRINT(...) printf(__VA_ARGS__) 21 | #else 22 | #define GRAPHICS_PRINT(...) 23 | #endif 24 | 25 | struct ugui_graphics_s { 26 | uint32_t w; 27 | uint32_t h; 28 | ugui_buffer_t* buffer; 29 | 30 | uint32_t offset_x; 31 | uint32_t offset_y; 32 | uint32_t limit_w; 33 | uint32_t limit_h; 34 | }; 35 | 36 | ugui_graphics_t* ugui_graphics_create(uint32_t w, uint32_t h, ugui_buffer_t* buffer) 37 | { 38 | ugui_graphics_t* graphics = malloc(sizeof(struct ugui_graphics_s)); 39 | 40 | graphics->w = w; 41 | graphics->h = h; 42 | graphics->buffer = buffer; 43 | 44 | graphics->offset_x = 0; 45 | graphics->offset_y = 0; 46 | graphics->limit_w = w; 47 | graphics->limit_h = h; 48 | 49 | return graphics; 50 | } 51 | 52 | void ugui_graphics_destroy(ugui_graphics_t* graphics) 53 | { 54 | free(graphics); 55 | } 56 | 57 | /** 58 | * @brief Internal function to plot a point 59 | * @details This performs bounds checking and translation based on the graphics context 60 | * 61 | * @param graphics [description] 62 | * @param x [description] 63 | * @param y [description] 64 | */ 65 | static void plot(ugui_graphics_t* graphics, uint32_t x, uint32_t y) 66 | { 67 | //Calculate offsets 68 | uint32_t new_x = x + graphics->offset_x; 69 | uint32_t new_y = y + graphics->offset_y; 70 | 71 | //Draw point if within graphics buffer and layer bounds 72 | if ((new_x < graphics->w) && (x < graphics->limit_w) 73 | && (new_y < graphics->h) && (y < graphics->limit_h)) { 74 | _ugui_buffer_set(graphics->buffer, &(ugui_point_t) { 75 | .x = new_x, .y = new_y 76 | }, 1); 77 | } 78 | 79 | } 80 | 81 | static void _ugui_graphics_inverse(ugui_graphics_t* graphics, uint32_t x, uint32_t y) 82 | { 83 | //Calculate offsets 84 | uint32_t new_x = x + graphics->offset_x; 85 | uint32_t new_y = y + graphics->offset_y; 86 | 87 | //Draw point if within graphics buffer and layer bounds 88 | if ((new_x < graphics->w) && (x < graphics->limit_w) 89 | && (new_y < graphics->h) && (y < graphics->limit_h)) { 90 | ugui_pixel_t pixel; 91 | _ugui_buffer_inverse(graphics->buffer, &(ugui_point_t) { 92 | .x = new_x, .y = new_y 93 | }); 94 | } 95 | } 96 | 97 | void ugui_graphics_clear(ugui_graphics_t* graphics) 98 | { 99 | _ugui_buffer_clear(graphics->buffer); 100 | } 101 | 102 | void ugui_graphics_draw_rect(ugui_graphics_t *graphics, ugui_point_t a, ugui_size_t size) 103 | { 104 | //Horizontal lines 105 | for (int i = 0; i < size.w; i++) { 106 | plot(graphics, a.x + i, a.y); 107 | plot(graphics, a.x + i, a.y + size.h); 108 | } 109 | 110 | //Vertical lines 111 | for (int j = 0; j < size.h; j++) { 112 | plot(graphics, a.x, a.y + j); 113 | plot(graphics, a.x + size.w, a.y + j); 114 | } 115 | } 116 | 117 | void ugui_graphics_fill_rect(ugui_graphics_t *graphics, ugui_point_t a, ugui_size_t size) 118 | { 119 | for (int i = 0; i < size.h; i++) { 120 | for (int j = 0; j < size.w; j++) { 121 | plot(graphics, a.x + j, a.y + i); 122 | } 123 | } 124 | } 125 | 126 | void ugui_graphics_inverse_rect(ugui_graphics_t *graphics, ugui_point_t a, ugui_size_t size) 127 | { 128 | for (int i = 0; i < size.h; i++) { 129 | for (int j = 0; j < size.w; j++) { 130 | _ugui_graphics_inverse(graphics, a.x + j, a.y + i); 131 | } 132 | } 133 | } 134 | 135 | void ugui_graphics_draw_line(ugui_graphics_t* graphics, ugui_point_t a, ugui_point_t b) 136 | { 137 | //Bresenham's line algorithm (https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm), implementation from: 138 | //https://www.opengl.org/discussion_boards/showthread.php/168761-Drawing-Line-Bresenhem-midpoint-algorithm 139 | 140 | assert((a.x >= 0) && (a.x < graphics->w)); 141 | assert((a.y >= 0) && (a.y < graphics->h)); 142 | assert((b.x >= 0) && (b.x < graphics->w)); 143 | assert((b.y >= 0) && (b.y < graphics->h)); 144 | 145 | int deltax = (b.x - a.x); 146 | int deltay = (b.y - a.y); 147 | 148 | int signx = SIGN(deltax); 149 | int signy = SIGN(deltay); 150 | 151 | deltax = ABS(deltax); 152 | deltay = ABS(deltay); 153 | 154 | b.x += signx; 155 | b.y += signy; 156 | 157 | plot(graphics, a.x, a.y); 158 | 159 | int d = 2 * deltay - deltax; 160 | 161 | if (deltax > deltay) { 162 | int accum = deltax / 2; 163 | do { 164 | plot(graphics, a.x, a.y); 165 | 166 | accum -= deltay; 167 | if (accum < 0) { 168 | accum += deltax; 169 | a.y += signy; 170 | } 171 | a.x += signx; 172 | 173 | } while (a.x != b.x); 174 | 175 | } else { 176 | int accum = deltay >> 1; 177 | do { 178 | plot(graphics, a.x, a.y); 179 | 180 | accum -= deltax; 181 | if (accum < 0) { 182 | accum += deltay; 183 | a.x += signx; 184 | } 185 | a.y += signy; 186 | 187 | } while (a.y != b.y); 188 | 189 | } 190 | } 191 | 192 | void ugui_graphics_draw_ellipse(ugui_graphics_t* graphics, ugui_rect_t rect) 193 | { 194 | //Implementation also from: 195 | //https://www.opengl.org/discussion_boards/showthread.php/168761-Drawing-Line-Bresenhem-midpoint-algorithm 196 | 197 | int a, b; 198 | int x, y, a2, b2, S, T; 199 | int two_a2, two_b2; 200 | int four_a2, four_b2; 201 | int temp; 202 | 203 | int left = rect.x; 204 | int right = rect.x + rect.w; 205 | int top = rect.y; 206 | int bottom = rect.y + rect.h; 207 | 208 | //Flip logic, should not be required as rect should be ordered already. 209 | if (right < left) { 210 | temp = left; 211 | left = right; 212 | right = temp; 213 | } 214 | if (bottom < top) { 215 | temp = top; 216 | top = bottom; 217 | bottom = temp; 218 | } 219 | 220 | a = (right - left + 1) / 2; 221 | b = (bottom - top + 1) / 2; 222 | 223 | if (!a && !b) { 224 | plot(graphics, left, top); // Draw a single pixel 225 | return; 226 | } 227 | 228 | if (!b) { 229 | ugui_graphics_draw_line(graphics, 230 | (ugui_point_t) {.y = top, .x = left}, 231 | (ugui_point_t) {.y = top, .x = right}); // Draw a horizontal line 232 | return; 233 | } 234 | 235 | if (!a) { 236 | ugui_graphics_draw_line(graphics, 237 | (ugui_point_t) {.y = left, .x = top}, 238 | (ugui_point_t) {.y = left, .x = bottom}); // Draw a vertical line 239 | return; 240 | } 241 | 242 | a2 = a * a; 243 | b2 = b * b; 244 | two_a2 = a2 << 1; 245 | two_b2 = b2 << 1; 246 | four_a2 = a2 << 2; 247 | four_b2 = b2 << 2; 248 | x = 0; 249 | y = b; 250 | S = a2 * (1 - (b << 1)) + two_b2; 251 | T = b2 - two_a2 * ((b << 1) - 1); 252 | 253 | plot(graphics, right + x - a, bottom + y - b); 254 | plot(graphics, left - x + a, bottom + y - b); 255 | plot(graphics, left - x + a, top - y + b); 256 | plot(graphics, right + x - a, top - y + b); 257 | 258 | do { 259 | if (S < 0) { 260 | S += two_b2 * ((x << 1) + 3); 261 | T += four_b2 * (x + 1); 262 | x++; 263 | } else if (T < 0) { 264 | S += two_b2 * ((x << 1) + 3) - four_a2 * (y - 1); 265 | T += four_b2 * (x + 1) - two_a2 * ((y << 1) - 3); 266 | x++; 267 | y--; 268 | } else { 269 | S -= four_a2 * (y - 1); 270 | T -= two_a2 * ((y << 1) - 3); 271 | y--; 272 | } 273 | plot(graphics, right + x - a, bottom + y - b); 274 | plot(graphics, left - x + a, bottom + y - b); 275 | plot(graphics, left - x + a, top - y + b); 276 | plot(graphics, right + x - a, top - y + b); 277 | } while (y > 0); 278 | } 279 | 280 | void ugui_graphics_draw_sprite(ugui_graphics_t* graphics, ugui_sprite_t sprite, ugui_point_t point) 281 | { 282 | for (int y = 0; y < sprite.h; y++) { 283 | for (int x = 0; x < sprite.w; x++) { 284 | ugui_pixel_t pixel; 285 | _ugui_sprite_get_pixel(&sprite, x, y, &pixel); 286 | if (pixel) { 287 | plot(graphics, point.x + x, point.y + y); 288 | } 289 | } 290 | } 291 | } 292 | 293 | void ugui_graphics_draw_text(ugui_graphics_t* graphics, char* text, font_style_t* font, ugui_point_t point) 294 | { 295 | uint16_t length = strlen(text); 296 | ugui_sprite_t sprite; 297 | 298 | for (uint16_t i = 0; i < length; i++) { 299 | char c = text[i]; 300 | _ugui_font_get_glyph(font, c, &sprite); 301 | ugui_graphics_draw_sprite(graphics, sprite, point); 302 | point.x += sprite.w; 303 | } 304 | } 305 | 306 | void _ugui_graphics_push_layer_ctx(ugui_graphics_t* graphics, ugui_rect_t* bounds) 307 | { 308 | graphics->offset_y += bounds->y; 309 | graphics->offset_x += bounds->x; 310 | //TODO: implement layer bounds. May need a layer stack :-/ 311 | //graphics->limit_w = bounds->w; 312 | //graphics->limit_h = bounds->h; 313 | 314 | GRAPHICS_PRINT("Graphics - push context (x: %d, y: %d, w: %d, h: %d\r\n", 315 | graphics->offset_y, 316 | graphics->offset_x, 317 | graphics->limit_w, 318 | graphics->limit_h); 319 | } 320 | 321 | void _ugui_graphics_pop_layer_ctx(ugui_graphics_t* graphics, ugui_rect_t* bounds) 322 | { 323 | graphics->offset_y -= bounds->y; 324 | graphics->offset_x -= bounds->x; 325 | //TODO: implement layer bounds. May need a layer stack :-/ 326 | //graphics->limit_w = bounds->w; 327 | //graphics->limit_h = bounds->h; 328 | 329 | GRAPHICS_PRINT("Graphics - pop context (x: %d, y: %d, w: %d, h: %d\r\n", 330 | graphics->offset_y, 331 | graphics->offset_x, 332 | graphics->limit_w, 333 | graphics->limit_h); 334 | } 335 | -------------------------------------------------------------------------------- /source/layer.c: -------------------------------------------------------------------------------- 1 | 2 | #include "ugui/layer.h" 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "ugui/graphics.h" 9 | 10 | #define UGUI_LAYER_MAX_CHILDREN 8 11 | 12 | struct ugui_layer_s { 13 | ugui_rect_t bounds; 14 | ugui_layer_update_t update; 15 | bool dirty; 16 | bool visible; 17 | void* ctx; 18 | ugui_layer_t *children[UGUI_LAYER_MAX_CHILDREN]; 19 | }; 20 | 21 | /*** Public ***/ 22 | 23 | ugui_layer_t* ugui_layer_create(ugui_rect_t bounds) 24 | { 25 | ugui_layer_t* layer = malloc(sizeof(struct ugui_layer_s)); 26 | 27 | layer->bounds.x = bounds.x; 28 | layer->bounds.y = bounds.y; 29 | layer->bounds.w = bounds.w; 30 | layer->bounds.h = bounds.h; 31 | 32 | layer->update = NULL; 33 | layer->visible = true; 34 | layer->ctx = NULL; 35 | 36 | for(int i=0; ichildren[i] = 0; 38 | } 39 | 40 | return layer; 41 | } 42 | 43 | void ugui_layer_destroy(ugui_layer_t* layer) 44 | { 45 | free(layer); 46 | } 47 | 48 | ugui_rect_t* ugui_layer_get_bounds(ugui_layer_t* layer) 49 | { 50 | return &(layer->bounds); 51 | } 52 | 53 | int32_t ugui_layer_add_child(ugui_layer_t* layer, ugui_layer_t *child) 54 | { 55 | for (uint8_t i = 0; i < UGUI_LAYER_MAX_CHILDREN; i++) { 56 | if (layer->children[i] == NULL) { 57 | layer->children[i] = child; 58 | return 1; 59 | } 60 | } 61 | return 0; 62 | } 63 | 64 | void ugui_layer_set_ctx(ugui_layer_t* layer, void* ctx) 65 | { 66 | layer->ctx = ctx; 67 | } 68 | 69 | void ugui_layer_set_update(ugui_layer_t* layer, ugui_layer_update_t update) 70 | { 71 | layer->update = update; 72 | } 73 | 74 | void ugui_layer_set_dirty(ugui_layer_t* layer) 75 | { 76 | layer->dirty = true; 77 | } 78 | 79 | void ugui_layer_set_visible(ugui_layer_t* layer, bool visible) 80 | { 81 | layer->visible = visible; 82 | } 83 | 84 | /*** Private ***/ 85 | 86 | int _ugui_layer_update(ugui_layer_t* layer, void* graphics_ctx) 87 | { 88 | int32_t dirty = 0; 89 | 90 | ugui_rect_t* bounds = ugui_layer_get_bounds(layer); 91 | 92 | _ugui_graphics_push_layer_ctx((ugui_graphics_t*) graphics_ctx, bounds); 93 | 94 | if(layer->visible) { 95 | if (layer->update != NULL) layer->update(layer, graphics_ctx, layer->ctx); 96 | 97 | for (uint32_t i = 0; i < UGUI_LAYER_MAX_CHILDREN; i++) { 98 | if (layer->children[i] != NULL) { 99 | dirty += _ugui_layer_update(layer->children[i], graphics_ctx); 100 | } 101 | } 102 | } 103 | 104 | _ugui_graphics_pop_layer_ctx((ugui_graphics_t*) graphics_ctx, bounds); 105 | 106 | return layer->dirty || (dirty > 0); 107 | } 108 | 109 | 110 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /source/sprite.c: -------------------------------------------------------------------------------- 1 | 2 | #include "ugui/sprite.h" 3 | 4 | #include "ugui/types.h" 5 | 6 | //TODO: Function depends on b/w or color implementation 7 | uint8_t _ugui_sprite_get_pixel(ugui_sprite_t *sprite, uint16_t x, uint16_t y, ugui_pixel_t* pixel) 8 | { 9 | if((x < 0) || (x > sprite->w) || (y < 0) || (y > sprite->h)) { 10 | return 0; 11 | } 12 | 13 | uint8_t byte = sprite->data[y * sprite->w_bytes + x / 8]; 14 | uint8_t mask = 1 << (7 - (x % 8)); 15 | 16 | *pixel = (bool)((byte & mask) != 0); 17 | 18 | return 1; 19 | } 20 | -------------------------------------------------------------------------------- /source/ugui.c: -------------------------------------------------------------------------------- 1 | 2 | #include "ugui/ugui.h" 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "ugui/graphics.h" 9 | #include "ugui/buffer.h" 10 | 11 | struct ugui_s { 12 | uint32_t w; 13 | uint32_t h; 14 | ugui_buffer_t* buffer; 15 | ugui_graphics_t* graphics; 16 | ugui_window_t *windows[UGUI_MAX_WINDOW_DEPTH]; 17 | uint32_t window_index; 18 | }; 19 | 20 | ugui_t* ugui_create(uint32_t w, uint32_t h) 21 | { 22 | ugui_t* gui = malloc(sizeof(struct ugui_s)); 23 | 24 | gui->buffer = _ugui_buffer_create(w, h, 0, 0); 25 | 26 | gui->w = w; 27 | gui->h = h; 28 | gui->window_index = 0; 29 | 30 | for (int i = 0; i < UGUI_MAX_WINDOW_DEPTH; i++) { 31 | gui->windows[i] = NULL; 32 | } 33 | 34 | gui->graphics = ugui_graphics_create(w, h, gui->buffer); 35 | 36 | return gui; 37 | } 38 | 39 | void ugui_destroy(ugui_t* gui) 40 | { 41 | free(gui->buffer); 42 | 43 | free(gui); 44 | } 45 | 46 | uint8_t* ugui_get_image(ugui_t* gui) 47 | { 48 | return _ugui_buffer_get_data(gui->buffer); 49 | } 50 | 51 | void ugui_put_event(ugui_t* gui, uint8_t event) 52 | { 53 | //Bypass for null events 54 | if(event == UGUI_EVT_NONE) { 55 | return; 56 | } 57 | //Pass event to active window handler 58 | ugui_window_t *current = gui->windows[gui->window_index - 1]; 59 | _ugui_window_put_event(current, event); 60 | } 61 | 62 | void ugui_render(ugui_t* gui) 63 | { 64 | //TODO: render only if dirty..? 65 | //TODO: Think about how layers work & offset rendering in update calls 66 | ugui_graphics_clear(gui->graphics); 67 | ugui_window_t *current = gui->windows[gui->window_index - 1]; 68 | _ugui_window_update(current, gui->graphics); 69 | } 70 | 71 | void ugui_window_stack_push(ugui_t* gui, ugui_window_t *window) 72 | { 73 | //Unload last window 74 | if (gui->window_index > 0) { 75 | ugui_window_t *last = gui->windows[gui->window_index - 1]; 76 | _ugui_window_unload(last); 77 | } 78 | 79 | //Update pointer 80 | gui->windows[gui->window_index] = window; 81 | gui->window_index ++; 82 | 83 | //Load new window 84 | _ugui_window_load(window); 85 | } 86 | 87 | void ugui_window_stack_pop(ugui_t* gui) 88 | { 89 | //Unload last window 90 | if (gui->window_index > 0) { 91 | ugui_window_t *last = gui->windows[gui->window_index - 1]; 92 | _ugui_window_unload(last); 93 | 94 | //Update pointer 95 | gui->window_index --; 96 | ugui_window_t *next = gui->windows[gui->window_index]; 97 | 98 | //Load new window 99 | _ugui_window_load(next); 100 | } 101 | } 102 | 103 | -------------------------------------------------------------------------------- /source/ugui_sdl.c: -------------------------------------------------------------------------------- 1 | 2 | #include "ugui/ugui_sdl.h" 3 | 4 | #include 5 | 6 | 7 | #include "ugui/ugui.h" 8 | #include "SDL2/SDL.h" 9 | 10 | struct ugui_sdl_s { 11 | SDL_Window *win; 12 | SDL_Renderer *ren; 13 | }; 14 | 15 | ugui_sdl_t* ugui_sdl_init(char* title, int width, int height) { 16 | 17 | ugui_sdl_t* sdl_ctx = (ugui_sdl_t*)malloc(sizeof(ugui_sdl_t)); 18 | 19 | SDL_Init(SDL_INIT_EVERYTHING); 20 | 21 | sdl_ctx->win = SDL_CreateWindow(title, 100, 100, width, height, SDL_WINDOW_SHOWN); 22 | sdl_ctx->ren = SDL_CreateRenderer(sdl_ctx->win, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC); 23 | 24 | return sdl_ctx; 25 | } 26 | 27 | int ugui_sdl_get_event(ugui_sdl_t* sdl_ctx) { 28 | //Handle SDL events 29 | SDL_Event event; 30 | while (SDL_PollEvent(&event)) { 31 | if (event.type == SDL_QUIT) { 32 | return UGUI_EVT_EXIT; 33 | } 34 | if (event.type == SDL_KEYDOWN) { 35 | switch (event.key.keysym.sym) { 36 | case SDLK_UP: 37 | return UGUI_EVT_UP; 38 | case SDLK_DOWN: 39 | return UGUI_EVT_DOWN; 40 | case SDLK_LEFT: 41 | return UGUI_EVT_LEFT; 42 | case SDLK_RIGHT: 43 | return UGUI_EVT_RIGHT; 44 | case SDLK_ESCAPE: 45 | case SDLK_q: 46 | return UGUI_EVT_EXIT; 47 | } 48 | } 49 | } 50 | return UGUI_EVT_NONE; 51 | } 52 | 53 | void ugui_sdl_render_bmp(ugui_sdl_t* sdl_ctx, char* name) { 54 | SDL_Surface *bmp = SDL_LoadBMP(name); 55 | SDL_Texture *tex = SDL_CreateTextureFromSurface(sdl_ctx->ren, bmp); 56 | 57 | SDL_RenderClear(sdl_ctx->ren); 58 | SDL_RenderCopy(sdl_ctx->ren, tex, NULL, NULL); 59 | SDL_RenderPresent(sdl_ctx->ren); 60 | 61 | SDL_DestroyTexture(tex); 62 | 63 | SDL_FreeSurface(bmp); 64 | } 65 | 66 | void ugui_sdl_close(ugui_sdl_t* sdl_ctx) { 67 | SDL_DestroyRenderer(sdl_ctx->ren); 68 | SDL_DestroyWindow(sdl_ctx->win); 69 | 70 | SDL_Quit(); 71 | 72 | free(sdl_ctx); 73 | } 74 | -------------------------------------------------------------------------------- /source/widgets/menu_widget.c: -------------------------------------------------------------------------------- 1 | 2 | #include "ugui/widgets/menu_widget.h" 3 | 4 | #include 5 | 6 | #define UGUI_MENU_WIDGET_MAX_CELLS 8 7 | //TODO: assert to ensure num cells < num layers 8 | 9 | struct ugui_menu_widget_s { 10 | ugui_layer_t* widget_layer; 11 | ugui_menu_widget_draw_callbacks_t draw_callbacks; 12 | ugui_menu_widget_data_callbacks_t data_callbacks; 13 | 14 | uint32_t selected; 15 | uint32_t offset; 16 | void* data; 17 | }; 18 | 19 | static void menu_widget_layer_update(ugui_layer_t* layer, void* graphics_ctx, void* layer_ctx) 20 | { 21 | ugui_menu_widget_t* menu_widget = (ugui_menu_widget_t*) layer_ctx; 22 | ugui_rect_t* bounds = ugui_layer_get_bounds(layer); 23 | 24 | int32_t num_rows = menu_widget->data_callbacks.get_num_rows(menu_widget, menu_widget->data); 25 | int32_t header_height = menu_widget->draw_callbacks.get_header_height(menu_widget, menu_widget->data); 26 | int32_t row_height = menu_widget->draw_callbacks.get_cell_height(menu_widget, menu_widget->data); 27 | 28 | int32_t max_rows = (bounds->h - header_height) / row_height; 29 | int32_t min_rows = (num_rows < max_rows) ? num_rows : max_rows; 30 | 31 | ugui_rect_t cell_bounds; 32 | cell_bounds.x = 0; 33 | cell_bounds.y = header_height; 34 | cell_bounds.w = bounds->w; 35 | cell_bounds.h = row_height; 36 | 37 | char header[64]; 38 | char title[64]; 39 | char data[64]; 40 | 41 | //Draw header 42 | menu_widget->data_callbacks.get_header(menu_widget, header); 43 | menu_widget->draw_callbacks.draw_header(graphics_ctx, bounds, header); 44 | 45 | //Draw cells 46 | //TODO: support for 2d cells 47 | for (uint8_t i = 0; i < min_rows; i++) { 48 | //Calculate row offset in pixels 49 | cell_bounds.y = header_height + i * row_height; 50 | 51 | menu_widget->data_callbacks.get_data(menu_widget, i + menu_widget->offset, title, data); 52 | menu_widget->draw_callbacks.draw_row(graphics_ctx, &cell_bounds, title, data); 53 | 54 | //Highlight selected cell 55 | if ((i + menu_widget->offset) == menu_widget->selected) { 56 | ugui_graphics_inverse_rect(graphics_ctx, 57 | (ugui_point_t) {.x = cell_bounds.x, .y = cell_bounds.y}, 58 | (ugui_size_t) {.w = cell_bounds.w, .h = cell_bounds.h}); 59 | } 60 | } 61 | } 62 | 63 | static uint32_t ugui_menu_widget_basic_get_header_height(void *menu_layer, void* data) 64 | { 65 | return font_robotomono_regular_18.glyph_height + 4; //Padding, todo: config struct 66 | } 67 | 68 | static void ugui_menu_widget_basic_header_draw(ugui_graphics_t *graphics_ctx, ugui_rect_t* bounds, char* title) 69 | { 70 | int w = bounds->w; 71 | int h = bounds->h; 72 | 73 | ugui_size_t text_size; 74 | ugui_font_get_text_size(&font_robotomono_regular_18, 75 | title, 76 | &text_size); 77 | 78 | ugui_graphics_draw_text(graphics_ctx, 79 | title, 80 | &font_robotomono_regular_18, 81 | (ugui_point_t) { 82 | .x = w / 2 - text_size.w / 2, .y = 0 83 | }); 84 | } 85 | 86 | static uint32_t ugui_menu_widget_basic_get_cell_height(void *menu_layer, void* data) 87 | { 88 | return font_robotomono_regular_18.glyph_height + font_robotomono_regular_16.glyph_height + 16; 89 | } 90 | 91 | static void ugui_menu_widget_basic_cell_draw(ugui_graphics_t* graphics_ctx, ugui_rect_t* bounds, char* title , char* data) 92 | { 93 | int w = bounds->w; 94 | int h = bounds->h; 95 | int x = bounds->x; 96 | int y = bounds->y; 97 | 98 | //Surround 99 | ugui_graphics_draw_rect(graphics_ctx, 100 | (ugui_point_t) {.x = x, .y = y}, 101 | (ugui_size_t) {.w = w - 1, .h = h}); 102 | #if 1 103 | //Header 104 | ugui_size_t title_size; 105 | ugui_font_get_text_size(&font_robotomono_regular_18, 106 | title, 107 | &title_size); 108 | 109 | ugui_graphics_draw_text(graphics_ctx, 110 | title, 111 | &font_robotomono_regular_18, 112 | (ugui_point_t) { 113 | .x = x + w / 2 - title_size.w / 2, .y = y 114 | }); 115 | 116 | //Data 117 | ugui_size_t data_size; 118 | ugui_font_get_text_size(&font_robotomono_regular_16, 119 | data, 120 | &data_size); 121 | 122 | ugui_graphics_draw_text(graphics_ctx, 123 | data, 124 | &font_robotomono_regular_16, 125 | (ugui_point_t) { 126 | .x = x + w / 2 - data_size.w / 2, .y = y + title_size.h + 8 127 | }); 128 | #endif 129 | } 130 | 131 | static void ugui_menu_widget_basic_event_handler(ugui_window_t *window, int event, void* ctx) { 132 | ugui_menu_widget_t* menu_widget = (ugui_menu_widget_t*)ctx; 133 | 134 | int max_rows = menu_widget->data_callbacks.get_num_rows(menu_widget, NULL); 135 | 136 | switch (event) { 137 | case UGUI_EVT_UP: 138 | if (menu_widget->selected > 0) menu_widget->selected --; 139 | break; 140 | case UGUI_EVT_DOWN: 141 | if (menu_widget->selected < (max_rows - 1)) menu_widget->selected ++; 142 | break; 143 | case UGUI_EVT_RIGHT: 144 | case UGUI_EVT_SELECT: 145 | //TODO: select callback 146 | if(menu_widget->data_callbacks.select != NULL) { 147 | menu_widget->data_callbacks.select(menu_widget, menu_widget->selected, NULL); 148 | } 149 | break; 150 | } 151 | } 152 | 153 | ugui_menu_widget_t *ugui_menu_widget_create(ugui_rect_t bounds) { 154 | ugui_menu_widget_t* menu_widget = (ugui_menu_widget_t*)malloc(sizeof(ugui_menu_widget_t)); 155 | 156 | menu_widget->widget_layer = ugui_layer_create(bounds); 157 | 158 | //Set location information 159 | menu_widget->selected = 0; 160 | menu_widget->offset = 0; 161 | 162 | //Default draw callbacks 163 | menu_widget->draw_callbacks.draw_header = ugui_menu_widget_basic_header_draw; 164 | menu_widget->draw_callbacks.draw_row = ugui_menu_widget_basic_cell_draw; 165 | menu_widget->draw_callbacks.get_header_height = ugui_menu_widget_basic_get_header_height; 166 | menu_widget->draw_callbacks.get_cell_height = ugui_menu_widget_basic_get_cell_height; 167 | 168 | //Bind update method 169 | ugui_layer_set_update(menu_widget->widget_layer, menu_widget_layer_update); 170 | //Bind menu_widget instance to layer context for use in update and other calls 171 | ugui_layer_set_ctx(menu_widget->widget_layer, (void*) menu_widget); 172 | 173 | return menu_widget; 174 | } 175 | 176 | void ugui_menu_widget_destroy(ugui_menu_widget_t* menu_widget) 177 | { 178 | ugui_layer_destroy(menu_widget->widget_layer); 179 | 180 | free(menu_widget); 181 | } 182 | 183 | void ugui_menu_widget_set_callbacks(ugui_menu_widget_t* menu_widget, ugui_menu_widget_data_callbacks_t* callbacks) 184 | { 185 | menu_widget->data_callbacks.get_num_sections = callbacks->get_num_sections; 186 | menu_widget->data_callbacks.get_num_rows = callbacks->get_num_rows; 187 | menu_widget->data_callbacks.get_header = callbacks->get_header; 188 | menu_widget->data_callbacks.get_data = callbacks->get_data; 189 | menu_widget->data_callbacks.select = callbacks->select; 190 | } 191 | 192 | void ugui_menu_widget_set_draw(ugui_menu_widget_t* menu_widget, ugui_menu_widget_draw_callbacks_t* callbacks) 193 | { 194 | menu_widget->draw_callbacks.draw_header = callbacks->draw_header; 195 | menu_widget->draw_callbacks.draw_row = callbacks->draw_row; 196 | menu_widget->draw_callbacks.get_header_height = callbacks->get_header_height; 197 | menu_widget->draw_callbacks.get_cell_height = callbacks->get_cell_height; 198 | } 199 | 200 | void ugui_menu_widget_attach_to_window(ugui_menu_widget_t* menu_widget, ugui_window_t* window) 201 | { 202 | //TODO: attach handlers for scroll and select (and back?) 203 | ugui_window_set_event_handler(window, ugui_menu_widget_basic_event_handler, (void*) menu_widget); 204 | } 205 | 206 | ugui_layer_t* ugui_menu_widget_get_layer(ugui_menu_widget_t* menu_widget) 207 | { 208 | return menu_widget->widget_layer; 209 | } 210 | -------------------------------------------------------------------------------- /source/widgets/text_widget.c: -------------------------------------------------------------------------------- 1 | 2 | #include "ugui/widgets/text_widget.h" 3 | #include "ugui/font.h" 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | 10 | struct ugui_text_widget_s { 11 | ugui_layer_t* widget_layer; 12 | 13 | font_style_t *font; 14 | uint8_t alignment; 15 | char* text; 16 | }; 17 | 18 | char* fake_text = "text widget default text"; 19 | 20 | // TODO: this whole module is awful 21 | // this method in particular needs refactoring 22 | // Also, do we really need everything to derive from a layer? Seems wasteful when only some 23 | // objects can actually contain children, and as such this would be more sensible as a 24 | // "text area" or something. 25 | // TODO: support text justification 26 | static void text_widget_layer_update(ugui_layer_t* layer, void* graphics_ctx, void* layer_ctx) 27 | { 28 | ugui_text_widget_t* text_widget = (ugui_text_widget_t*) layer_ctx; 29 | ugui_rect_t* bounds = ugui_layer_get_bounds(layer); 30 | 31 | uint8_t line_buff[64]; 32 | 33 | ugui_size_t text_size; 34 | // TODO: dirty hack will only support monospace fonts 35 | ugui_font_get_text_size(text_widget->font, 36 | "A", 37 | &text_size); 38 | 39 | uint16_t max_text_width = bounds->w / text_size.w; 40 | uint16_t max_text_lines = bounds->h / text_size.h; 41 | 42 | uint16_t len = strlen(text_widget->text); 43 | 44 | uint16_t line_index = 0; 45 | uint16_t line_count = 0; 46 | uint16_t offset = 0; 47 | uint16_t alignment_offset = 0; 48 | 49 | while ((offset < len) && (line_index < max_text_lines)) { 50 | 51 | // Determine line length 52 | for (int i = 0; i < max_text_width; i++) { 53 | // Handle end of text 54 | if ((offset + i) >= len) { 55 | line_count = i; 56 | break; 57 | } 58 | 59 | // Handle newlines 60 | if (text_widget->text[offset + i] == '\n') { 61 | line_count = i; 62 | break; 63 | } 64 | 65 | // Insert linebreaks up to spaces. 66 | if (text_widget->text[offset + i] == ' ') { 67 | line_count = i; 68 | } 69 | } 70 | 71 | // Copy line into line buffer for rendering 72 | strncpy(line_buff, text_widget->text + offset, line_count); 73 | line_buff[line_count] = '\0'; 74 | 75 | // Calculate offset for alignment modes 76 | switch (text_widget->alignment) { 77 | case UGUI_TEXT_ALIGN_LEFT: 78 | alignment_offset = 0; 79 | break; 80 | case UGUI_TEXT_ALIGN_CENTER: 81 | alignment_offset = (max_text_width - line_count) / 2; 82 | break; 83 | case UGUI_TEXT_ALIGN_RIGHT: 84 | alignment_offset = (max_text_width - line_count); 85 | break; 86 | } 87 | 88 | ugui_graphics_draw_text(graphics_ctx, 89 | line_buff, 90 | text_widget->font, 91 | (ugui_point_t) { 92 | .x = alignment_offset * text_size.w, .y = line_index * text_size.h 93 | }); 94 | 95 | offset += line_count + 1; 96 | line_index += 1; 97 | } 98 | } 99 | 100 | ugui_text_widget_t *ugui_text_widget_create(ugui_rect_t bounds) 101 | { 102 | ugui_text_widget_t* text_widget = (ugui_text_widget_t*)malloc(sizeof(ugui_text_widget_t)); 103 | 104 | text_widget->widget_layer = ugui_layer_create(bounds); 105 | 106 | // Set defaults 107 | text_widget->text = fake_text; 108 | text_widget->font = FONT_DEFAULT; 109 | 110 | // Bind update method 111 | ugui_layer_set_update(text_widget->widget_layer, text_widget_layer_update); 112 | // Bind text_widget instance to layer context for use in update and other calls 113 | ugui_layer_set_ctx(text_widget->widget_layer, (void*) text_widget); 114 | 115 | return text_widget; 116 | } 117 | 118 | void ugui_text_widget_set_text(ugui_text_widget_t* text_widget, font_style_t* font, char* text, uint8_t alignment) 119 | { 120 | text_widget->text = text; 121 | text_widget->font = font; 122 | text_widget->alignment = alignment; 123 | } 124 | 125 | void ugui_text_widget_destroy(ugui_text_widget_t* text_widget) 126 | { 127 | ugui_layer_destroy(text_widget->widget_layer); 128 | 129 | free(text_widget); 130 | } 131 | 132 | ugui_layer_t* ugui_text_widget_get_layer(ugui_text_widget_t* text_widget) 133 | { 134 | return text_widget->widget_layer; 135 | } 136 | -------------------------------------------------------------------------------- /source/window.c: -------------------------------------------------------------------------------- 1 | 2 | #include "ugui/window.h" 3 | 4 | #include 5 | 6 | #include "ugui/layer.h" 7 | #include "ugui/types.h" 8 | 9 | /*** Public ***/ 10 | 11 | struct ugui_window_s { 12 | ugui_layer_t* base_layer; 13 | ugui_window_handlers_t handlers; 14 | ugui_window_event_handler_t on_event; 15 | void* event_ctx; 16 | }; 17 | 18 | ugui_window_t* ugui_window_create(uint32_t w, uint32_t h) 19 | { 20 | ugui_window_t* window = malloc(sizeof(struct ugui_window_s)); 21 | 22 | window->base_layer = ugui_layer_create((ugui_rect_t) { 23 | .x = 0, .y = 0, .w = w, .h = h 24 | }); 25 | 26 | window->handlers.load = NULL; 27 | window->handlers.unload = NULL; 28 | window->on_event = NULL; 29 | window->event_ctx = NULL; 30 | 31 | return window; 32 | } 33 | 34 | ugui_layer_t* ugui_window_get_base_layer(ugui_window_t* window) 35 | { 36 | return window->base_layer; 37 | } 38 | 39 | void ugui_window_set_window_handlers(ugui_window_t* window, 40 | ugui_window_handlers_t* handlers) 41 | { 42 | window->handlers.load = handlers->load; 43 | window->handlers.unload = handlers->unload; 44 | } 45 | 46 | void ugui_window_set_event_handler(ugui_window_t *window, ugui_window_event_handler_t on_event, void* event_ctx) 47 | { 48 | window->on_event = on_event; 49 | window->event_ctx = event_ctx; 50 | } 51 | 52 | void ugui_window_destroy(ugui_window_t *window) 53 | { 54 | ugui_layer_destroy(window->base_layer); 55 | 56 | free(window); 57 | } 58 | 59 | /*** Private ***/ 60 | 61 | void _ugui_window_load(ugui_window_t *window) 62 | { 63 | if (window->handlers.load != NULL) window->handlers.load(window); 64 | } 65 | 66 | void _ugui_window_unload(ugui_window_t *window) 67 | { 68 | if (window->handlers.unload != NULL) window->handlers.unload(window); 69 | } 70 | 71 | void _ugui_window_put_event(ugui_window_t *window, int event) 72 | { 73 | if (window->on_event) window->on_event(window, event, window->event_ctx); 74 | } 75 | 76 | void _ugui_window_update(ugui_window_t *window, void* graphics_ctx) 77 | { 78 | //Render base layer 79 | ugui_layer_t* base_layer = window->base_layer; 80 | _ugui_layer_update(base_layer, graphics_ctx); 81 | } 82 | 83 | -------------------------------------------------------------------------------- /ugui.cmake: -------------------------------------------------------------------------------- 1 | # MicroGUI CMake Library File 2 | 3 | set(UGUI_SOURCES 4 | ${CMAKE_CURRENT_LIST_DIR}/source/sprite.c 5 | ${CMAKE_CURRENT_LIST_DIR}/source/window.c 6 | ${CMAKE_CURRENT_LIST_DIR}/source/layer.c 7 | ${CMAKE_CURRENT_LIST_DIR}/source/graphics.c 8 | ${CMAKE_CURRENT_LIST_DIR}/source/bmp.c 9 | ${CMAKE_CURRENT_LIST_DIR}/source/ugui.c 10 | ${CMAKE_CURRENT_LIST_DIR}/source/font.c 11 | ${CMAKE_CURRENT_LIST_DIR}/source/buffer.c 12 | ) 13 | 14 | set(UGUI_WIDGETS 15 | ${CMAKE_CURRENT_LIST_DIR}/source/widgets/menu_widget.c 16 | ${CMAKE_CURRENT_LIST_DIR}/source/widgets/text_widget.c 17 | ) 18 | 19 | #TODO: glob font sources 20 | set(UGUI_FONTS 21 | ${CMAKE_CURRENT_LIST_DIR}/source/fonts/robotomono_regular_16.c 22 | ${CMAKE_CURRENT_LIST_DIR}/source/fonts/robotomono_regular_18.c 23 | ${CMAKE_CURRENT_LIST_DIR}/source/fonts/robotomono_regular_24.c 24 | ${CMAKE_CURRENT_LIST_DIR}/source/fonts/robotomono_regular_32.c 25 | ) 26 | 27 | set(UGUI_ICONS 28 | ${CMAKE_CURRENT_LIST_DIR}/source/icons/icons_1x.c 29 | ${CMAKE_CURRENT_LIST_DIR}/source/icons/icons_2x.c 30 | ${CMAKE_CURRENT_LIST_DIR}/source/icons/icons_4x.c 31 | ${CMAKE_CURRENT_LIST_DIR}/source/icons/icons_6x.c 32 | ${CMAKE_CURRENT_LIST_DIR}/source/icons/icons_8x.c 33 | ) 34 | 35 | if(NOT DEFINED NO_SDL2) 36 | set(UGUI_SDL 37 | ${CMAKE_CURRENT_LIST_DIR}/source/ugui_sdl.c 38 | ) 39 | endif() 40 | 41 | include_directories(${CMAKE_CURRENT_LIST_DIR}) 42 | 43 | add_library(ugui ${UGUI_SOURCES} ${UGUI_SDL} ${UGUI_FONTS} ${UGUI_ICONS} ${UGUI_WIDGETS}) 44 | -------------------------------------------------------------------------------- /ugui/bmp.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Bitmap generator 3 | * Generates BMP files from the provided data arrays 4 | * This is useful for testing of the graphics framework 5 | */ 6 | 7 | #ifndef BMP_H 8 | #define BMP_H 9 | 10 | #include 11 | #include 12 | 13 | #include "ugui/types.h" 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | int bmp_create_bw(char* filename, uint32_t w, uint32_t h, uint8_t* data); 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /ugui/buffer.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef UGUI_BUFFER_H 3 | #define UGUI_BUFFER_H 4 | 5 | #include 6 | 7 | #include "ugui/types.h" 8 | 9 | typedef struct ugui_buffer_s ugui_buffer_t; 10 | 11 | ugui_buffer_t* _ugui_buffer_create(uint16_t w, uint16_t h, uint16_t porch, uint16_t trailer); 12 | 13 | void _ugui_buffer_set(ugui_buffer_t* buffer, ugui_point_t* point, ugui_pixel_t value); 14 | 15 | void _ugui_buffer_get(ugui_buffer_t* buffer, ugui_point_t* point, ugui_pixel_t* value); 16 | 17 | void _ugui_buffer_inverse(ugui_buffer_t* buffer, ugui_point_t* point); 18 | 19 | void _ugui_buffer_clear(ugui_buffer_t* buffer); 20 | 21 | uint8_t* _ugui_buffer_get_data(ugui_buffer_t* buffer); 22 | 23 | void _ugui_buffer_destroy(ugui_buffer_t* buffer); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /ugui/config.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef UGUI_CONFIG_H 4 | #define UGUI_CONFIG_H 5 | 6 | #include 7 | 8 | #define UGUI_PADDING_VERTICAL 16 9 | #define UGUI_PADDING_HORIZONTAL 16 10 | 11 | struct ugui_config_s { 12 | uint8_t menu_height; 13 | }; 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /ugui/font.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Font style module 3 | * Defines types to be used to store and define fonts. 4 | * 5 | * Bitmap font C files generated by bmfont2c.py 6 | * http://larsee.dk/converting-fonts-to-c-source-using-bmfont2c/ 7 | * 8 | * Fonts from Google Fonts 9 | * https://github.com/google/fonts 10 | * 11 | * Icons from OpenIconic 12 | * https://github.com/iconic/open-iconic 13 | */ 14 | 15 | 16 | #ifndef FONT_H_ 17 | #define FONT_H_ 18 | 19 | #include 20 | 21 | #include "ugui/types.h" 22 | 23 | #define FONT_DEFAULT (&font_robotomono_regular_16) 24 | 25 | //Struct encapsulating a font style 26 | //TODO: this seemingly has to be public to allow fonts to be instantiated 27 | //maybe there is a better way here 28 | struct font_style_s 29 | { 30 | uint8_t glyph_count; 31 | uint8_t first_ascii_code; 32 | uint8_t glyph_width_bytes; 33 | uint8_t glyph_height; 34 | uint8_t fixed_width; 35 | uint8_t const *glyph_width; 36 | uint8_t const *glyph_bitmaps; 37 | }; 38 | 39 | typedef struct font_style_s font_style_t; 40 | 41 | int ugui_font_get_text_size(font_style_t *font, char *c, ugui_size_t* size); 42 | 43 | int _ugui_font_get_glyph(font_style_t *font, char c, ugui_sprite_t* glyph); 44 | 45 | extern font_style_t font_robotomono_regular_16; 46 | extern font_style_t font_robotomono_regular_18; 47 | extern font_style_t font_robotomono_regular_24; 48 | extern font_style_t font_robotomono_regular_32; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /ugui/fonts/font_manager.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef FONT_MANAGER_H 4 | #define FONT_MANAGER_H 5 | 6 | //TODO: How to do this? Should this be a generic "resource" manager? 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /ugui/fonts/robotomono_regular_16.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Font header template 3 | * For use with the ugui python ttf font -> sprite generator 4 | * See build-font.py 5 | * 6 | * Font name: robotomono_regular 7 | * Font size: 16 8 | * Start char: 32 9 | * End char: 126 10 | */ 11 | 12 | #include 13 | 14 | #include "ugui/font.h" 15 | 16 | #ifndef FONT_ROBOTOMONO_REGULAR_16_H 17 | #define FONT_ROBOTOMONO_REGULAR_16_H 18 | 19 | font_style_t font_robotomono_regular_16; 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /ugui/fonts/robotomono_regular_18.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Font header template 3 | * For use with the ugui python ttf font -> sprite generator 4 | * See build-font.py 5 | * 6 | * Font name: robotomono_regular 7 | * Font size: 18 8 | * Start char: 32 9 | * End char: 126 10 | */ 11 | 12 | #include 13 | 14 | #include "ugui/font.h" 15 | 16 | #ifndef FONT_ROBOTOMONO_REGULAR_18_H 17 | #define FONT_ROBOTOMONO_REGULAR_18_H 18 | 19 | font_style_t font_robotomono_regular_18; 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /ugui/fonts/robotomono_regular_24.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Font header template 3 | * For use with the ugui python ttf font -> sprite generator 4 | * See build-font.py 5 | * 6 | * Font name: robotomono_regular 7 | * Font size: 24 8 | * Start char: 32 9 | * End char: 126 10 | */ 11 | 12 | #include 13 | 14 | #include "ugui/font.h" 15 | 16 | #ifndef FONT_ROBOTOMONO_REGULAR_24_H 17 | #define FONT_ROBOTOMONO_REGULAR_24_H 18 | 19 | font_style_t font_robotomono_regular_24; 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /ugui/fonts/robotomono_regular_32.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Font header template 3 | * For use with the ugui python ttf font -> sprite generator 4 | * See build-font.py 5 | * 6 | * Font name: robotomono_regular 7 | * Font size: 32 8 | * Start char: 32 9 | * End char: 126 10 | */ 11 | 12 | #include 13 | 14 | #include "ugui/font.h" 15 | 16 | #ifndef FONT_ROBOTOMONO_REGULAR_32_H 17 | #define FONT_ROBOTOMONO_REGULAR_32_H 18 | 19 | font_style_t font_robotomono_regular_32; 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /ugui/graphics.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GRAPHICS_H 3 | #define GRAPHICS_H 4 | 5 | #include 6 | #include 7 | 8 | #include "ugui/types.h" 9 | #include "ugui/font.h" 10 | 11 | #include "ugui/buffer.h" 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | /*** Public ***/ 18 | 19 | typedef struct ugui_graphics_s ugui_graphics_t; 20 | 21 | ugui_graphics_t* ugui_graphics_create(uint32_t w, uint32_t h, ugui_buffer_t* buffer); 22 | 23 | void ugui_graphics_destroy(ugui_graphics_t* graphics); 24 | 25 | void ugui_graphics_draw_line(ugui_graphics_t* graphics, ugui_point_t a, ugui_point_t b); 26 | 27 | void ugui_graphics_draw_rect(ugui_graphics_t *graphics, ugui_point_t a, ugui_size_t size); 28 | 29 | void ugui_graphics_fill_rect(ugui_graphics_t *graphics, ugui_point_t a, ugui_size_t size); 30 | 31 | void ugui_graphics_inverse_rect(ugui_graphics_t *graphics, ugui_point_t a, ugui_size_t size); 32 | 33 | void ugui_graphics_draw_ellipse(ugui_graphics_t* graphics, ugui_rect_t rect); 34 | 35 | void ugui_graphics_draw_sprite(ugui_graphics_t* graphics, ugui_sprite_t sprite, ugui_point_t point); 36 | 37 | void ugui_graphics_draw_text(ugui_graphics_t* graphics, char* text, font_style_t* font, ugui_point_t point); 38 | 39 | void ugui_graphics_clear(ugui_graphics_t* graphics); 40 | 41 | 42 | /*** Private ***/ 43 | 44 | void _ugui_graphics_push_layer_ctx(ugui_graphics_t* graphics, ugui_rect_t *bounds); 45 | 46 | void _ugui_graphics_pop_layer_ctx(ugui_graphics_t* graphics, ugui_rect_t *bounds); 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /ugui/icons/icons_1x.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Icon header template 3 | * For use with the ugui python open-iconic -> sprite generator 4 | * See build-iconic.py 5 | * 6 | * Template: ./scripts/icon-template.h 7 | * Scale: 1 8 | */ 9 | 10 | #include 11 | 12 | #ifndef ICONS_1X_H 13 | #define ICONS_1X_H 14 | 15 | uint8_t icon_account_login[64]; 16 | uint8_t icon_account_logout[64]; 17 | uint8_t icon_action_redo[64]; 18 | uint8_t icon_action_undo[64]; 19 | uint8_t icon_align_center[64]; 20 | uint8_t icon_align_left[64]; 21 | uint8_t icon_align_right[64]; 22 | uint8_t icon_aperture[64]; 23 | uint8_t icon_arrow_bottom[64]; 24 | uint8_t icon_arrow_circle_bottom[64]; 25 | uint8_t icon_arrow_circle_left[64]; 26 | uint8_t icon_arrow_circle_right[64]; 27 | uint8_t icon_arrow_circle_top[64]; 28 | uint8_t icon_arrow_left[64]; 29 | uint8_t icon_arrow_right[64]; 30 | uint8_t icon_arrow_thick_bottom[64]; 31 | uint8_t icon_arrow_thick_left[64]; 32 | uint8_t icon_arrow_thick_right[64]; 33 | uint8_t icon_arrow_thick_top[64]; 34 | uint8_t icon_arrow_top[64]; 35 | uint8_t icon_audio_spectrum[64]; 36 | uint8_t icon_audio[64]; 37 | uint8_t icon_badge[64]; 38 | uint8_t icon_ban[64]; 39 | uint8_t icon_bar_chart[64]; 40 | uint8_t icon_basket[64]; 41 | uint8_t icon_battery_empty[64]; 42 | uint8_t icon_battery_full[64]; 43 | uint8_t icon_beaker[64]; 44 | uint8_t icon_bell[64]; 45 | uint8_t icon_bluetooth[64]; 46 | uint8_t icon_bold[64]; 47 | uint8_t icon_bolt[64]; 48 | uint8_t icon_book[64]; 49 | uint8_t icon_bookmark[64]; 50 | uint8_t icon_box[64]; 51 | uint8_t icon_briefcase[64]; 52 | uint8_t icon_british_pound[64]; 53 | uint8_t icon_browser[64]; 54 | uint8_t icon_brush[64]; 55 | uint8_t icon_bug[64]; 56 | uint8_t icon_bullhorn[64]; 57 | uint8_t icon_calculator[64]; 58 | uint8_t icon_calendar[64]; 59 | uint8_t icon_camera_slr[64]; 60 | uint8_t icon_caret_bottom[64]; 61 | uint8_t icon_caret_left[64]; 62 | uint8_t icon_caret_right[64]; 63 | uint8_t icon_caret_top[64]; 64 | uint8_t icon_cart[64]; 65 | uint8_t icon_chat[64]; 66 | uint8_t icon_check[64]; 67 | uint8_t icon_chevron_bottom[64]; 68 | uint8_t icon_chevron_left[64]; 69 | uint8_t icon_chevron_right[64]; 70 | uint8_t icon_chevron_top[64]; 71 | uint8_t icon_circle_check[64]; 72 | uint8_t icon_circle_x[64]; 73 | uint8_t icon_clipboard[64]; 74 | uint8_t icon_clock[64]; 75 | uint8_t icon_cloud_download[64]; 76 | uint8_t icon_cloud_upload[64]; 77 | uint8_t icon_cloud[64]; 78 | uint8_t icon_cloudy[64]; 79 | uint8_t icon_code[64]; 80 | uint8_t icon_cog[64]; 81 | uint8_t icon_collapse_down[64]; 82 | uint8_t icon_collapse_left[64]; 83 | uint8_t icon_collapse_right[64]; 84 | uint8_t icon_collapse_up[64]; 85 | uint8_t icon_command[64]; 86 | uint8_t icon_comment_square[64]; 87 | uint8_t icon_compass[64]; 88 | uint8_t icon_contrast[64]; 89 | uint8_t icon_copywriting[64]; 90 | uint8_t icon_credit_card[64]; 91 | uint8_t icon_crop[64]; 92 | uint8_t icon_dashboard[64]; 93 | uint8_t icon_data_transfer_download[64]; 94 | uint8_t icon_data_transfer_upload[64]; 95 | uint8_t icon_delete[64]; 96 | uint8_t icon_dial[64]; 97 | uint8_t icon_document[64]; 98 | uint8_t icon_dollar[64]; 99 | uint8_t icon_double_quote_sans_left[64]; 100 | uint8_t icon_double_quote_sans_right[64]; 101 | uint8_t icon_double_quote_serif_left[64]; 102 | uint8_t icon_double_quote_serif_right[64]; 103 | uint8_t icon_droplet[64]; 104 | uint8_t icon_eject[64]; 105 | uint8_t icon_elevator[64]; 106 | uint8_t icon_ellipses[64]; 107 | uint8_t icon_envelope_closed[64]; 108 | uint8_t icon_envelope_open[64]; 109 | uint8_t icon_euro[64]; 110 | uint8_t icon_excerpt[64]; 111 | uint8_t icon_expand_down[64]; 112 | uint8_t icon_expand_left[64]; 113 | uint8_t icon_expand_right[64]; 114 | uint8_t icon_expand_up[64]; 115 | uint8_t icon_external_link[64]; 116 | uint8_t icon_eye[64]; 117 | uint8_t icon_eyedropper[64]; 118 | uint8_t icon_file[64]; 119 | uint8_t icon_fire[64]; 120 | uint8_t icon_flag[64]; 121 | uint8_t icon_flash[64]; 122 | uint8_t icon_folder[64]; 123 | uint8_t icon_fork[64]; 124 | uint8_t icon_fullscreen_enter[64]; 125 | uint8_t icon_fullscreen_exit[64]; 126 | uint8_t icon_globe[64]; 127 | uint8_t icon_graph[64]; 128 | uint8_t icon_grid_four_up[64]; 129 | uint8_t icon_grid_three_up[64]; 130 | uint8_t icon_grid_two_up[64]; 131 | uint8_t icon_hard_drive[64]; 132 | uint8_t icon_header[64]; 133 | uint8_t icon_headphones[64]; 134 | uint8_t icon_heart[64]; 135 | uint8_t icon_home[64]; 136 | uint8_t icon_image[64]; 137 | uint8_t icon_inbox[64]; 138 | uint8_t icon_infinity[64]; 139 | uint8_t icon_info[64]; 140 | uint8_t icon_italic[64]; 141 | uint8_t icon_justify_center[64]; 142 | uint8_t icon_justify_left[64]; 143 | uint8_t icon_justify_right[64]; 144 | uint8_t icon_key[64]; 145 | uint8_t icon_laptop[64]; 146 | uint8_t icon_layers[64]; 147 | uint8_t icon_lightbulb[64]; 148 | uint8_t icon_link_broken[64]; 149 | uint8_t icon_link_intact[64]; 150 | uint8_t icon_list_rich[64]; 151 | uint8_t icon_list[64]; 152 | uint8_t icon_location[64]; 153 | uint8_t icon_lock_locked[64]; 154 | uint8_t icon_lock_unlocked[64]; 155 | uint8_t icon_loop_circular[64]; 156 | uint8_t icon_loop_square[64]; 157 | uint8_t icon_loop[64]; 158 | uint8_t icon_magnifying_glass[64]; 159 | uint8_t icon_map_marker[64]; 160 | uint8_t icon_map[64]; 161 | uint8_t icon_media_pause[64]; 162 | uint8_t icon_media_play[64]; 163 | uint8_t icon_media_record[64]; 164 | uint8_t icon_media_skip_backward[64]; 165 | uint8_t icon_media_skip_forward[64]; 166 | uint8_t icon_media_step_backward[64]; 167 | uint8_t icon_media_step_forward[64]; 168 | uint8_t icon_media_stop[64]; 169 | uint8_t icon_medical_cross[64]; 170 | uint8_t icon_menu[64]; 171 | uint8_t icon_microphone[64]; 172 | uint8_t icon_minus[64]; 173 | uint8_t icon_monitor[64]; 174 | uint8_t icon_moon[64]; 175 | uint8_t icon_move[64]; 176 | uint8_t icon_musical_note[64]; 177 | uint8_t icon_paperclip[64]; 178 | uint8_t icon_pencil[64]; 179 | uint8_t icon_people[64]; 180 | uint8_t icon_person[64]; 181 | uint8_t icon_phone[64]; 182 | uint8_t icon_pie_chart[64]; 183 | uint8_t icon_pin[64]; 184 | uint8_t icon_play_circle[64]; 185 | uint8_t icon_plus[64]; 186 | uint8_t icon_power_standby[64]; 187 | uint8_t icon_print[64]; 188 | uint8_t icon_project[64]; 189 | uint8_t icon_pulse[64]; 190 | uint8_t icon_puzzle_piece[64]; 191 | uint8_t icon_question_mark[64]; 192 | uint8_t icon_rain[64]; 193 | uint8_t icon_random[64]; 194 | uint8_t icon_reload[64]; 195 | uint8_t icon_resize_both[64]; 196 | uint8_t icon_resize_height[64]; 197 | uint8_t icon_resize_width[64]; 198 | uint8_t icon_rss_alt[64]; 199 | uint8_t icon_rss[64]; 200 | uint8_t icon_script[64]; 201 | uint8_t icon_share_boxed[64]; 202 | uint8_t icon_share[64]; 203 | uint8_t icon_shield[64]; 204 | uint8_t icon_signal[64]; 205 | uint8_t icon_signpost[64]; 206 | uint8_t icon_sort_ascending[64]; 207 | uint8_t icon_sort_descending[64]; 208 | uint8_t icon_spreadsheet[64]; 209 | uint8_t icon_star[64]; 210 | uint8_t icon_sun[64]; 211 | uint8_t icon_tablet[64]; 212 | uint8_t icon_tag[64]; 213 | uint8_t icon_tags[64]; 214 | uint8_t icon_target[64]; 215 | uint8_t icon_task[64]; 216 | uint8_t icon_terminal[64]; 217 | uint8_t icon_text[64]; 218 | uint8_t icon_thumb_down[64]; 219 | uint8_t icon_thumb_up[64]; 220 | uint8_t icon_timer[64]; 221 | uint8_t icon_transfer[64]; 222 | uint8_t icon_trash[64]; 223 | uint8_t icon_underline[64]; 224 | uint8_t icon_vertical_align_bottom[64]; 225 | uint8_t icon_vertical_align_center[64]; 226 | uint8_t icon_vertical_align_top[64]; 227 | uint8_t icon_video[64]; 228 | uint8_t icon_volume_high[64]; 229 | uint8_t icon_volume_low[64]; 230 | uint8_t icon_volume_off[64]; 231 | uint8_t icon_warning[64]; 232 | uint8_t icon_wifi[64]; 233 | uint8_t icon_wrench[64]; 234 | uint8_t icon_x[64]; 235 | uint8_t icon_yen[64]; 236 | uint8_t icon_zoom_in[64]; 237 | uint8_t icon_zoom_out[64]; 238 | 239 | #endif 240 | -------------------------------------------------------------------------------- /ugui/icons/icons_2x.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Icon header template 3 | * For use with the ugui python open-iconic -> sprite generator 4 | * See build-iconic.py 5 | * 6 | * Template: ./scripts/icon-template.h 7 | * Scale: 2 8 | */ 9 | 10 | #include 11 | 12 | #ifndef ICONS_2X_H 13 | #define ICONS_2X_H 14 | 15 | uint8_t icon_account_login_2x[256]; 16 | uint8_t icon_account_logout_2x[256]; 17 | uint8_t icon_action_redo_2x[256]; 18 | uint8_t icon_action_undo_2x[256]; 19 | uint8_t icon_align_center_2x[256]; 20 | uint8_t icon_align_left_2x[256]; 21 | uint8_t icon_align_right_2x[256]; 22 | uint8_t icon_aperture_2x[256]; 23 | uint8_t icon_arrow_bottom_2x[256]; 24 | uint8_t icon_arrow_circle_bottom_2x[256]; 25 | uint8_t icon_arrow_circle_left_2x[256]; 26 | uint8_t icon_arrow_circle_right_2x[256]; 27 | uint8_t icon_arrow_circle_top_2x[256]; 28 | uint8_t icon_arrow_left_2x[256]; 29 | uint8_t icon_arrow_right_2x[256]; 30 | uint8_t icon_arrow_thick_bottom_2x[256]; 31 | uint8_t icon_arrow_thick_left_2x[256]; 32 | uint8_t icon_arrow_thick_right_2x[256]; 33 | uint8_t icon_arrow_thick_top_2x[256]; 34 | uint8_t icon_arrow_top_2x[256]; 35 | uint8_t icon_audio_2x[256]; 36 | uint8_t icon_audio_spectrum_2x[256]; 37 | uint8_t icon_badge_2x[256]; 38 | uint8_t icon_ban_2x[256]; 39 | uint8_t icon_bar_chart_2x[256]; 40 | uint8_t icon_basket_2x[256]; 41 | uint8_t icon_battery_empty_2x[256]; 42 | uint8_t icon_battery_full_2x[256]; 43 | uint8_t icon_beaker_2x[256]; 44 | uint8_t icon_bell_2x[256]; 45 | uint8_t icon_bluetooth_2x[256]; 46 | uint8_t icon_bold_2x[256]; 47 | uint8_t icon_bolt_2x[256]; 48 | uint8_t icon_book_2x[256]; 49 | uint8_t icon_bookmark_2x[256]; 50 | uint8_t icon_box_2x[256]; 51 | uint8_t icon_briefcase_2x[256]; 52 | uint8_t icon_british_pound_2x[256]; 53 | uint8_t icon_browser_2x[256]; 54 | uint8_t icon_brush_2x[256]; 55 | uint8_t icon_bug_2x[256]; 56 | uint8_t icon_bullhorn_2x[256]; 57 | uint8_t icon_calculator_2x[256]; 58 | uint8_t icon_calendar_2x[256]; 59 | uint8_t icon_camera_slr_2x[256]; 60 | uint8_t icon_caret_bottom_2x[256]; 61 | uint8_t icon_caret_left_2x[256]; 62 | uint8_t icon_caret_right_2x[256]; 63 | uint8_t icon_caret_top_2x[256]; 64 | uint8_t icon_cart_2x[256]; 65 | uint8_t icon_chat_2x[256]; 66 | uint8_t icon_check_2x[256]; 67 | uint8_t icon_chevron_bottom_2x[256]; 68 | uint8_t icon_chevron_left_2x[256]; 69 | uint8_t icon_chevron_right_2x[256]; 70 | uint8_t icon_chevron_top_2x[256]; 71 | uint8_t icon_circle_check_2x[256]; 72 | uint8_t icon_circle_x_2x[256]; 73 | uint8_t icon_clipboard_2x[256]; 74 | uint8_t icon_clock_2x[256]; 75 | uint8_t icon_cloud_2x[256]; 76 | uint8_t icon_cloud_download_2x[256]; 77 | uint8_t icon_cloud_upload_2x[256]; 78 | uint8_t icon_cloudy_2x[256]; 79 | uint8_t icon_code_2x[256]; 80 | uint8_t icon_cog_2x[256]; 81 | uint8_t icon_collapse_down_2x[256]; 82 | uint8_t icon_collapse_left_2x[256]; 83 | uint8_t icon_collapse_right_2x[256]; 84 | uint8_t icon_collapse_up_2x[256]; 85 | uint8_t icon_command_2x[256]; 86 | uint8_t icon_comment_square_2x[256]; 87 | uint8_t icon_compass_2x[256]; 88 | uint8_t icon_contrast_2x[256]; 89 | uint8_t icon_copywriting_2x[256]; 90 | uint8_t icon_credit_card_2x[256]; 91 | uint8_t icon_crop_2x[256]; 92 | uint8_t icon_dashboard_2x[256]; 93 | uint8_t icon_data_transfer_download_2x[256]; 94 | uint8_t icon_data_transfer_upload_2x[256]; 95 | uint8_t icon_delete_2x[256]; 96 | uint8_t icon_dial_2x[256]; 97 | uint8_t icon_document_2x[256]; 98 | uint8_t icon_dollar_2x[256]; 99 | uint8_t icon_double_quote_sans_left_2x[256]; 100 | uint8_t icon_double_quote_sans_right_2x[256]; 101 | uint8_t icon_double_quote_serif_left_2x[256]; 102 | uint8_t icon_double_quote_serif_right_2x[256]; 103 | uint8_t icon_droplet_2x[256]; 104 | uint8_t icon_eject_2x[256]; 105 | uint8_t icon_elevator_2x[256]; 106 | uint8_t icon_ellipses_2x[256]; 107 | uint8_t icon_envelope_closed_2x[256]; 108 | uint8_t icon_envelope_open_2x[256]; 109 | uint8_t icon_euro_2x[256]; 110 | uint8_t icon_excerpt_2x[256]; 111 | uint8_t icon_expand_down_2x[256]; 112 | uint8_t icon_expand_left_2x[256]; 113 | uint8_t icon_expand_right_2x[256]; 114 | uint8_t icon_expand_up_2x[256]; 115 | uint8_t icon_external_link_2x[256]; 116 | uint8_t icon_eye_2x[256]; 117 | uint8_t icon_eyedropper_2x[256]; 118 | uint8_t icon_file_2x[256]; 119 | uint8_t icon_fire_2x[256]; 120 | uint8_t icon_flag_2x[256]; 121 | uint8_t icon_flash_2x[256]; 122 | uint8_t icon_folder_2x[256]; 123 | uint8_t icon_fork_2x[256]; 124 | uint8_t icon_fullscreen_enter_2x[256]; 125 | uint8_t icon_fullscreen_exit_2x[256]; 126 | uint8_t icon_globe_2x[256]; 127 | uint8_t icon_graph_2x[256]; 128 | uint8_t icon_grid_four_up_2x[256]; 129 | uint8_t icon_grid_three_up_2x[256]; 130 | uint8_t icon_grid_two_up_2x[256]; 131 | uint8_t icon_hard_drive_2x[256]; 132 | uint8_t icon_header_2x[256]; 133 | uint8_t icon_headphones_2x[256]; 134 | uint8_t icon_heart_2x[256]; 135 | uint8_t icon_home_2x[256]; 136 | uint8_t icon_image_2x[256]; 137 | uint8_t icon_inbox_2x[256]; 138 | uint8_t icon_infinity_2x[256]; 139 | uint8_t icon_info_2x[256]; 140 | uint8_t icon_italic_2x[256]; 141 | uint8_t icon_justify_center_2x[256]; 142 | uint8_t icon_justify_left_2x[256]; 143 | uint8_t icon_justify_right_2x[256]; 144 | uint8_t icon_key_2x[256]; 145 | uint8_t icon_laptop_2x[256]; 146 | uint8_t icon_layers_2x[256]; 147 | uint8_t icon_lightbulb_2x[256]; 148 | uint8_t icon_link_broken_2x[256]; 149 | uint8_t icon_link_intact_2x[256]; 150 | uint8_t icon_list_2x[256]; 151 | uint8_t icon_list_rich_2x[256]; 152 | uint8_t icon_location_2x[256]; 153 | uint8_t icon_lock_locked_2x[256]; 154 | uint8_t icon_lock_unlocked_2x[256]; 155 | uint8_t icon_loop_2x[256]; 156 | uint8_t icon_loop_circular_2x[256]; 157 | uint8_t icon_loop_square_2x[256]; 158 | uint8_t icon_magnifying_glass_2x[256]; 159 | uint8_t icon_map_2x[256]; 160 | uint8_t icon_map_marker_2x[256]; 161 | uint8_t icon_media_pause_2x[256]; 162 | uint8_t icon_media_play_2x[256]; 163 | uint8_t icon_media_record_2x[256]; 164 | uint8_t icon_media_skip_backward_2x[256]; 165 | uint8_t icon_media_skip_forward_2x[256]; 166 | uint8_t icon_media_step_backward_2x[256]; 167 | uint8_t icon_media_step_forward_2x[256]; 168 | uint8_t icon_media_stop_2x[256]; 169 | uint8_t icon_medical_cross_2x[256]; 170 | uint8_t icon_menu_2x[256]; 171 | uint8_t icon_microphone_2x[256]; 172 | uint8_t icon_minus_2x[256]; 173 | uint8_t icon_monitor_2x[256]; 174 | uint8_t icon_moon_2x[256]; 175 | uint8_t icon_move_2x[256]; 176 | uint8_t icon_musical_note_2x[256]; 177 | uint8_t icon_paperclip_2x[256]; 178 | uint8_t icon_pencil_2x[256]; 179 | uint8_t icon_people_2x[256]; 180 | uint8_t icon_person_2x[256]; 181 | uint8_t icon_phone_2x[256]; 182 | uint8_t icon_pie_chart_2x[256]; 183 | uint8_t icon_pin_2x[256]; 184 | uint8_t icon_play_circle_2x[256]; 185 | uint8_t icon_plus_2x[256]; 186 | uint8_t icon_power_standby_2x[256]; 187 | uint8_t icon_print_2x[256]; 188 | uint8_t icon_project_2x[256]; 189 | uint8_t icon_pulse_2x[256]; 190 | uint8_t icon_puzzle_piece_2x[256]; 191 | uint8_t icon_question_mark_2x[256]; 192 | uint8_t icon_rain_2x[256]; 193 | uint8_t icon_random_2x[256]; 194 | uint8_t icon_reload_2x[256]; 195 | uint8_t icon_resize_both_2x[256]; 196 | uint8_t icon_resize_height_2x[256]; 197 | uint8_t icon_resize_width_2x[256]; 198 | uint8_t icon_rss_2x[256]; 199 | uint8_t icon_rss_alt_2x[256]; 200 | uint8_t icon_script_2x[256]; 201 | uint8_t icon_share_2x[256]; 202 | uint8_t icon_share_boxed_2x[256]; 203 | uint8_t icon_shield_2x[256]; 204 | uint8_t icon_signal_2x[256]; 205 | uint8_t icon_signpost_2x[256]; 206 | uint8_t icon_sort_ascending_2x[256]; 207 | uint8_t icon_sort_descending_2x[256]; 208 | uint8_t icon_spreadsheet_2x[256]; 209 | uint8_t icon_star_2x[256]; 210 | uint8_t icon_sun_2x[256]; 211 | uint8_t icon_tablet_2x[256]; 212 | uint8_t icon_tag_2x[256]; 213 | uint8_t icon_tags_2x[256]; 214 | uint8_t icon_target_2x[256]; 215 | uint8_t icon_task_2x[256]; 216 | uint8_t icon_terminal_2x[256]; 217 | uint8_t icon_text_2x[256]; 218 | uint8_t icon_thumb_down_2x[256]; 219 | uint8_t icon_thumb_up_2x[256]; 220 | uint8_t icon_timer_2x[256]; 221 | uint8_t icon_transfer_2x[256]; 222 | uint8_t icon_trash_2x[256]; 223 | uint8_t icon_underline_2x[256]; 224 | uint8_t icon_vertical_align_bottom_2x[256]; 225 | uint8_t icon_vertical_align_center_2x[256]; 226 | uint8_t icon_vertical_align_top_2x[256]; 227 | uint8_t icon_video_2x[256]; 228 | uint8_t icon_volume_high_2x[256]; 229 | uint8_t icon_volume_low_2x[256]; 230 | uint8_t icon_volume_off_2x[256]; 231 | uint8_t icon_warning_2x[256]; 232 | uint8_t icon_wifi_2x[256]; 233 | uint8_t icon_wrench_2x[256]; 234 | uint8_t icon_x_2x[256]; 235 | uint8_t icon_yen_2x[256]; 236 | uint8_t icon_zoom_in_2x[256]; 237 | uint8_t icon_zoom_out_2x[256]; 238 | 239 | #endif 240 | -------------------------------------------------------------------------------- /ugui/icons/icons_4x.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Icon header template 3 | * For use with the ugui python open-iconic -> sprite generator 4 | * See build-iconic.py 5 | * 6 | * Template: ./scripts/icon-template.h 7 | * Scale: 4 8 | */ 9 | 10 | #include 11 | 12 | #ifndef ICONS_4X_H 13 | #define ICONS_4X_H 14 | 15 | uint8_t icon_account_login_4x[1024]; 16 | uint8_t icon_account_logout_4x[1024]; 17 | uint8_t icon_action_redo_4x[1024]; 18 | uint8_t icon_action_undo_4x[1024]; 19 | uint8_t icon_align_center_4x[1024]; 20 | uint8_t icon_align_left_4x[1024]; 21 | uint8_t icon_align_right_4x[1024]; 22 | uint8_t icon_aperture_4x[1024]; 23 | uint8_t icon_arrow_bottom_4x[1024]; 24 | uint8_t icon_arrow_circle_bottom_4x[1024]; 25 | uint8_t icon_arrow_circle_left_4x[1024]; 26 | uint8_t icon_arrow_circle_right_4x[1024]; 27 | uint8_t icon_arrow_circle_top_4x[1024]; 28 | uint8_t icon_arrow_left_4x[1024]; 29 | uint8_t icon_arrow_right_4x[1024]; 30 | uint8_t icon_arrow_thick_bottom_4x[1024]; 31 | uint8_t icon_arrow_thick_left_4x[1024]; 32 | uint8_t icon_arrow_thick_right_4x[1024]; 33 | uint8_t icon_arrow_thick_top_4x[1024]; 34 | uint8_t icon_arrow_top_4x[1024]; 35 | uint8_t icon_audio_4x[1024]; 36 | uint8_t icon_audio_spectrum_4x[1024]; 37 | uint8_t icon_badge_4x[1024]; 38 | uint8_t icon_ban_4x[1024]; 39 | uint8_t icon_bar_chart_4x[1024]; 40 | uint8_t icon_basket_4x[1024]; 41 | uint8_t icon_battery_empty_4x[1024]; 42 | uint8_t icon_battery_full_4x[1024]; 43 | uint8_t icon_beaker_4x[1024]; 44 | uint8_t icon_bell_4x[1024]; 45 | uint8_t icon_bluetooth_4x[1024]; 46 | uint8_t icon_bold_4x[1024]; 47 | uint8_t icon_bolt_4x[1024]; 48 | uint8_t icon_book_4x[1024]; 49 | uint8_t icon_bookmark_4x[1024]; 50 | uint8_t icon_box_4x[1024]; 51 | uint8_t icon_briefcase_4x[1024]; 52 | uint8_t icon_british_pound_4x[1024]; 53 | uint8_t icon_browser_4x[1024]; 54 | uint8_t icon_brush_4x[1024]; 55 | uint8_t icon_bug_4x[1024]; 56 | uint8_t icon_bullhorn_4x[1024]; 57 | uint8_t icon_calculator_4x[1024]; 58 | uint8_t icon_calendar_4x[1024]; 59 | uint8_t icon_camera_slr_4x[1024]; 60 | uint8_t icon_caret_bottom_4x[1024]; 61 | uint8_t icon_caret_left_4x[1024]; 62 | uint8_t icon_caret_right_4x[1024]; 63 | uint8_t icon_caret_top_4x[1024]; 64 | uint8_t icon_cart_4x[1024]; 65 | uint8_t icon_chat_4x[1024]; 66 | uint8_t icon_check_4x[1024]; 67 | uint8_t icon_chevron_bottom_4x[1024]; 68 | uint8_t icon_chevron_left_4x[1024]; 69 | uint8_t icon_chevron_right_4x[1024]; 70 | uint8_t icon_chevron_top_4x[1024]; 71 | uint8_t icon_circle_check_4x[1024]; 72 | uint8_t icon_circle_x_4x[1024]; 73 | uint8_t icon_clipboard_4x[1024]; 74 | uint8_t icon_clock_4x[1024]; 75 | uint8_t icon_cloud_4x[1024]; 76 | uint8_t icon_cloud_download_4x[1024]; 77 | uint8_t icon_cloud_upload_4x[1024]; 78 | uint8_t icon_cloudy_4x[1024]; 79 | uint8_t icon_code_4x[1024]; 80 | uint8_t icon_cog_4x[1024]; 81 | uint8_t icon_collapse_down_4x[1024]; 82 | uint8_t icon_collapse_left_4x[1024]; 83 | uint8_t icon_collapse_right_4x[1024]; 84 | uint8_t icon_collapse_up_4x[1024]; 85 | uint8_t icon_command_4x[1024]; 86 | uint8_t icon_comment_square_4x[1024]; 87 | uint8_t icon_compass_4x[1024]; 88 | uint8_t icon_contrast_4x[1024]; 89 | uint8_t icon_copywriting_4x[1024]; 90 | uint8_t icon_credit_card_4x[1024]; 91 | uint8_t icon_crop_4x[1024]; 92 | uint8_t icon_dashboard_4x[1024]; 93 | uint8_t icon_data_transfer_download_4x[1024]; 94 | uint8_t icon_data_transfer_upload_4x[1024]; 95 | uint8_t icon_delete_4x[1024]; 96 | uint8_t icon_dial_4x[1024]; 97 | uint8_t icon_document_4x[1024]; 98 | uint8_t icon_dollar_4x[1024]; 99 | uint8_t icon_double_quote_sans_left_4x[1024]; 100 | uint8_t icon_double_quote_sans_right_4x[1024]; 101 | uint8_t icon_double_quote_serif_left_4x[1024]; 102 | uint8_t icon_double_quote_serif_right_4x[1024]; 103 | uint8_t icon_droplet_4x[1024]; 104 | uint8_t icon_eject_4x[1024]; 105 | uint8_t icon_elevator_4x[1024]; 106 | uint8_t icon_ellipses_4x[1024]; 107 | uint8_t icon_envelope_closed_4x[1024]; 108 | uint8_t icon_envelope_open_4x[1024]; 109 | uint8_t icon_euro_4x[1024]; 110 | uint8_t icon_excerpt_4x[1024]; 111 | uint8_t icon_expand_down_4x[1024]; 112 | uint8_t icon_expand_left_4x[1024]; 113 | uint8_t icon_expand_right_4x[1024]; 114 | uint8_t icon_expand_up_4x[1024]; 115 | uint8_t icon_external_link_4x[1024]; 116 | uint8_t icon_eye_4x[1024]; 117 | uint8_t icon_eyedropper_4x[1024]; 118 | uint8_t icon_file_4x[1024]; 119 | uint8_t icon_fire_4x[1024]; 120 | uint8_t icon_flag_4x[1024]; 121 | uint8_t icon_flash_4x[1024]; 122 | uint8_t icon_folder_4x[1024]; 123 | uint8_t icon_fork_4x[1024]; 124 | uint8_t icon_fullscreen_enter_4x[1024]; 125 | uint8_t icon_fullscreen_exit_4x[1024]; 126 | uint8_t icon_globe_4x[1024]; 127 | uint8_t icon_graph_4x[1024]; 128 | uint8_t icon_grid_four_up_4x[1024]; 129 | uint8_t icon_grid_three_up_4x[1024]; 130 | uint8_t icon_grid_two_up_4x[1024]; 131 | uint8_t icon_hard_drive_4x[1024]; 132 | uint8_t icon_header_4x[1024]; 133 | uint8_t icon_headphones_4x[1024]; 134 | uint8_t icon_heart_4x[1024]; 135 | uint8_t icon_home_4x[1024]; 136 | uint8_t icon_image_4x[1024]; 137 | uint8_t icon_inbox_4x[1024]; 138 | uint8_t icon_infinity_4x[1024]; 139 | uint8_t icon_info_4x[1024]; 140 | uint8_t icon_italic_4x[1024]; 141 | uint8_t icon_justify_center_4x[1024]; 142 | uint8_t icon_justify_left_4x[1024]; 143 | uint8_t icon_justify_right_4x[1024]; 144 | uint8_t icon_key_4x[1024]; 145 | uint8_t icon_laptop_4x[1024]; 146 | uint8_t icon_layers_4x[1024]; 147 | uint8_t icon_lightbulb_4x[1024]; 148 | uint8_t icon_link_broken_4x[1024]; 149 | uint8_t icon_link_intact_4x[1024]; 150 | uint8_t icon_list_4x[1024]; 151 | uint8_t icon_list_rich_4x[1024]; 152 | uint8_t icon_location_4x[1024]; 153 | uint8_t icon_lock_locked_4x[1024]; 154 | uint8_t icon_lock_unlocked_4x[1024]; 155 | uint8_t icon_loop_4x[1024]; 156 | uint8_t icon_loop_circular_4x[1024]; 157 | uint8_t icon_loop_square_4x[1024]; 158 | uint8_t icon_magnifying_glass_4x[1024]; 159 | uint8_t icon_map_4x[1024]; 160 | uint8_t icon_map_marker_4x[1024]; 161 | uint8_t icon_media_pause_4x[1024]; 162 | uint8_t icon_media_play_4x[1024]; 163 | uint8_t icon_media_record_4x[1024]; 164 | uint8_t icon_media_skip_backward_4x[1024]; 165 | uint8_t icon_media_skip_forward_4x[1024]; 166 | uint8_t icon_media_step_backward_4x[1024]; 167 | uint8_t icon_media_step_forward_4x[1024]; 168 | uint8_t icon_media_stop_4x[1024]; 169 | uint8_t icon_medical_cross_4x[1024]; 170 | uint8_t icon_menu_4x[1024]; 171 | uint8_t icon_microphone_4x[1024]; 172 | uint8_t icon_minus_4x[1024]; 173 | uint8_t icon_monitor_4x[1024]; 174 | uint8_t icon_moon_4x[1024]; 175 | uint8_t icon_move_4x[1024]; 176 | uint8_t icon_musical_note_4x[1024]; 177 | uint8_t icon_paperclip_4x[1024]; 178 | uint8_t icon_pencil_4x[1024]; 179 | uint8_t icon_people_4x[1024]; 180 | uint8_t icon_person_4x[1024]; 181 | uint8_t icon_phone_4x[1024]; 182 | uint8_t icon_pie_chart_4x[1024]; 183 | uint8_t icon_pin_4x[1024]; 184 | uint8_t icon_play_circle_4x[1024]; 185 | uint8_t icon_plus_4x[1024]; 186 | uint8_t icon_power_standby_4x[1024]; 187 | uint8_t icon_print_4x[1024]; 188 | uint8_t icon_project_4x[1024]; 189 | uint8_t icon_pulse_4x[1024]; 190 | uint8_t icon_puzzle_piece_4x[1024]; 191 | uint8_t icon_question_mark_4x[1024]; 192 | uint8_t icon_rain_4x[1024]; 193 | uint8_t icon_random_4x[1024]; 194 | uint8_t icon_reload_4x[1024]; 195 | uint8_t icon_resize_both_4x[1024]; 196 | uint8_t icon_resize_height_4x[1024]; 197 | uint8_t icon_resize_width_4x[1024]; 198 | uint8_t icon_rss_4x[1024]; 199 | uint8_t icon_rss_alt_4x[1024]; 200 | uint8_t icon_script_4x[1024]; 201 | uint8_t icon_share_4x[1024]; 202 | uint8_t icon_share_boxed_4x[1024]; 203 | uint8_t icon_shield_4x[1024]; 204 | uint8_t icon_signal_4x[1024]; 205 | uint8_t icon_signpost_4x[1024]; 206 | uint8_t icon_sort_ascending_4x[1024]; 207 | uint8_t icon_sort_descending_4x[1024]; 208 | uint8_t icon_spreadsheet_4x[1024]; 209 | uint8_t icon_star_4x[1024]; 210 | uint8_t icon_sun_4x[1024]; 211 | uint8_t icon_tablet_4x[1024]; 212 | uint8_t icon_tag_4x[1024]; 213 | uint8_t icon_tags_4x[1024]; 214 | uint8_t icon_target_4x[1024]; 215 | uint8_t icon_task_4x[1024]; 216 | uint8_t icon_terminal_4x[1024]; 217 | uint8_t icon_text_4x[1024]; 218 | uint8_t icon_thumb_down_4x[1024]; 219 | uint8_t icon_thumb_up_4x[1024]; 220 | uint8_t icon_timer_4x[1024]; 221 | uint8_t icon_transfer_4x[1024]; 222 | uint8_t icon_trash_4x[1024]; 223 | uint8_t icon_underline_4x[1024]; 224 | uint8_t icon_vertical_align_bottom_4x[1024]; 225 | uint8_t icon_vertical_align_center_4x[1024]; 226 | uint8_t icon_vertical_align_top_4x[1024]; 227 | uint8_t icon_video_4x[1024]; 228 | uint8_t icon_volume_high_4x[1024]; 229 | uint8_t icon_volume_low_4x[1024]; 230 | uint8_t icon_volume_off_4x[1024]; 231 | uint8_t icon_warning_4x[1024]; 232 | uint8_t icon_wifi_4x[1024]; 233 | uint8_t icon_wrench_4x[1024]; 234 | uint8_t icon_x_4x[1024]; 235 | uint8_t icon_yen_4x[1024]; 236 | uint8_t icon_zoom_in_4x[1024]; 237 | uint8_t icon_zoom_out_4x[1024]; 238 | 239 | #endif 240 | -------------------------------------------------------------------------------- /ugui/icons/icons_6x.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Icon header template 3 | * For use with the ugui python open-iconic -> sprite generator 4 | * See build-iconic.py 5 | * 6 | * Template: ./scripts/icon-template.h 7 | * Scale: 6 8 | */ 9 | 10 | #include 11 | 12 | #ifndef ICONS_6X_H 13 | #define ICONS_6X_H 14 | 15 | uint8_t icon_account_login_6x[2304]; 16 | uint8_t icon_account_logout_6x[2304]; 17 | uint8_t icon_action_redo_6x[2304]; 18 | uint8_t icon_action_undo_6x[2304]; 19 | uint8_t icon_align_center_6x[2304]; 20 | uint8_t icon_align_left_6x[2304]; 21 | uint8_t icon_align_right_6x[2304]; 22 | uint8_t icon_aperture_6x[2304]; 23 | uint8_t icon_arrow_bottom_6x[2304]; 24 | uint8_t icon_arrow_circle_bottom_6x[2304]; 25 | uint8_t icon_arrow_circle_left_6x[2304]; 26 | uint8_t icon_arrow_circle_right_6x[2304]; 27 | uint8_t icon_arrow_circle_top_6x[2304]; 28 | uint8_t icon_arrow_left_6x[2304]; 29 | uint8_t icon_arrow_right_6x[2304]; 30 | uint8_t icon_arrow_thick_bottom_6x[2304]; 31 | uint8_t icon_arrow_thick_left_6x[2304]; 32 | uint8_t icon_arrow_thick_right_6x[2304]; 33 | uint8_t icon_arrow_thick_top_6x[2304]; 34 | uint8_t icon_arrow_top_6x[2304]; 35 | uint8_t icon_audio_6x[2304]; 36 | uint8_t icon_audio_spectrum_6x[2304]; 37 | uint8_t icon_badge_6x[2304]; 38 | uint8_t icon_ban_6x[2304]; 39 | uint8_t icon_bar_chart_6x[2304]; 40 | uint8_t icon_basket_6x[2304]; 41 | uint8_t icon_battery_empty_6x[2304]; 42 | uint8_t icon_battery_full_6x[2304]; 43 | uint8_t icon_beaker_6x[2304]; 44 | uint8_t icon_bell_6x[2304]; 45 | uint8_t icon_bluetooth_6x[2304]; 46 | uint8_t icon_bold_6x[2304]; 47 | uint8_t icon_bolt_6x[2304]; 48 | uint8_t icon_book_6x[2304]; 49 | uint8_t icon_bookmark_6x[2304]; 50 | uint8_t icon_box_6x[2304]; 51 | uint8_t icon_briefcase_6x[2304]; 52 | uint8_t icon_british_pound_6x[2304]; 53 | uint8_t icon_browser_6x[2304]; 54 | uint8_t icon_brush_6x[2304]; 55 | uint8_t icon_bug_6x[2304]; 56 | uint8_t icon_bullhorn_6x[2304]; 57 | uint8_t icon_calculator_6x[2304]; 58 | uint8_t icon_calendar_6x[2304]; 59 | uint8_t icon_camera_slr_6x[2304]; 60 | uint8_t icon_caret_bottom_6x[2304]; 61 | uint8_t icon_caret_left_6x[2304]; 62 | uint8_t icon_caret_right_6x[2304]; 63 | uint8_t icon_caret_top_6x[2304]; 64 | uint8_t icon_cart_6x[2304]; 65 | uint8_t icon_chat_6x[2304]; 66 | uint8_t icon_check_6x[2304]; 67 | uint8_t icon_chevron_bottom_6x[2304]; 68 | uint8_t icon_chevron_left_6x[2304]; 69 | uint8_t icon_chevron_right_6x[2304]; 70 | uint8_t icon_chevron_top_6x[2304]; 71 | uint8_t icon_circle_check_6x[2304]; 72 | uint8_t icon_circle_x_6x[2304]; 73 | uint8_t icon_clipboard_6x[2304]; 74 | uint8_t icon_clock_6x[2304]; 75 | uint8_t icon_cloud_6x[2304]; 76 | uint8_t icon_cloud_download_6x[2304]; 77 | uint8_t icon_cloud_upload_6x[2304]; 78 | uint8_t icon_cloudy_6x[2304]; 79 | uint8_t icon_code_6x[2304]; 80 | uint8_t icon_cog_6x[2304]; 81 | uint8_t icon_collapse_down_6x[2304]; 82 | uint8_t icon_collapse_left_6x[2304]; 83 | uint8_t icon_collapse_right_6x[2304]; 84 | uint8_t icon_collapse_up_6x[2304]; 85 | uint8_t icon_command_6x[2304]; 86 | uint8_t icon_comment_square_6x[2304]; 87 | uint8_t icon_compass_6x[2304]; 88 | uint8_t icon_contrast_6x[2304]; 89 | uint8_t icon_copywriting_6x[2304]; 90 | uint8_t icon_credit_card_6x[2304]; 91 | uint8_t icon_crop_6x[2304]; 92 | uint8_t icon_dashboard_6x[2304]; 93 | uint8_t icon_data_transfer_download_6x[2304]; 94 | uint8_t icon_data_transfer_upload_6x[2304]; 95 | uint8_t icon_delete_6x[2304]; 96 | uint8_t icon_dial_6x[2304]; 97 | uint8_t icon_document_6x[2304]; 98 | uint8_t icon_dollar_6x[2304]; 99 | uint8_t icon_double_quote_sans_left_6x[2304]; 100 | uint8_t icon_double_quote_sans_right_6x[2304]; 101 | uint8_t icon_double_quote_serif_left_6x[2304]; 102 | uint8_t icon_double_quote_serif_right_6x[2304]; 103 | uint8_t icon_droplet_6x[2304]; 104 | uint8_t icon_eject_6x[2304]; 105 | uint8_t icon_elevator_6x[2304]; 106 | uint8_t icon_ellipses_6x[2304]; 107 | uint8_t icon_envelope_closed_6x[2304]; 108 | uint8_t icon_envelope_open_6x[2304]; 109 | uint8_t icon_euro_6x[2304]; 110 | uint8_t icon_excerpt_6x[2304]; 111 | uint8_t icon_expand_down_6x[2304]; 112 | uint8_t icon_expand_left_6x[2304]; 113 | uint8_t icon_expand_right_6x[2304]; 114 | uint8_t icon_expand_up_6x[2304]; 115 | uint8_t icon_external_link_6x[2304]; 116 | uint8_t icon_eye_6x[2304]; 117 | uint8_t icon_eyedropper_6x[2304]; 118 | uint8_t icon_file_6x[2304]; 119 | uint8_t icon_fire_6x[2304]; 120 | uint8_t icon_flag_6x[2304]; 121 | uint8_t icon_flash_6x[2304]; 122 | uint8_t icon_folder_6x[2304]; 123 | uint8_t icon_fork_6x[2304]; 124 | uint8_t icon_fullscreen_enter_6x[2304]; 125 | uint8_t icon_fullscreen_exit_6x[2304]; 126 | uint8_t icon_globe_6x[2304]; 127 | uint8_t icon_graph_6x[2304]; 128 | uint8_t icon_grid_four_up_6x[2304]; 129 | uint8_t icon_grid_three_up_6x[2304]; 130 | uint8_t icon_grid_two_up_6x[2304]; 131 | uint8_t icon_hard_drive_6x[2304]; 132 | uint8_t icon_header_6x[2304]; 133 | uint8_t icon_headphones_6x[2304]; 134 | uint8_t icon_heart_6x[2304]; 135 | uint8_t icon_home_6x[2304]; 136 | uint8_t icon_image_6x[2304]; 137 | uint8_t icon_inbox_6x[2304]; 138 | uint8_t icon_infinity_6x[2304]; 139 | uint8_t icon_info_6x[2304]; 140 | uint8_t icon_italic_6x[2304]; 141 | uint8_t icon_justify_center_6x[2304]; 142 | uint8_t icon_justify_left_6x[2304]; 143 | uint8_t icon_justify_right_6x[2304]; 144 | uint8_t icon_key_6x[2304]; 145 | uint8_t icon_laptop_6x[2304]; 146 | uint8_t icon_layers_6x[2304]; 147 | uint8_t icon_lightbulb_6x[2304]; 148 | uint8_t icon_link_broken_6x[2304]; 149 | uint8_t icon_link_intact_6x[2304]; 150 | uint8_t icon_list_6x[2304]; 151 | uint8_t icon_list_rich_6x[2304]; 152 | uint8_t icon_location_6x[2304]; 153 | uint8_t icon_lock_locked_6x[2304]; 154 | uint8_t icon_lock_unlocked_6x[2304]; 155 | uint8_t icon_loop_6x[2304]; 156 | uint8_t icon_loop_circular_6x[2304]; 157 | uint8_t icon_loop_square_6x[2304]; 158 | uint8_t icon_magnifying_glass_6x[2304]; 159 | uint8_t icon_map_6x[2304]; 160 | uint8_t icon_map_marker_6x[2304]; 161 | uint8_t icon_media_pause_6x[2304]; 162 | uint8_t icon_media_play_6x[2304]; 163 | uint8_t icon_media_record_6x[2304]; 164 | uint8_t icon_media_skip_backward_6x[2304]; 165 | uint8_t icon_media_skip_forward_6x[2304]; 166 | uint8_t icon_media_step_backward_6x[2304]; 167 | uint8_t icon_media_step_forward_6x[2304]; 168 | uint8_t icon_media_stop_6x[2304]; 169 | uint8_t icon_medical_cross_6x[2304]; 170 | uint8_t icon_menu_6x[2304]; 171 | uint8_t icon_microphone_6x[2304]; 172 | uint8_t icon_minus_6x[2304]; 173 | uint8_t icon_monitor_6x[2304]; 174 | uint8_t icon_moon_6x[2304]; 175 | uint8_t icon_move_6x[2304]; 176 | uint8_t icon_musical_note_6x[2304]; 177 | uint8_t icon_paperclip_6x[2304]; 178 | uint8_t icon_pencil_6x[2304]; 179 | uint8_t icon_people_6x[2304]; 180 | uint8_t icon_person_6x[2304]; 181 | uint8_t icon_phone_6x[2304]; 182 | uint8_t icon_pie_chart_6x[2304]; 183 | uint8_t icon_pin_6x[2304]; 184 | uint8_t icon_play_circle_6x[2304]; 185 | uint8_t icon_plus_6x[2304]; 186 | uint8_t icon_power_standby_6x[2304]; 187 | uint8_t icon_print_6x[2304]; 188 | uint8_t icon_project_6x[2304]; 189 | uint8_t icon_pulse_6x[2304]; 190 | uint8_t icon_puzzle_piece_6x[2304]; 191 | uint8_t icon_question_mark_6x[2304]; 192 | uint8_t icon_rain_6x[2304]; 193 | uint8_t icon_random_6x[2304]; 194 | uint8_t icon_reload_6x[2304]; 195 | uint8_t icon_resize_both_6x[2304]; 196 | uint8_t icon_resize_height_6x[2304]; 197 | uint8_t icon_resize_width_6x[2304]; 198 | uint8_t icon_rss_6x[2304]; 199 | uint8_t icon_rss_alt_6x[2304]; 200 | uint8_t icon_script_6x[2304]; 201 | uint8_t icon_share_6x[2304]; 202 | uint8_t icon_share_boxed_6x[2304]; 203 | uint8_t icon_shield_6x[2304]; 204 | uint8_t icon_signal_6x[2304]; 205 | uint8_t icon_signpost_6x[2304]; 206 | uint8_t icon_sort_ascending_6x[2304]; 207 | uint8_t icon_sort_descending_6x[2304]; 208 | uint8_t icon_spreadsheet_6x[2304]; 209 | uint8_t icon_star_6x[2304]; 210 | uint8_t icon_sun_6x[2304]; 211 | uint8_t icon_tablet_6x[2304]; 212 | uint8_t icon_tag_6x[2304]; 213 | uint8_t icon_tags_6x[2304]; 214 | uint8_t icon_target_6x[2304]; 215 | uint8_t icon_task_6x[2304]; 216 | uint8_t icon_terminal_6x[2304]; 217 | uint8_t icon_text_6x[2304]; 218 | uint8_t icon_thumb_down_6x[2304]; 219 | uint8_t icon_thumb_up_6x[2304]; 220 | uint8_t icon_timer_6x[2304]; 221 | uint8_t icon_transfer_6x[2304]; 222 | uint8_t icon_trash_6x[2304]; 223 | uint8_t icon_underline_6x[2304]; 224 | uint8_t icon_vertical_align_bottom_6x[2304]; 225 | uint8_t icon_vertical_align_center_6x[2304]; 226 | uint8_t icon_vertical_align_top_6x[2304]; 227 | uint8_t icon_video_6x[2304]; 228 | uint8_t icon_volume_high_6x[2304]; 229 | uint8_t icon_volume_low_6x[2304]; 230 | uint8_t icon_volume_off_6x[2304]; 231 | uint8_t icon_warning_6x[2304]; 232 | uint8_t icon_wifi_6x[2304]; 233 | uint8_t icon_wrench_6x[2304]; 234 | uint8_t icon_x_6x[2304]; 235 | uint8_t icon_yen_6x[2304]; 236 | uint8_t icon_zoom_in_6x[2304]; 237 | uint8_t icon_zoom_out_6x[2304]; 238 | 239 | #endif 240 | -------------------------------------------------------------------------------- /ugui/icons/icons_8x.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Icon header template 3 | * For use with the ugui python open-iconic -> sprite generator 4 | * See build-iconic.py 5 | * 6 | * Template: ./scripts/icon-template.h 7 | * Scale: 8 8 | */ 9 | 10 | #include 11 | 12 | #ifndef ICONS_8X_H 13 | #define ICONS_8X_H 14 | 15 | uint8_t icon_account_login_8x[4096]; 16 | uint8_t icon_account_logout_8x[4096]; 17 | uint8_t icon_action_redo_8x[4096]; 18 | uint8_t icon_action_undo_8x[4096]; 19 | uint8_t icon_align_center_8x[4096]; 20 | uint8_t icon_align_left_8x[4096]; 21 | uint8_t icon_align_right_8x[4096]; 22 | uint8_t icon_aperture_8x[4096]; 23 | uint8_t icon_arrow_bottom_8x[4096]; 24 | uint8_t icon_arrow_circle_bottom_8x[4096]; 25 | uint8_t icon_arrow_circle_left_8x[4096]; 26 | uint8_t icon_arrow_circle_right_8x[4096]; 27 | uint8_t icon_arrow_circle_top_8x[4096]; 28 | uint8_t icon_arrow_left_8x[4096]; 29 | uint8_t icon_arrow_right_8x[4096]; 30 | uint8_t icon_arrow_thick_bottom_8x[4096]; 31 | uint8_t icon_arrow_thick_left_8x[4096]; 32 | uint8_t icon_arrow_thick_right_8x[4096]; 33 | uint8_t icon_arrow_thick_top_8x[4096]; 34 | uint8_t icon_arrow_top_8x[4096]; 35 | uint8_t icon_audio_8x[4096]; 36 | uint8_t icon_audio_spectrum_8x[4096]; 37 | uint8_t icon_badge_8x[4096]; 38 | uint8_t icon_ban_8x[4096]; 39 | uint8_t icon_bar_chart_8x[4096]; 40 | uint8_t icon_basket_8x[4096]; 41 | uint8_t icon_battery_empty_8x[4096]; 42 | uint8_t icon_battery_full_8x[4096]; 43 | uint8_t icon_beaker_8x[4096]; 44 | uint8_t icon_bell_8x[4096]; 45 | uint8_t icon_bluetooth_8x[4096]; 46 | uint8_t icon_bold_8x[4096]; 47 | uint8_t icon_bolt_8x[4096]; 48 | uint8_t icon_book_8x[4096]; 49 | uint8_t icon_bookmark_8x[4096]; 50 | uint8_t icon_box_8x[4096]; 51 | uint8_t icon_briefcase_8x[4096]; 52 | uint8_t icon_british_pound_8x[4096]; 53 | uint8_t icon_browser_8x[4096]; 54 | uint8_t icon_brush_8x[4096]; 55 | uint8_t icon_bug_8x[4096]; 56 | uint8_t icon_bullhorn_8x[4096]; 57 | uint8_t icon_calculator_8x[4096]; 58 | uint8_t icon_calendar_8x[4096]; 59 | uint8_t icon_camera_slr_8x[4096]; 60 | uint8_t icon_caret_bottom_8x[4096]; 61 | uint8_t icon_caret_left_8x[4096]; 62 | uint8_t icon_caret_right_8x[4096]; 63 | uint8_t icon_caret_top_8x[4096]; 64 | uint8_t icon_cart_8x[4096]; 65 | uint8_t icon_chat_8x[4096]; 66 | uint8_t icon_check_8x[4096]; 67 | uint8_t icon_chevron_bottom_8x[4096]; 68 | uint8_t icon_chevron_left_8x[4096]; 69 | uint8_t icon_chevron_right_8x[4096]; 70 | uint8_t icon_chevron_top_8x[4096]; 71 | uint8_t icon_circle_check_8x[4096]; 72 | uint8_t icon_circle_x_8x[4096]; 73 | uint8_t icon_clipboard_8x[4096]; 74 | uint8_t icon_clock_8x[4096]; 75 | uint8_t icon_cloud_8x[4096]; 76 | uint8_t icon_cloud_download_8x[4096]; 77 | uint8_t icon_cloud_upload_8x[4096]; 78 | uint8_t icon_cloudy_8x[4096]; 79 | uint8_t icon_code_8x[4096]; 80 | uint8_t icon_cog_8x[4096]; 81 | uint8_t icon_collapse_down_8x[4096]; 82 | uint8_t icon_collapse_left_8x[4096]; 83 | uint8_t icon_collapse_right_8x[4096]; 84 | uint8_t icon_collapse_up_8x[4096]; 85 | uint8_t icon_command_8x[4096]; 86 | uint8_t icon_comment_square_8x[4096]; 87 | uint8_t icon_compass_8x[4096]; 88 | uint8_t icon_contrast_8x[4096]; 89 | uint8_t icon_copywriting_8x[4096]; 90 | uint8_t icon_credit_card_8x[4096]; 91 | uint8_t icon_crop_8x[4096]; 92 | uint8_t icon_dashboard_8x[4096]; 93 | uint8_t icon_data_transfer_download_8x[4096]; 94 | uint8_t icon_data_transfer_upload_8x[4096]; 95 | uint8_t icon_delete_8x[4096]; 96 | uint8_t icon_dial_8x[4096]; 97 | uint8_t icon_document_8x[4096]; 98 | uint8_t icon_dollar_8x[4096]; 99 | uint8_t icon_double_quote_sans_left_8x[4096]; 100 | uint8_t icon_double_quote_sans_right_8x[4096]; 101 | uint8_t icon_double_quote_serif_left_8x[4096]; 102 | uint8_t icon_double_quote_serif_right_8x[4096]; 103 | uint8_t icon_droplet_8x[4096]; 104 | uint8_t icon_eject_8x[4096]; 105 | uint8_t icon_elevator_8x[4096]; 106 | uint8_t icon_ellipses_8x[4096]; 107 | uint8_t icon_envelope_closed_8x[4096]; 108 | uint8_t icon_envelope_open_8x[4096]; 109 | uint8_t icon_euro_8x[4096]; 110 | uint8_t icon_excerpt_8x[4096]; 111 | uint8_t icon_expand_down_8x[4096]; 112 | uint8_t icon_expand_left_8x[4096]; 113 | uint8_t icon_expand_right_8x[4096]; 114 | uint8_t icon_expand_up_8x[4096]; 115 | uint8_t icon_external_link_8x[4096]; 116 | uint8_t icon_eye_8x[4096]; 117 | uint8_t icon_eyedropper_8x[4096]; 118 | uint8_t icon_file_8x[4096]; 119 | uint8_t icon_fire_8x[4096]; 120 | uint8_t icon_flag_8x[4096]; 121 | uint8_t icon_flash_8x[4096]; 122 | uint8_t icon_folder_8x[4096]; 123 | uint8_t icon_fork_8x[4096]; 124 | uint8_t icon_fullscreen_enter_8x[4096]; 125 | uint8_t icon_fullscreen_exit_8x[4096]; 126 | uint8_t icon_globe_8x[4096]; 127 | uint8_t icon_graph_8x[4096]; 128 | uint8_t icon_grid_four_up_8x[4096]; 129 | uint8_t icon_grid_three_up_8x[4096]; 130 | uint8_t icon_grid_two_up_8x[4096]; 131 | uint8_t icon_hard_drive_8x[4096]; 132 | uint8_t icon_header_8x[4096]; 133 | uint8_t icon_headphones_8x[4096]; 134 | uint8_t icon_heart_8x[4096]; 135 | uint8_t icon_home_8x[4096]; 136 | uint8_t icon_image_8x[4096]; 137 | uint8_t icon_inbox_8x[4096]; 138 | uint8_t icon_infinity_8x[4096]; 139 | uint8_t icon_info_8x[4096]; 140 | uint8_t icon_italic_8x[4096]; 141 | uint8_t icon_justify_center_8x[4096]; 142 | uint8_t icon_justify_left_8x[4096]; 143 | uint8_t icon_justify_right_8x[4096]; 144 | uint8_t icon_key_8x[4096]; 145 | uint8_t icon_laptop_8x[4096]; 146 | uint8_t icon_layers_8x[4096]; 147 | uint8_t icon_lightbulb_8x[4096]; 148 | uint8_t icon_link_broken_8x[4096]; 149 | uint8_t icon_link_intact_8x[4096]; 150 | uint8_t icon_list_8x[4096]; 151 | uint8_t icon_list_rich_8x[4096]; 152 | uint8_t icon_location_8x[4096]; 153 | uint8_t icon_lock_locked_8x[4096]; 154 | uint8_t icon_lock_unlocked_8x[4096]; 155 | uint8_t icon_loop_8x[4096]; 156 | uint8_t icon_loop_circular_8x[4096]; 157 | uint8_t icon_loop_square_8x[4096]; 158 | uint8_t icon_magnifying_glass_8x[4096]; 159 | uint8_t icon_map_8x[4096]; 160 | uint8_t icon_map_marker_8x[4096]; 161 | uint8_t icon_media_pause_8x[4096]; 162 | uint8_t icon_media_play_8x[4096]; 163 | uint8_t icon_media_record_8x[4096]; 164 | uint8_t icon_media_skip_backward_8x[4096]; 165 | uint8_t icon_media_skip_forward_8x[4096]; 166 | uint8_t icon_media_step_backward_8x[4096]; 167 | uint8_t icon_media_step_forward_8x[4096]; 168 | uint8_t icon_media_stop_8x[4096]; 169 | uint8_t icon_medical_cross_8x[4096]; 170 | uint8_t icon_menu_8x[4096]; 171 | uint8_t icon_microphone_8x[4096]; 172 | uint8_t icon_minus_8x[4096]; 173 | uint8_t icon_monitor_8x[4096]; 174 | uint8_t icon_moon_8x[4096]; 175 | uint8_t icon_move_8x[4096]; 176 | uint8_t icon_musical_note_8x[4096]; 177 | uint8_t icon_paperclip_8x[4096]; 178 | uint8_t icon_pencil_8x[4096]; 179 | uint8_t icon_people_8x[4096]; 180 | uint8_t icon_person_8x[4096]; 181 | uint8_t icon_phone_8x[4096]; 182 | uint8_t icon_pie_chart_8x[4096]; 183 | uint8_t icon_pin_8x[4096]; 184 | uint8_t icon_play_circle_8x[4096]; 185 | uint8_t icon_plus_8x[4096]; 186 | uint8_t icon_power_standby_8x[4096]; 187 | uint8_t icon_print_8x[4096]; 188 | uint8_t icon_project_8x[4096]; 189 | uint8_t icon_pulse_8x[4096]; 190 | uint8_t icon_puzzle_piece_8x[4096]; 191 | uint8_t icon_question_mark_8x[4096]; 192 | uint8_t icon_rain_8x[4096]; 193 | uint8_t icon_random_8x[4096]; 194 | uint8_t icon_reload_8x[4096]; 195 | uint8_t icon_resize_both_8x[4096]; 196 | uint8_t icon_resize_height_8x[4096]; 197 | uint8_t icon_resize_width_8x[4096]; 198 | uint8_t icon_rss_8x[4096]; 199 | uint8_t icon_rss_alt_8x[4096]; 200 | uint8_t icon_script_8x[4096]; 201 | uint8_t icon_share_8x[4096]; 202 | uint8_t icon_share_boxed_8x[4096]; 203 | uint8_t icon_shield_8x[4096]; 204 | uint8_t icon_signal_8x[4096]; 205 | uint8_t icon_signpost_8x[4096]; 206 | uint8_t icon_sort_ascending_8x[4096]; 207 | uint8_t icon_sort_descending_8x[4096]; 208 | uint8_t icon_spreadsheet_8x[4096]; 209 | uint8_t icon_star_8x[4096]; 210 | uint8_t icon_sun_8x[4096]; 211 | uint8_t icon_tablet_8x[4096]; 212 | uint8_t icon_tag_8x[4096]; 213 | uint8_t icon_tags_8x[4096]; 214 | uint8_t icon_target_8x[4096]; 215 | uint8_t icon_task_8x[4096]; 216 | uint8_t icon_terminal_8x[4096]; 217 | uint8_t icon_text_8x[4096]; 218 | uint8_t icon_thumb_down_8x[4096]; 219 | uint8_t icon_thumb_up_8x[4096]; 220 | uint8_t icon_timer_8x[4096]; 221 | uint8_t icon_transfer_8x[4096]; 222 | uint8_t icon_trash_8x[4096]; 223 | uint8_t icon_underline_8x[4096]; 224 | uint8_t icon_vertical_align_bottom_8x[4096]; 225 | uint8_t icon_vertical_align_center_8x[4096]; 226 | uint8_t icon_vertical_align_top_8x[4096]; 227 | uint8_t icon_video_8x[4096]; 228 | uint8_t icon_volume_high_8x[4096]; 229 | uint8_t icon_volume_low_8x[4096]; 230 | uint8_t icon_volume_off_8x[4096]; 231 | uint8_t icon_warning_8x[4096]; 232 | uint8_t icon_wifi_8x[4096]; 233 | uint8_t icon_wrench_8x[4096]; 234 | uint8_t icon_x_8x[4096]; 235 | uint8_t icon_yen_8x[4096]; 236 | uint8_t icon_zoom_in_8x[4096]; 237 | uint8_t icon_zoom_out_8x[4096]; 238 | 239 | #endif 240 | -------------------------------------------------------------------------------- /ugui/layer.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef UGUI_LAYER_H 3 | #define UGUI_LAYER_H 4 | 5 | #include 6 | 7 | #include "ugui/types.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /*** Public ***/ 14 | 15 | typedef struct ugui_layer_s ugui_layer_t; 16 | 17 | typedef void (*ugui_layer_update_t)(ugui_layer_t* layer, void *graphics_ctx, void* layer_ctx); 18 | 19 | ugui_layer_t* ugui_layer_create(ugui_rect_t bounds); 20 | 21 | void ugui_layer_destroy(ugui_layer_t* layer); 22 | 23 | ugui_rect_t* ugui_layer_get_bounds(ugui_layer_t* layer); 24 | 25 | void ugui_layer_set_ctx(ugui_layer_t* layer, void* ctx); 26 | 27 | int32_t ugui_layer_add_child(ugui_layer_t* layer, ugui_layer_t *child); 28 | 29 | void ugui_layer_set_update(ugui_layer_t* layer, ugui_layer_update_t update); 30 | 31 | void ugui_layer_set_dirty(ugui_layer_t* layer); 32 | 33 | void ugui_layer_set_visible(ugui_layer_t* layer, bool visible); 34 | 35 | 36 | /*** Private ***/ 37 | 38 | int _ugui_layer_update(ugui_layer_t* layer, void* graphics_ctx); 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /ugui/sprite.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef UGUI_SPRITE_H 3 | #define UGUI_SPRITE_H 4 | 5 | #include 6 | #include 7 | 8 | #include "ugui/types.h" 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | uint8_t _ugui_sprite_get_pixel(ugui_sprite_t *sprite, uint16_t x, uint16_t y, ugui_pixel_t* pixel); 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /ugui/types.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef UGUI_TYPES_H 3 | #define UGUI_TYPES_H 4 | 5 | #include 6 | #include 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | #if defined(UGUI_MODE_COLOR_16BIT) 13 | #error NOT YET SUPPORTED 14 | struct ugui_pixel_s { 15 | uint8_t r : 5; 16 | uint8_t g : 6; 17 | uint8_t b : 5; 18 | } __attribute((packed)); 19 | 20 | typedef struct ugui_pixel_s ugui_pixel_t; 21 | 22 | #elif defined(UGUI_MODE_COLOR_24BIT) 23 | 24 | struct ugui_pixel_s { 25 | uint8_t r; 26 | uint8_t g; 27 | uint8_t b; 28 | } __attribute((packed)); 29 | 30 | typedef struct ugui_pixel_s ugui_pixel_t; 31 | 32 | #else 33 | 34 | typedef bool ugui_pixel_t; 35 | 36 | #endif 37 | 38 | typedef struct ugui_point_s { 39 | uint16_t x; 40 | uint16_t y; 41 | } ugui_point_t; 42 | 43 | typedef struct ugui_size_s { 44 | uint16_t w; 45 | uint16_t h; 46 | } ugui_size_t; 47 | 48 | typedef struct ugui_rect_s { 49 | uint16_t x; 50 | uint16_t y; 51 | uint16_t w; 52 | uint16_t h; 53 | } ugui_rect_t; 54 | 55 | typedef struct ugui_sprite_s { 56 | uint16_t w; 57 | uint16_t h; 58 | uint16_t w_bytes; 59 | uint8_t* data; 60 | } ugui_sprite_t; 61 | 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /ugui/ugui.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef UGUI_H 3 | #define UGUI_H 4 | 5 | #include 6 | #include 7 | 8 | #include "ugui/layer.h" 9 | #include "ugui/window.h" 10 | #include "ugui/types.h" 11 | #include "ugui/graphics.h" 12 | 13 | #define UGUI_MAX_WINDOW_DEPTH 16 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | enum ugui_event_e { 20 | UGUI_EVT_NONE = 0, 21 | UGUI_EVT_UP, 22 | UGUI_EVT_DOWN, 23 | UGUI_EVT_LEFT, 24 | UGUI_EVT_RIGHT, 25 | UGUI_EVT_SELECT, 26 | UGUI_EVT_BACK, 27 | UGUI_EVT_EXIT 28 | }; 29 | 30 | typedef struct ugui_s ugui_t; 31 | 32 | ugui_t* ugui_create(uint32_t w, uint32_t h); 33 | 34 | void ugui_destroy(ugui_t* gui); 35 | 36 | void ugui_put_event(ugui_t* gui, uint8_t event); 37 | 38 | void ugui_render(ugui_t* gui); 39 | 40 | uint8_t* ugui_get_image(ugui_t* gui); 41 | 42 | void ugui_window_stack_push(ugui_t* gui, ugui_window_t *window); 43 | 44 | void ugui_window_stack_pop(ugui_t* gui); 45 | 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /ugui/ugui_sdl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Bitmap generator 3 | * Generates BMP files from the provided data arrays 4 | * This is useful for testing of the graphics framework 5 | */ 6 | 7 | #ifndef UGUI_SDL_H 8 | #define UGUI_SDL_H 9 | 10 | #include 11 | #include 12 | 13 | #include "ugui/types.h" 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | typedef struct ugui_sdl_s ugui_sdl_t; 20 | 21 | ugui_sdl_t* ugui_sdl_init(char* title, int width, int height); 22 | int ugui_sdl_get_event(ugui_sdl_t* sdl_ctx); 23 | void ugui_sdl_render_bmp(ugui_sdl_t* sdl_ctx, char* name); 24 | void ugui_sdl_close(ugui_sdl_t* sdl_ctx); 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | 30 | #endif 31 | 32 | 33 | -------------------------------------------------------------------------------- /ugui/widgets/menu_widget.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef MENU_WIDGET_H 3 | #define MENU_WIDGET_H 4 | 5 | #include 6 | 7 | #include "ugui/ugui.h" 8 | 9 | 10 | typedef struct ugui_menu_index_s { 11 | uint32_t x; 12 | uint32_t y; 13 | } ugui_menu_index_t; 14 | 15 | 16 | typedef uint32_t menu_get_num_callback(void *menu_widget, void* data); 17 | typedef uint32_t menu_get_height_callback(void *menu_widget, uint16_t section, void* data); 18 | 19 | typedef void menu_get_header_callback(void* menu_widget, char* header); 20 | typedef void menu_get_data_callback(void* menu_widget, uint16_t index, char* title, char* data); 21 | typedef void menu_select_callback(void *menu_widget, uint16_t index, void *callback_context); 22 | 23 | typedef void header_draw_callback(ugui_graphics_t *graphics_ctx, ugui_rect_t *bounds, char* title); 24 | typedef void menu_draw_callback(ugui_graphics_t *graphics_ctx, ugui_rect_t *bounds, char* title, char* data); 25 | 26 | 27 | typedef struct ugui_menu_widget_data_callbacks_s { 28 | menu_get_num_callback *get_num_sections; 29 | menu_get_num_callback *get_num_rows; 30 | 31 | menu_get_header_callback *get_header; 32 | menu_get_data_callback *get_data; 33 | 34 | menu_select_callback *select; 35 | 36 | } ugui_menu_widget_data_callbacks_t; 37 | 38 | typedef struct ugui_menu_widget_draw_callbacks_s { 39 | menu_get_num_callback *get_header_height; 40 | menu_get_num_callback *get_cell_height; 41 | 42 | header_draw_callback *draw_header; 43 | menu_draw_callback *draw_row; 44 | 45 | } ugui_menu_widget_draw_callbacks_t; 46 | 47 | typedef struct ugui_menu_widget_s ugui_menu_widget_t; 48 | 49 | ugui_menu_widget_t *ugui_menu_widget_create(ugui_rect_t frame); 50 | 51 | void ugui_menu_widget_set_callbacks(ugui_menu_widget_t* menu_widget, ugui_menu_widget_data_callbacks_t* callbacks); 52 | 53 | void ugui_menu_widget_set_draw(ugui_menu_widget_t* menu_widget, ugui_menu_widget_draw_callbacks_t* callbacks); 54 | 55 | ugui_layer_t* ugui_menu_widget_get_layer(ugui_menu_widget_t* menu_widget); 56 | 57 | void ugui_menu_widget_attach_to_window(ugui_menu_widget_t* menu_widget, ugui_window_t* window); 58 | 59 | void ugui_menu_widget_destroy(ugui_menu_widget_t* menu_widget); 60 | 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /ugui/widgets/text_widget.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef TEXT_WIDGET_H 3 | #define TEXT_WIDGET_H 4 | 5 | #include 6 | 7 | #include "ugui/ugui.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | enum ugui_text_alignment_e { 14 | UGUI_TEXT_ALIGN_LEFT, 15 | UGUI_TEXT_ALIGN_CENTER, 16 | UGUI_TEXT_ALIGN_RIGHT 17 | }; 18 | 19 | typedef struct ugui_text_widget_s ugui_text_widget_t; 20 | 21 | ugui_text_widget_t *ugui_text_widget_create(ugui_rect_t frame); 22 | 23 | void ugui_text_widget_set_text(ugui_text_widget_t* text_widget, font_style_t *font, char* text, uint8_t alignment); 24 | 25 | ugui_layer_t* ugui_text_widget_get_layer(ugui_text_widget_t* text_widget); 26 | 27 | void ugui_text_widget_destroy(ugui_text_widget_t* text_widget); 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /ugui/window.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef UGUI_WINDOW_H 3 | #define UGUI_WINDOW_H 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #include "ugui/layer.h" 10 | 11 | /*** Public ***/ 12 | 13 | typedef struct ugui_window_s ugui_window_t; 14 | 15 | typedef void (*ugui_window_handler_t)(ugui_window_t *window); 16 | 17 | typedef void (*ugui_window_event_handler_t)(ugui_window_t *window, int event, void* ctx); 18 | 19 | typedef struct ugui_window_handlers_s { 20 | ugui_window_handler_t load; 21 | ugui_window_handler_t unload; 22 | } ugui_window_handlers_t; 23 | 24 | ugui_window_t *ugui_window_create(); 25 | 26 | void ugui_window_destroy(ugui_window_t *window); 27 | 28 | ugui_layer_t* ugui_window_get_base_layer(ugui_window_t *window); 29 | 30 | void ugui_window_set_window_handlers(ugui_window_t *window, ugui_window_handlers_t *handlers); 31 | 32 | void ugui_window_set_event_handler(ugui_window_t *window, ugui_window_event_handler_t on_event, void* event_ctx); 33 | 34 | /*** Private ***/ 35 | 36 | void _ugui_window_put_event(ugui_window_t *window, int event); 37 | 38 | void _ugui_window_update(ugui_window_t *window, void* craphics_ctx); 39 | 40 | void _ugui_window_load(ugui_window_t *window); 41 | 42 | void _ugui_window_unload(ugui_window_t *window); 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif 49 | --------------------------------------------------------------------------------