Initial commit
This commit is contained in:
19
maps/mine.ber
Normal file
19
maps/mine.ber
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
111111111111111111111111
|
||||||
|
10000001000000000C000001
|
||||||
|
10C000010000000000000001
|
||||||
|
100000010000000000000001
|
||||||
|
1000P0010001111111111111
|
||||||
|
1000000000000000000C0001
|
||||||
|
111111100000000000000001
|
||||||
|
100000000000000000000001
|
||||||
|
1011111111110000C0000001
|
||||||
|
10C000000000100000000001
|
||||||
|
100000000000101111111111
|
||||||
|
100000000000100000000001
|
||||||
|
100000000000100000000001
|
||||||
|
100000000C00100000000001
|
||||||
|
100000000000100000000001
|
||||||
|
100000000000100000C00001
|
||||||
|
10E000000000100000000001
|
||||||
|
100000000000100000000001
|
||||||
|
111111111111111111111111
|
||||||
6
maps/other.ber
Normal file
6
maps/other.ber
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
1111111111111111111111111111111111
|
||||||
|
1E0000000000000C00000C000000000001
|
||||||
|
1010010100100000101001000000010101
|
||||||
|
1010010010101010001001000000010101
|
||||||
|
1P0000000C00C0000000000000000000C1
|
||||||
|
1111111111111111111111111111111111
|
||||||
7
maps/simple.ber
Normal file
7
maps/simple.ber
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
1111111111111
|
||||||
|
10010000000C1
|
||||||
|
1000011111001
|
||||||
|
1P0011E000001
|
||||||
|
1111111111111
|
||||||
87
mlx/.github/workflows/ci.yml
vendored
Normal file
87
mlx/.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
name: Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ master ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
env:
|
||||||
|
DISPLAY: ":99"
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest]
|
||||||
|
|
||||||
|
timeout-minutes: 20
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Install mlx dependencies
|
||||||
|
run: |
|
||||||
|
set -x
|
||||||
|
if [ "$RUNNER_OS" == "Linux" ]; then
|
||||||
|
sudo apt-get install gcc make xorg libxext-dev libbsd-dev
|
||||||
|
elif [ "$RUNNER_OS" == "macOS" ]; then
|
||||||
|
brew install xquartz
|
||||||
|
echo "/usr/X11/bin" >> $GITHUB_PATH
|
||||||
|
else
|
||||||
|
echo "$RUNNER_OS not supported"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
- name: Setup x11 headless testing environment
|
||||||
|
run: |
|
||||||
|
set -x
|
||||||
|
if [ "$RUNNER_OS" == "Linux" ]; then
|
||||||
|
sudo apt-get install xvfb xdotool valgrind
|
||||||
|
Xvfb $DISPLAY -screen 0 1280x1024x24 &
|
||||||
|
elif [ "$RUNNER_OS" == "macOS" ]; then
|
||||||
|
brew install xdotool
|
||||||
|
defaults write org.x.X11 enable_test_extensions -boolean true
|
||||||
|
sudo Xvfb $DISPLAY -screen 0 1280x1024x24 &
|
||||||
|
else
|
||||||
|
echo "$RUNNER_OS not supported"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
- name: Run ./configure
|
||||||
|
run: ./configure
|
||||||
|
|
||||||
|
- name: make check Linux
|
||||||
|
if: matrix.os == 'ubuntu-latest'
|
||||||
|
run: make -f Makefile.gen check
|
||||||
|
- name: make check MacOS
|
||||||
|
continue-on-error: true
|
||||||
|
if: matrix.os == 'macos-latest'
|
||||||
|
run: make -f Makefile.gen check
|
||||||
|
# Didn't find a way to simulate inputs on Macos. libxdo seem to no longer work on macos.
|
||||||
|
# It can be partially fixed writing proper unit-tests, thus avoiding the need of libxdo.
|
||||||
|
|
||||||
|
- name: Check leaks from binary "test/mlx-test"
|
||||||
|
run: |
|
||||||
|
cd test
|
||||||
|
if [ "$RUNNER_OS" == "Linux" ]; then
|
||||||
|
echo "Info: Still reachable doesn't matter. Valgrind will return success on thoses reports.
|
||||||
|
It is fine, we searching for lost pointers. Valgrind will return exit status 42 if any block is lost."
|
||||||
|
valgrind --leak-check=full --show-leak-kinds=definite,indirect,possible --errors-for-leak-kinds=definite,indirect,possible --error-exitcode=42 ./mlx-test > /dev/null &
|
||||||
|
PID=$!
|
||||||
|
sleep 30
|
||||||
|
xdotool search --name Title3 windowfocus key Escape
|
||||||
|
xdotool search --name Title2 windowfocus key Escape
|
||||||
|
wait $PID
|
||||||
|
elif [ "$RUNNER_OS" == "macOS" ]; then
|
||||||
|
MallocStackLoggingNoCompact=1
|
||||||
|
./mlx-test &
|
||||||
|
sleep 30
|
||||||
|
leaks mlx-test
|
||||||
|
pkill mlx-test
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Norminette, just for fun
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
pip3 install Norminette
|
||||||
|
norminette *.c *.h
|
||||||
|
norminette --version
|
||||||
67
mlx/.gitignore
vendored
Normal file
67
mlx/.gitignore
vendored
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
## Mlx related
|
||||||
|
Makefile.gen
|
||||||
|
/test/mlx-test
|
||||||
|
|
||||||
|
## Editor
|
||||||
|
.vscode/*
|
||||||
|
*~
|
||||||
|
\#*\#
|
||||||
|
|
||||||
|
## Other
|
||||||
|
.DS_STORE
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Template from https://github.com/github/gitignore
|
||||||
|
# Prerequisites
|
||||||
|
*.d
|
||||||
|
|
||||||
|
# Object files
|
||||||
|
*.o
|
||||||
|
*.ko
|
||||||
|
*.obj
|
||||||
|
*.elf
|
||||||
|
|
||||||
|
# Linker output
|
||||||
|
*.ilk
|
||||||
|
*.map
|
||||||
|
*.exp
|
||||||
|
|
||||||
|
# Precompiled Headers
|
||||||
|
*.gch
|
||||||
|
*.pch
|
||||||
|
|
||||||
|
# Libraries
|
||||||
|
*.lib
|
||||||
|
*.a
|
||||||
|
*.la
|
||||||
|
*.lo
|
||||||
|
|
||||||
|
# Shared objects (inc. Windows DLLs)
|
||||||
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.so.*
|
||||||
|
*.dylib
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
*.exe
|
||||||
|
*.out
|
||||||
|
*.app
|
||||||
|
*.i*86
|
||||||
|
*.x86_64
|
||||||
|
*.hex
|
||||||
|
|
||||||
|
# Debug files
|
||||||
|
*.dSYM/
|
||||||
|
*.su
|
||||||
|
*.idb
|
||||||
|
*.pdb
|
||||||
|
|
||||||
|
# Kernel Module Compile Results
|
||||||
|
*.mod*
|
||||||
|
*.cmd
|
||||||
|
.tmp_versions/
|
||||||
|
modules.order
|
||||||
|
Module.symvers
|
||||||
|
Mkfile.old
|
||||||
|
dkms.conf
|
||||||
25
mlx/LICENSE
Normal file
25
mlx/LICENSE
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
BSD 2-Clause License
|
||||||
|
|
||||||
|
Copyright (c) 2021, Ecole 42
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
22
mlx/Makefile
Normal file
22
mlx/Makefile
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
##
|
||||||
|
## Makefile for MiniLibX in /home/boulon/work/c/raytraceur/minilibx
|
||||||
|
##
|
||||||
|
## Made by Olivier Crouzet
|
||||||
|
## Login <ol@epitech.net>
|
||||||
|
##
|
||||||
|
## Started on Tue Oct 5 15:56:43 2004 Olivier Crouzet
|
||||||
|
## Last update Tue May 15 15:44:41 2007 Olivier Crouzet
|
||||||
|
##
|
||||||
|
|
||||||
|
## Please use configure script
|
||||||
|
|
||||||
|
|
||||||
|
all : do_configure
|
||||||
|
|
||||||
|
do_configure :
|
||||||
|
./configure
|
||||||
|
|
||||||
|
clean :
|
||||||
|
./configure clean
|
||||||
|
|
||||||
|
re : clean all
|
||||||
63
mlx/Makefile.mk
Normal file
63
mlx/Makefile.mk
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
##
|
||||||
|
## Makefile for MiniLibX in /home/boulon/work/c/raytraceur/minilibx
|
||||||
|
##
|
||||||
|
## Made by Olivier Crouzet
|
||||||
|
## Login <ol@epitech.net>
|
||||||
|
##
|
||||||
|
## Started on Tue Oct 5 15:56:43 2004 Olivier Crouzet
|
||||||
|
## Last update Tue May 15 15:41:20 2007 Olivier Crouzet
|
||||||
|
##
|
||||||
|
|
||||||
|
## Please use configure script
|
||||||
|
|
||||||
|
|
||||||
|
INC =%%%%
|
||||||
|
|
||||||
|
|
||||||
|
CC = gcc
|
||||||
|
|
||||||
|
NAME = libmlx.a
|
||||||
|
NAME_UNAME = libmlx_$(shell uname).a
|
||||||
|
|
||||||
|
SRC = mlx_init.c mlx_new_window.c mlx_pixel_put.c mlx_loop.c \
|
||||||
|
mlx_mouse_hook.c mlx_key_hook.c mlx_expose_hook.c mlx_loop_hook.c \
|
||||||
|
mlx_int_anti_resize_win.c mlx_int_do_nothing.c \
|
||||||
|
mlx_int_wait_first_expose.c mlx_int_get_visual.c \
|
||||||
|
mlx_flush_event.c mlx_string_put.c mlx_set_font.c \
|
||||||
|
mlx_new_image.c mlx_get_data_addr.c \
|
||||||
|
mlx_put_image_to_window.c mlx_get_color_value.c mlx_clear_window.c \
|
||||||
|
mlx_xpm.c mlx_int_str_to_wordtab.c mlx_destroy_window.c \
|
||||||
|
mlx_int_param_event.c mlx_int_set_win_event_mask.c mlx_hook.c \
|
||||||
|
mlx_rgb.c mlx_destroy_image.c mlx_mouse.c mlx_screen_size.c \
|
||||||
|
mlx_destroy_display.c
|
||||||
|
|
||||||
|
OBJ_DIR = obj
|
||||||
|
OBJ = $(addprefix $(OBJ_DIR)/,$(SRC:%.c=%.o))
|
||||||
|
CFLAGS = -O3 -I$(INC)
|
||||||
|
|
||||||
|
all : $(NAME)
|
||||||
|
|
||||||
|
$(OBJ_DIR)/%.o: %.c
|
||||||
|
@mkdir -p $(OBJ_DIR)
|
||||||
|
$(CC) $(CFLAGS) $(IFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
$(NAME) : $(OBJ)
|
||||||
|
ar -r $(NAME) $(OBJ)
|
||||||
|
ranlib $(NAME)
|
||||||
|
cp $(NAME) $(NAME_UNAME)
|
||||||
|
|
||||||
|
check: all
|
||||||
|
@test/run_tests.sh
|
||||||
|
|
||||||
|
show:
|
||||||
|
@printf "NAME : $(NAME)\n"
|
||||||
|
@printf "NAME_UNAME : $(NAME_UNAME)\n"
|
||||||
|
@printf "CC : $(CC)\n"
|
||||||
|
@printf "CFLAGS : $(CFLAGS)\n"
|
||||||
|
@printf "SRC :\n $(SRC)\n"
|
||||||
|
@printf "OBJ :\n $(OBJ)\n"
|
||||||
|
|
||||||
|
clean :
|
||||||
|
rm -rf $(OBJ_DIR)/ $(NAME) $(NAME_UNAME) *~ core *.core
|
||||||
|
|
||||||
|
.PHONY: all check show clean
|
||||||
55
mlx/README.md
Executable file
55
mlx/README.md
Executable file
@@ -0,0 +1,55 @@
|
|||||||
|
[](https://github.com/42Paris/minilibx-linux/actions/workflows/ci.yml)
|
||||||
|
|
||||||
|
This is the MinilibX, a simple X-Window (X11R6) programming API
|
||||||
|
in C, designed for students, suitable for X-beginners.
|
||||||
|
|
||||||
|
|
||||||
|
Contents
|
||||||
|
|
||||||
|
- source code in C to create the mlx library
|
||||||
|
- man pages (in man/ directory)
|
||||||
|
- a test program (in test/ directory) is built
|
||||||
|
with the library
|
||||||
|
- a public include file mlx.h
|
||||||
|
- a tiny configure script to generate an appropriate Makefile.gen
|
||||||
|
|
||||||
|
Requirements for Linux
|
||||||
|
|
||||||
|
- MinilibX only support TrueColor visual type (8,15,16,24 or 32 bits depth)
|
||||||
|
- gcc
|
||||||
|
- make
|
||||||
|
- X11 include files (package xorg)
|
||||||
|
- XShm extension must be present (package libxext-dev)
|
||||||
|
- Utility functions from BSD systems - development files (package libbsd-dev)
|
||||||
|
- **e.g. _sudo apt-get install gcc make xorg libxext-dev libbsd-dev_ (Debian/Ubuntu)**
|
||||||
|
|
||||||
|
Requirements for MacOS
|
||||||
|
- [Xquartz](https://www.xquartz.org/)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
➜ ~ Brew install Xquartz
|
||||||
|
➜ ~ reboot
|
||||||
|
➜ ~ xeyes # run an hello world X11 app
|
||||||
|
```
|
||||||
|
|
||||||
|
MlX Color Opacity / Transparency / Alpha (32 bits depth)
|
||||||
|
- 0xFF (fully transparent) or 0x00 (fully opaque)
|
||||||
|
|
||||||
|
Compile MinilibX
|
||||||
|
|
||||||
|
- run ./configure or make
|
||||||
|
both will make a few tests, create Makefile.gen
|
||||||
|
and then automatically run make on this generated Makefile.gen .
|
||||||
|
libmlx.a and libmlx_$(HOSTTYPE).a are created.
|
||||||
|
test/mlx-test binary is also created.
|
||||||
|
|
||||||
|
|
||||||
|
Install MinilibX
|
||||||
|
|
||||||
|
- no installation script is provided. You may want to install
|
||||||
|
- libmlx.a and/or libmlx_$(HOSTTYPE).a in /usr/X11/lib or /usr/local/lib
|
||||||
|
- mlx.h in /usr/X11/include or /usr/local/include
|
||||||
|
- man/man3/mlx*.1 in /usr/X11/man/man3 or /usr/local/man/man3
|
||||||
|
|
||||||
|
|
||||||
|
Olivier CROUZET - 2014-01-06 -
|
||||||
121
mlx/configure
vendored
Executable file
121
mlx/configure
vendored
Executable file
@@ -0,0 +1,121 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
BOLD="\e[1m"
|
||||||
|
RESET="\e[0m"
|
||||||
|
LIGHT_RED="\e[91m"
|
||||||
|
LIGHT_GREEN="\e[92m"
|
||||||
|
LIGHT_CYAN="\e[96m"
|
||||||
|
|
||||||
|
logging(){
|
||||||
|
local type=$1; shift
|
||||||
|
printf "${LIGHT_CYAN}${BOLD}configure${RESET} [%b] : %b\n" "$type" "$*"
|
||||||
|
}
|
||||||
|
log_info(){
|
||||||
|
logging "${LIGHT_GREEN}info${RESET}" "$@"
|
||||||
|
}
|
||||||
|
log_error(){
|
||||||
|
logging "${LIGHT_RED}error${RESET}" "$@" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
# find and print x11 header path
|
||||||
|
get_xlib_include_path(){
|
||||||
|
local result=""
|
||||||
|
|
||||||
|
for inc in \
|
||||||
|
/usr/X11/include \
|
||||||
|
/usr/X11R6/include \
|
||||||
|
/usr/X11R5/include \
|
||||||
|
/usr/X11R4/include \
|
||||||
|
\
|
||||||
|
/usr/include \
|
||||||
|
/usr/include/X11 \
|
||||||
|
/usr/include/X11R6 \
|
||||||
|
/usr/include/X11R5 \
|
||||||
|
/usr/include/X11R4 \
|
||||||
|
\
|
||||||
|
/usr/local/X11/include \
|
||||||
|
/usr/local/X11R6/include \
|
||||||
|
/usr/local/X11R5/include \
|
||||||
|
/usr/local/X11R4/include \
|
||||||
|
\
|
||||||
|
/usr/local/include/X11 \
|
||||||
|
/usr/local/include/X11R6 \
|
||||||
|
/usr/local/include/X11R5 \
|
||||||
|
/usr/local/include/X11R4 \
|
||||||
|
\
|
||||||
|
/usr/X386/include \
|
||||||
|
/usr/x386/include \
|
||||||
|
/usr/XFree86/include/X11 \
|
||||||
|
\
|
||||||
|
/usr/local/include \
|
||||||
|
/usr/athena/include \
|
||||||
|
/usr/local/x11r5/include \
|
||||||
|
/usr/lpp/Xamples/include \
|
||||||
|
\
|
||||||
|
/usr/openwin/include \
|
||||||
|
/usr/openwin/share/include
|
||||||
|
do
|
||||||
|
if [ -f "$inc/X11/Xlib.h" -a -f "$inc/X11/extensions/XShm.h" ]; then
|
||||||
|
result=$inc
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo $result
|
||||||
|
}
|
||||||
|
|
||||||
|
show_help(){
|
||||||
|
cat <<EOF
|
||||||
|
Usage :
|
||||||
|
$0 Auto-configure and make MinilibX
|
||||||
|
$0 clean Execute the clean rule of both Makefile.gen
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
clean(){
|
||||||
|
log_info 'Execute "make clean" from "makefile.gen"'
|
||||||
|
make -f Makefile.gen clean
|
||||||
|
log_info 'Execute "make clean" from "test/makefile.gen"'
|
||||||
|
make -f Makefile.gen -C test/ --no-print-directory clean
|
||||||
|
}
|
||||||
|
|
||||||
|
parse_args(){
|
||||||
|
case "$1" in
|
||||||
|
--help | -h)
|
||||||
|
show_help
|
||||||
|
exit 0;;
|
||||||
|
clean)
|
||||||
|
clean
|
||||||
|
exit 0;;
|
||||||
|
"") return;;
|
||||||
|
*)
|
||||||
|
log_error "unknown command \"$1\"\nRun \"./configure --help\" for usage."
|
||||||
|
exit 1;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
main(){
|
||||||
|
local xlib_inc="$(get_xlib_include_path)"
|
||||||
|
|
||||||
|
parse_args "$@"
|
||||||
|
if [ -z "$xlib_inc" ]; then
|
||||||
|
log_error "Can't find a suitable X11 include directory."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
log_info "Found X11 include path directory: $xlib_inc"
|
||||||
|
|
||||||
|
log_info 'Generate "makefile.gen" from template "makefile.mk"'
|
||||||
|
echo "INC=$xlib_inc" > Makefile.gen
|
||||||
|
cat Makefile.mk | grep -v %%%% >> Makefile.gen
|
||||||
|
log_info 'Generate "test/makefile.gen" from template "test/makefile.mk"'
|
||||||
|
echo "INC=$xlib_inc" > test/Makefile.gen
|
||||||
|
cat test/Makefile.mk | grep -v %%%% >> test/Makefile.gen
|
||||||
|
|
||||||
|
log_info 'Execute "make all" from file "makefile.gen"'
|
||||||
|
make -f Makefile.gen all
|
||||||
|
log_info 'Execute "make all" from file "test/makefile.gen"'
|
||||||
|
(cd test ; make -f Makefile.gen all )
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
93
mlx/man/man1/mlx.1
Normal file
93
mlx/man/man1/mlx.1
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
.TH MiniLibX 3 "September 19, 2002"
|
||||||
|
.SH NAME
|
||||||
|
MiniLibX - Simple X-Window Interface Library for students
|
||||||
|
.SH SYNOPSYS
|
||||||
|
#include <mlx.h>
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I void *
|
||||||
|
.fi
|
||||||
|
.B mlx_init
|
||||||
|
();
|
||||||
|
|
||||||
|
.SH DESCRIPTION
|
||||||
|
MiniLibX is an easy way to create graphical software,
|
||||||
|
without any X-Window programming knowledge. It provides
|
||||||
|
simple window creation, a drawing tool, image and basic events
|
||||||
|
management.
|
||||||
|
|
||||||
|
.SH X-WINDOW CONCEPT
|
||||||
|
|
||||||
|
X-Window is a network-oriented graphical system for Unix.
|
||||||
|
It is based on two main parts:
|
||||||
|
.br
|
||||||
|
On one side, your software wants to draw something on the screen and/or
|
||||||
|
get keyboard & mouse entries.
|
||||||
|
.br
|
||||||
|
On the other side, the X-Server manages the screen, keyboard and mouse
|
||||||
|
(It is often refered to as a "display").
|
||||||
|
.br
|
||||||
|
A network connection must be established between these two entities to send
|
||||||
|
drawing orders (from the software to the X-Server), and keyboard/mouse
|
||||||
|
events (from the X-Server to the software).
|
||||||
|
|
||||||
|
.SH INCLUDE FILE
|
||||||
|
.B mlx.h
|
||||||
|
should be included for a correct use of the MiniLibX API.
|
||||||
|
It only contains function prototypes, no structure is needed.
|
||||||
|
|
||||||
|
.SH LIBRARY FUNCTIONS
|
||||||
|
.P
|
||||||
|
First of all, you need to initialize the connection
|
||||||
|
between your software and the display.
|
||||||
|
Once this connection is established, you'll be able to
|
||||||
|
use other MiniLibX functions to send the X-Server messages,
|
||||||
|
like "I want to draw a yellow pixel in this window" or "did the
|
||||||
|
user hit a key?".
|
||||||
|
.P
|
||||||
|
The
|
||||||
|
.B mlx_init
|
||||||
|
function will create this connection. No parameters are needed, ant it will
|
||||||
|
return a
|
||||||
|
.I "void *"
|
||||||
|
identifier, used for further calls to the library routines.
|
||||||
|
.P
|
||||||
|
All other MiniLibX functions are described in the following man pages:
|
||||||
|
|
||||||
|
.TP 20
|
||||||
|
.B mlx_new_window
|
||||||
|
: manage windows
|
||||||
|
.TP 20
|
||||||
|
.B mlx_pixel_put
|
||||||
|
: draw inside window
|
||||||
|
.TP 20
|
||||||
|
.B mlx_new_image
|
||||||
|
: manipulate images
|
||||||
|
.TP 20
|
||||||
|
.B mlx_loop
|
||||||
|
: handle keyboard or mouse events
|
||||||
|
|
||||||
|
.SH LINKING MiniLibX
|
||||||
|
To use MiniLibX functions, you'll need to link
|
||||||
|
your software with several libraries, including the MiniLibX library itself.
|
||||||
|
To do this, simply add the following arguments at linking time:
|
||||||
|
|
||||||
|
.B -lmlx -lXext -lX11
|
||||||
|
|
||||||
|
You may also need to specify the path to these libraries, using
|
||||||
|
the
|
||||||
|
.B -L
|
||||||
|
flag.
|
||||||
|
|
||||||
|
|
||||||
|
.SH RETURN VALUES
|
||||||
|
If
|
||||||
|
.B mlx_init()
|
||||||
|
fails to set up the connection to the X server, it will return NULL, otherwise
|
||||||
|
a non-null pointer is returned as a connection identifier.
|
||||||
|
|
||||||
|
.SH SEE ALSO
|
||||||
|
mlx_new_window(3), mlx_pixel_put(3), mlx_new_image(3), mlx_loop(3)
|
||||||
|
|
||||||
|
.SH AUTHOR
|
||||||
|
Copyright ol@ - 2002-2014 - Olivier Crouzet
|
||||||
141
mlx/man/man1/mlx_loop.1
Normal file
141
mlx/man/man1/mlx_loop.1
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
.TH MiniLibX 3 "September 19, 2002"
|
||||||
|
.SH NAME
|
||||||
|
MiniLibX - Handle events
|
||||||
|
.SH SYNOPSYS
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I int
|
||||||
|
.fi
|
||||||
|
.B mlx_loop
|
||||||
|
(
|
||||||
|
.I void *mlx_ptr
|
||||||
|
);
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I int
|
||||||
|
.fi
|
||||||
|
.B mlx_key_hook
|
||||||
|
(
|
||||||
|
.I void *win_ptr, int (*funct_ptr)(), void *param
|
||||||
|
);
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I int
|
||||||
|
.fi
|
||||||
|
.B mlx_mouse_hook
|
||||||
|
(
|
||||||
|
.I void *win_ptr, int (*funct_ptr)(), void *param
|
||||||
|
);
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I int
|
||||||
|
.fi
|
||||||
|
.B mlx_expose_hook
|
||||||
|
(
|
||||||
|
.I void *win_ptr, int (*funct_ptr)(), void *param
|
||||||
|
);
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I int
|
||||||
|
.fi
|
||||||
|
.B mlx_loop_hook
|
||||||
|
(
|
||||||
|
.I void *mlx_ptr, int (*funct_ptr)(), void *param
|
||||||
|
);
|
||||||
|
|
||||||
|
.SH X-WINDOW EVENTS
|
||||||
|
|
||||||
|
The X-Window system is bi-directionnal. On one hand, the program sends orders to
|
||||||
|
the screen to display pixels, images, and so on. On the other hand,
|
||||||
|
it can get information from the keyboard and mouse associated to
|
||||||
|
the screen. To do so, the program receives "events" from the keyboard or the
|
||||||
|
mouse.
|
||||||
|
|
||||||
|
.SH DESCRIPTION
|
||||||
|
|
||||||
|
To receive events, you must use
|
||||||
|
.B mlx_loop
|
||||||
|
(). This function never returns. It is an infinite loop that waits for
|
||||||
|
an event, and then calls a user-defined function associated with this event.
|
||||||
|
A single parameter is needed, the connection identifier
|
||||||
|
.I mlx_ptr
|
||||||
|
(see the
|
||||||
|
.B mlx manual).
|
||||||
|
|
||||||
|
You can assign different functions to the three following events:
|
||||||
|
.br
|
||||||
|
- A key is pressed
|
||||||
|
.br
|
||||||
|
- The mouse button is pressed
|
||||||
|
.br
|
||||||
|
- A part of the window should be re-drawn
|
||||||
|
(this is called an "expose" event, and it is your program's job to handle it).
|
||||||
|
.br
|
||||||
|
|
||||||
|
Each window can define a different function for the same event.
|
||||||
|
|
||||||
|
The three functions
|
||||||
|
.B mlx_key_hook
|
||||||
|
(),
|
||||||
|
.B mlx_mouse_hook
|
||||||
|
() and
|
||||||
|
.B mlx_expose_hook
|
||||||
|
() work exactly the same way.
|
||||||
|
.I funct_ptr
|
||||||
|
is a pointer to the function you want to be called
|
||||||
|
when an event occurs. This assignment is specific to the window defined by the
|
||||||
|
.I win_ptr
|
||||||
|
identifier. The
|
||||||
|
.I param
|
||||||
|
adress will be passed to the function everytime it is called, and should be
|
||||||
|
used to store the parameters it might need.
|
||||||
|
|
||||||
|
The syntax for the
|
||||||
|
.B mlx_loop_hook
|
||||||
|
() function is identical to the previous ones, but the given function will be
|
||||||
|
called when no event occurs.
|
||||||
|
|
||||||
|
When it catches an event, the MiniLibX calls the corresponding function
|
||||||
|
with fixed parameters:
|
||||||
|
.nf
|
||||||
|
|
||||||
|
expose_hook(void *param);
|
||||||
|
key_hook(int keycode,void *param);
|
||||||
|
mouse_hook(int button,int x,int y,void *param);
|
||||||
|
loop_hook(void *param);
|
||||||
|
|
||||||
|
.fi
|
||||||
|
These function names are arbitrary. They here are used to distinguish
|
||||||
|
parameters according to the event. These functions are NOT part of the
|
||||||
|
MiniLibX.
|
||||||
|
|
||||||
|
.I param
|
||||||
|
is the address specified in the mlx_*_hook calls. This address is never
|
||||||
|
used nor modified by the MiniLibX. On key and mouse events, additional
|
||||||
|
information is passed:
|
||||||
|
.I keycode
|
||||||
|
tells you which key is pressed (look for the X11 include file "keysymdef.h"),
|
||||||
|
(
|
||||||
|
.I x
|
||||||
|
,
|
||||||
|
.I y
|
||||||
|
) are the coordinates of the mouse click in the window, and
|
||||||
|
.I button
|
||||||
|
tells you which mouse button was pressed.
|
||||||
|
|
||||||
|
.SH GOING FURTHER WITH EVENTS
|
||||||
|
The MiniLibX provides a much generic access to all X-Window events. The
|
||||||
|
.I mlx.h
|
||||||
|
include define
|
||||||
|
.B mlx_hook()
|
||||||
|
in the same manner mlx_*_hook functions work. The event and mask values
|
||||||
|
will be taken from the X11 include file "X.h".
|
||||||
|
|
||||||
|
See source code of mlx_int_param_event.c to find out how the MiniLibX will
|
||||||
|
call your own function for a specific event.
|
||||||
|
|
||||||
|
.SH SEE ALSO
|
||||||
|
mlx(3), mlx_new_window(3), mlx_pixel_put(3), mlx_new_image(3)
|
||||||
|
|
||||||
|
.SH AUTHOR
|
||||||
|
Copyright ol@ - 2002-2014 - Olivier Crouzet
|
||||||
192
mlx/man/man1/mlx_new_image.1
Normal file
192
mlx/man/man1/mlx_new_image.1
Normal file
@@ -0,0 +1,192 @@
|
|||||||
|
.TH MiniLibX 3 "September 19, 2002"
|
||||||
|
.SH NAME
|
||||||
|
MiniLibX - Manipulating images
|
||||||
|
.SH SYNOPSYS
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I void *
|
||||||
|
.fi
|
||||||
|
.B mlx_new_image
|
||||||
|
(
|
||||||
|
.I void *mlx_ptr, int width, int height
|
||||||
|
);
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I char *
|
||||||
|
.fi
|
||||||
|
.B mlx_get_data_addr
|
||||||
|
(
|
||||||
|
.I void *img_ptr, int *bits_per_pixel, int *size_line, int *endian
|
||||||
|
);
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I int
|
||||||
|
.fi
|
||||||
|
.B mlx_put_image_to_window
|
||||||
|
(
|
||||||
|
.I void *mlx_ptr, void *win_ptr, void *img_ptr, int x, int y
|
||||||
|
);
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I unsigned int
|
||||||
|
.fi
|
||||||
|
.B mlx_get_color_value
|
||||||
|
(
|
||||||
|
.I void *mlx_ptr, int color
|
||||||
|
);
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I void *
|
||||||
|
.fi
|
||||||
|
.B mlx_xpm_to_image
|
||||||
|
(
|
||||||
|
.I void *mlx_ptr, char **xpm_data, int *width, int *height
|
||||||
|
);
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I void *
|
||||||
|
.fi
|
||||||
|
.B mlx_xpm_file_to_image
|
||||||
|
(
|
||||||
|
.I void *mlx_ptr, char *filename, int *width, int *height
|
||||||
|
);
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I int
|
||||||
|
.fi
|
||||||
|
.B mlx_destroy_image
|
||||||
|
(
|
||||||
|
.I void *mlx_ptr, void *img_ptr
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
.SH DESCRIPTION
|
||||||
|
|
||||||
|
.B mlx_new_image
|
||||||
|
() creates a new image in memory. It returns a
|
||||||
|
.I void *
|
||||||
|
identifier needed to manipulate this image later. It only needs
|
||||||
|
the size of the image to be created, using the
|
||||||
|
.I width
|
||||||
|
and
|
||||||
|
.I height
|
||||||
|
parameters, and the
|
||||||
|
.I mlx_ptr
|
||||||
|
connection identifier (see the
|
||||||
|
.B mlx
|
||||||
|
manual).
|
||||||
|
|
||||||
|
The user can draw inside the image (see below), and
|
||||||
|
can dump the image inside a specified window at any time to
|
||||||
|
display it on the screen. This is done using
|
||||||
|
.B mlx_put_image_to_window
|
||||||
|
(). Three identifiers are needed here, for the connection to the
|
||||||
|
display, the window to use, and the image (respectively
|
||||||
|
.I mlx_ptr
|
||||||
|
,
|
||||||
|
.I win_ptr
|
||||||
|
and
|
||||||
|
.I img_ptr
|
||||||
|
). The (
|
||||||
|
.I x
|
||||||
|
,
|
||||||
|
.I y
|
||||||
|
) coordinates define where the image should be placed in the window.
|
||||||
|
|
||||||
|
.B mlx_get_data_addr
|
||||||
|
() returns information about the created image, allowing a user
|
||||||
|
to modify it later. The
|
||||||
|
.I img_ptr
|
||||||
|
parameter specifies the image to use. The three next parameters should
|
||||||
|
be the addresses of three different valid integers.
|
||||||
|
.I bits_per_pixel
|
||||||
|
will be filled with the number of bits needed to represent a pixel color
|
||||||
|
(also called the depth of the image).
|
||||||
|
.I size_line
|
||||||
|
is the number of bytes used to store one line of the image in memory.
|
||||||
|
This information is needed to move from one line to another in the image.
|
||||||
|
.I endian
|
||||||
|
tells you wether the pixel color in the image needs to be stored in
|
||||||
|
little endian (
|
||||||
|
.I endian
|
||||||
|
== 0), or big endian (
|
||||||
|
.I endian
|
||||||
|
== 1).
|
||||||
|
|
||||||
|
.B mlx_get_data_addr
|
||||||
|
returns a
|
||||||
|
.I char *
|
||||||
|
address that represents the begining of the memory area where the image
|
||||||
|
is stored. From this adress, the first
|
||||||
|
.I bits_per_pixel
|
||||||
|
bits represent the color of the first pixel in the first line of
|
||||||
|
the image. The second group of
|
||||||
|
.I bits_per_pixel
|
||||||
|
bits represent the second pixel of the first line, and so on.
|
||||||
|
Add
|
||||||
|
.I size_line
|
||||||
|
to the adress to get the begining of the second line. You can reach any
|
||||||
|
pixels of the image that way.
|
||||||
|
|
||||||
|
.B mlx_destroy_image
|
||||||
|
destroys the given image (
|
||||||
|
.I img_ptr
|
||||||
|
).
|
||||||
|
|
||||||
|
.SH STORING COLOR INSIDE IMAGES
|
||||||
|
|
||||||
|
Depending on the display, the number of bits used to store a pixel color
|
||||||
|
can change. The user usually represents a color in RGB mode, using
|
||||||
|
one byte for each component (see
|
||||||
|
.B mlx_pixel_put
|
||||||
|
manual). This must be translated to fit the
|
||||||
|
.I bits_per_pixel
|
||||||
|
requirement of the image, and make the color understandable to the X-Server.
|
||||||
|
That is the purpose of the
|
||||||
|
.B mlx_get_color_value
|
||||||
|
() function. It takes a standard RGB
|
||||||
|
.I color
|
||||||
|
parameter, and returns an
|
||||||
|
.I unsigned int
|
||||||
|
value.
|
||||||
|
The
|
||||||
|
.I bits_per_pixel
|
||||||
|
least significant bits of this value can be stored in the image.
|
||||||
|
|
||||||
|
Keep in mind that the least significant bits position depends on the local
|
||||||
|
computer's endian. If the endian of the image (in fact the endian of
|
||||||
|
the X-Server's computer) differs from the local endian, then the value should
|
||||||
|
be transformed before being used.
|
||||||
|
|
||||||
|
.SH XPM IMAGES
|
||||||
|
|
||||||
|
The
|
||||||
|
.B mlx_xpm_to_image
|
||||||
|
() and
|
||||||
|
.B mlx_xpm_file_to_image
|
||||||
|
() functions will create a new image the same way.
|
||||||
|
They will fill it using the specified
|
||||||
|
.I xpm_data
|
||||||
|
or
|
||||||
|
.I filename
|
||||||
|
, depending on which function is used.
|
||||||
|
Note that MiniLibX does not use the standard
|
||||||
|
Xpm library to deal with xpm images. You may not be able to
|
||||||
|
read all types of xpm images. It however handles transparency.
|
||||||
|
|
||||||
|
.SH RETURN VALUES
|
||||||
|
The three functions that create images,
|
||||||
|
.B mlx_new_image()
|
||||||
|
,
|
||||||
|
.B mlx_xpm_to_image()
|
||||||
|
and
|
||||||
|
.B mlx_xpm_file_to_image()
|
||||||
|
, will return NULL if an error occurs. Otherwise they return a non-null pointer
|
||||||
|
as an image identifier.
|
||||||
|
|
||||||
|
|
||||||
|
.SH SEE ALSO
|
||||||
|
mlx(3), mlx_new_window(3), mlx_pixel_put(3), mlx_loop(3)
|
||||||
|
|
||||||
|
.SH AUTHOR
|
||||||
|
Copyright ol@ - 2002-2014 - Olivier Crouzet
|
||||||
79
mlx/man/man1/mlx_new_window.1
Normal file
79
mlx/man/man1/mlx_new_window.1
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
.TH MiniLibX 3 "September 19, 2002"
|
||||||
|
.SH NAME
|
||||||
|
MiniLibX - Managing windows
|
||||||
|
.SH SYNOPSYS
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I void *
|
||||||
|
.fi
|
||||||
|
.B mlx_new_window
|
||||||
|
(
|
||||||
|
.I void *mlx_ptr, int size_x, int size_y, char *title
|
||||||
|
);
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I int
|
||||||
|
.fi
|
||||||
|
.B mlx_clear_window
|
||||||
|
(
|
||||||
|
.I void *mlx_ptr, void *win_ptr
|
||||||
|
);
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I int
|
||||||
|
.fi
|
||||||
|
.B mlx_destroy_window
|
||||||
|
(
|
||||||
|
.I void *mlx_ptr, void *win_ptr
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
.SH DESCRIPTION
|
||||||
|
The
|
||||||
|
.B mlx_new_window
|
||||||
|
() function creates a new window on the screen, using the
|
||||||
|
.I size_x
|
||||||
|
and
|
||||||
|
.I size_y
|
||||||
|
parameters to determine its size, and
|
||||||
|
.I title
|
||||||
|
as the text that should be displayed in the window's title bar.
|
||||||
|
The
|
||||||
|
.I mlx_ptr
|
||||||
|
parameter is the connection identifier returned by
|
||||||
|
.B mlx_init
|
||||||
|
() (see the
|
||||||
|
.B mlx
|
||||||
|
man page).
|
||||||
|
.B mlx_new_window
|
||||||
|
() returns a
|
||||||
|
.I void *
|
||||||
|
window identifier that can be used by other MiniLibX calls.
|
||||||
|
Note that the MiniLibX
|
||||||
|
can handle an arbitrary number of separate windows.
|
||||||
|
|
||||||
|
.B mlx_clear_window
|
||||||
|
() and
|
||||||
|
.B mlx_destroy_window
|
||||||
|
() respectively clear (in black) and destroy the given window. They both have
|
||||||
|
the same parameters:
|
||||||
|
.I mlx_ptr
|
||||||
|
is the screen connection identifier, and
|
||||||
|
.I win_ptr
|
||||||
|
is a window identifier.
|
||||||
|
|
||||||
|
.SH RETURN VALUES
|
||||||
|
If
|
||||||
|
.B mlx_new_window()
|
||||||
|
fails to create a new window (for wathever reason), it will return NULL,
|
||||||
|
otherwise a non-null pointer is returned as a window identifier.
|
||||||
|
.B mlx_clear_window
|
||||||
|
and
|
||||||
|
.B mlx_destroy_window
|
||||||
|
right now return nothing.
|
||||||
|
|
||||||
|
.SH SEE ALSO
|
||||||
|
mlx(3), mlx_pixel_put(3), mlx_new_image(3), mlx_loop(3)
|
||||||
|
|
||||||
|
.SH AUTHOR
|
||||||
|
Copyright ol@ - 2002-2014 - Olivier Crouzet
|
||||||
84
mlx/man/man1/mlx_pixel_put.1
Normal file
84
mlx/man/man1/mlx_pixel_put.1
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
.TH MiniLibX 3 "September 19, 2002"
|
||||||
|
.SH NAME
|
||||||
|
MiniLibX - Drawing inside windows
|
||||||
|
.SH SYNOPSYS
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I int
|
||||||
|
.fi
|
||||||
|
.B mlx_pixel_put
|
||||||
|
(
|
||||||
|
.I void *mlx_ptr, void *win_ptr, int x, int y, int color
|
||||||
|
);
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I int
|
||||||
|
.fi
|
||||||
|
.B mlx_string_put
|
||||||
|
(
|
||||||
|
.I void *mlx_ptr, void *win_ptr, int x, int y, int color, char *string
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
.SH DESCRIPTION
|
||||||
|
The
|
||||||
|
.B mlx_pixel_put
|
||||||
|
() function draws a defined pixel in the window
|
||||||
|
.I win_ptr
|
||||||
|
using the (
|
||||||
|
.I x
|
||||||
|
,
|
||||||
|
.I y
|
||||||
|
) coordinates, and the specified
|
||||||
|
.I color
|
||||||
|
\&. The origin (0,0) is the upper left corner of the window, the x and y axis
|
||||||
|
respectively pointing right and down. The connection
|
||||||
|
identifier,
|
||||||
|
.I mlx_ptr
|
||||||
|
, is needed (see the
|
||||||
|
.B mlx
|
||||||
|
man page).
|
||||||
|
|
||||||
|
Parameters for
|
||||||
|
.B mlx_string_put
|
||||||
|
() have the same meaning. Instead of a simple pixel, the specified
|
||||||
|
.I string
|
||||||
|
will be displayed at (
|
||||||
|
.I x
|
||||||
|
,
|
||||||
|
.I y
|
||||||
|
).
|
||||||
|
|
||||||
|
In both functions, it is impossible to display anything outside the
|
||||||
|
specified window, nor display in another window in front of the selected one.
|
||||||
|
|
||||||
|
.SH COLOR MANAGEMENT
|
||||||
|
The
|
||||||
|
.I color
|
||||||
|
parameter has an integer type. The displayed color needs to be encoded
|
||||||
|
in this integer, following a defined scheme. All displayable colors
|
||||||
|
can be split in 3 basic colors: red, green and blue. Three associated
|
||||||
|
values, in the 0-255 range, represent how much of each color is mixed up
|
||||||
|
to create the original color. Theses three values must be set inside the
|
||||||
|
integer to display the right color. The three least significant bytes of
|
||||||
|
this integer are filled as shown in the picture below:
|
||||||
|
|
||||||
|
.TS
|
||||||
|
allbox;
|
||||||
|
c s s s s
|
||||||
|
r c c c c.
|
||||||
|
Color Integer
|
||||||
|
Interpretation \[*a] R G B
|
||||||
|
Bit numbers 31..24 23..16 15..8 7..0
|
||||||
|
.TE
|
||||||
|
|
||||||
|
While filling the integer, make sure you avoid endian problems. Remember
|
||||||
|
that the "blue" byte should always be the least significant one.
|
||||||
|
|
||||||
|
|
||||||
|
.SH SEE ALSO
|
||||||
|
mlx(3), mlx_new_window(3), mlx_new_image(3), mlx_loop(3)
|
||||||
|
|
||||||
|
|
||||||
|
.SH AUTHOR
|
||||||
|
Copyright ol@ - 2002-2014 - Olivier Crouzet
|
||||||
93
mlx/man/man3/mlx.3
Normal file
93
mlx/man/man3/mlx.3
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
.TH MiniLibX 3 "September 19, 2002"
|
||||||
|
.SH NAME
|
||||||
|
MiniLibX - Simple X-Window Interface Library for students
|
||||||
|
.SH SYNOPSYS
|
||||||
|
#include <mlx.h>
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I void *
|
||||||
|
.fi
|
||||||
|
.B mlx_init
|
||||||
|
();
|
||||||
|
|
||||||
|
.SH DESCRIPTION
|
||||||
|
MiniLibX is an easy way to create graphical software,
|
||||||
|
without any X-Window programming knowledge. It provides
|
||||||
|
simple window creation, a drawing tool, image and basic events
|
||||||
|
management.
|
||||||
|
|
||||||
|
.SH X-WINDOW CONCEPT
|
||||||
|
|
||||||
|
X-Window is a network-oriented graphical system for Unix.
|
||||||
|
It is based on two main parts:
|
||||||
|
.br
|
||||||
|
On one side, your software wants to draw something on the screen and/or
|
||||||
|
get keyboard & mouse entries.
|
||||||
|
.br
|
||||||
|
On the other side, the X-Server manages the screen, keyboard and mouse
|
||||||
|
(It is often refered to as a "display").
|
||||||
|
.br
|
||||||
|
A network connection must be established between these two entities to send
|
||||||
|
drawing orders (from the software to the X-Server), and keyboard/mouse
|
||||||
|
events (from the X-Server to the software).
|
||||||
|
|
||||||
|
.SH INCLUDE FILE
|
||||||
|
.B mlx.h
|
||||||
|
should be included for a correct use of the MiniLibX API.
|
||||||
|
It only contains function prototypes, no structure is needed.
|
||||||
|
|
||||||
|
.SH LIBRARY FUNCTIONS
|
||||||
|
.P
|
||||||
|
First of all, you need to initialize the connection
|
||||||
|
between your software and the display.
|
||||||
|
Once this connection is established, you'll be able to
|
||||||
|
use other MiniLibX functions to send the X-Server messages,
|
||||||
|
like "I want to draw a yellow pixel in this window" or "did the
|
||||||
|
user hit a key?".
|
||||||
|
.P
|
||||||
|
The
|
||||||
|
.B mlx_init
|
||||||
|
function will create this connection. No parameters are needed, ant it will
|
||||||
|
return a
|
||||||
|
.I "void *"
|
||||||
|
identifier, used for further calls to the library routines.
|
||||||
|
.P
|
||||||
|
All other MiniLibX functions are described in the following man pages:
|
||||||
|
|
||||||
|
.TP 20
|
||||||
|
.B mlx_new_window
|
||||||
|
: manage windows
|
||||||
|
.TP 20
|
||||||
|
.B mlx_pixel_put
|
||||||
|
: draw inside window
|
||||||
|
.TP 20
|
||||||
|
.B mlx_new_image
|
||||||
|
: manipulate images
|
||||||
|
.TP 20
|
||||||
|
.B mlx_loop
|
||||||
|
: handle keyboard or mouse events
|
||||||
|
|
||||||
|
.SH LINKING MiniLibX
|
||||||
|
To use MiniLibX functions, you'll need to link
|
||||||
|
your software with several libraries, including the MiniLibX library itself.
|
||||||
|
To do this, simply add the following arguments at linking time:
|
||||||
|
|
||||||
|
.B -lmlx -lXext -lX11
|
||||||
|
|
||||||
|
You may also need to specify the path to these libraries, using
|
||||||
|
the
|
||||||
|
.B -L
|
||||||
|
flag.
|
||||||
|
|
||||||
|
|
||||||
|
.SH RETURN VALUES
|
||||||
|
If
|
||||||
|
.B mlx_init()
|
||||||
|
fails to set up the connection to the X server, it will return NULL, otherwise
|
||||||
|
a non-null pointer is returned as a connection identifier.
|
||||||
|
|
||||||
|
.SH SEE ALSO
|
||||||
|
mlx_new_window(3), mlx_pixel_put(3), mlx_new_image(3), mlx_loop(3)
|
||||||
|
|
||||||
|
.SH AUTHOR
|
||||||
|
Copyright ol@ - 2002-2014 - Olivier Crouzet
|
||||||
141
mlx/man/man3/mlx_loop.3
Normal file
141
mlx/man/man3/mlx_loop.3
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
.TH MiniLibX 3 "September 19, 2002"
|
||||||
|
.SH NAME
|
||||||
|
MiniLibX - Handle events
|
||||||
|
.SH SYNOPSYS
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I int
|
||||||
|
.fi
|
||||||
|
.B mlx_loop
|
||||||
|
(
|
||||||
|
.I void *mlx_ptr
|
||||||
|
);
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I int
|
||||||
|
.fi
|
||||||
|
.B mlx_key_hook
|
||||||
|
(
|
||||||
|
.I void *win_ptr, int (*funct_ptr)(), void *param
|
||||||
|
);
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I int
|
||||||
|
.fi
|
||||||
|
.B mlx_mouse_hook
|
||||||
|
(
|
||||||
|
.I void *win_ptr, int (*funct_ptr)(), void *param
|
||||||
|
);
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I int
|
||||||
|
.fi
|
||||||
|
.B mlx_expose_hook
|
||||||
|
(
|
||||||
|
.I void *win_ptr, int (*funct_ptr)(), void *param
|
||||||
|
);
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I int
|
||||||
|
.fi
|
||||||
|
.B mlx_loop_hook
|
||||||
|
(
|
||||||
|
.I void *mlx_ptr, int (*funct_ptr)(), void *param
|
||||||
|
);
|
||||||
|
|
||||||
|
.SH X-WINDOW EVENTS
|
||||||
|
|
||||||
|
The X-Window system is bi-directionnal. On one hand, the program sends orders to
|
||||||
|
the screen to display pixels, images, and so on. On the other hand,
|
||||||
|
it can get information from the keyboard and mouse associated to
|
||||||
|
the screen. To do so, the program receives "events" from the keyboard or the
|
||||||
|
mouse.
|
||||||
|
|
||||||
|
.SH DESCRIPTION
|
||||||
|
|
||||||
|
To receive events, you must use
|
||||||
|
.B mlx_loop
|
||||||
|
(). This function never returns. It is an infinite loop that waits for
|
||||||
|
an event, and then calls a user-defined function associated with this event.
|
||||||
|
A single parameter is needed, the connection identifier
|
||||||
|
.I mlx_ptr
|
||||||
|
(see the
|
||||||
|
.B mlx manual).
|
||||||
|
|
||||||
|
You can assign different functions to the three following events:
|
||||||
|
.br
|
||||||
|
- A key is pressed
|
||||||
|
.br
|
||||||
|
- The mouse button is pressed
|
||||||
|
.br
|
||||||
|
- A part of the window should be re-drawn
|
||||||
|
(this is called an "expose" event, and it is your program's job to handle it).
|
||||||
|
.br
|
||||||
|
|
||||||
|
Each window can define a different function for the same event.
|
||||||
|
|
||||||
|
The three functions
|
||||||
|
.B mlx_key_hook
|
||||||
|
(),
|
||||||
|
.B mlx_mouse_hook
|
||||||
|
() and
|
||||||
|
.B mlx_expose_hook
|
||||||
|
() work exactly the same way.
|
||||||
|
.I funct_ptr
|
||||||
|
is a pointer to the function you want to be called
|
||||||
|
when an event occurs. This assignment is specific to the window defined by the
|
||||||
|
.I win_ptr
|
||||||
|
identifier. The
|
||||||
|
.I param
|
||||||
|
adress will be passed to the function everytime it is called, and should be
|
||||||
|
used to store the parameters it might need.
|
||||||
|
|
||||||
|
The syntax for the
|
||||||
|
.B mlx_loop_hook
|
||||||
|
() function is identical to the previous ones, but the given function will be
|
||||||
|
called when no event occurs.
|
||||||
|
|
||||||
|
When it catches an event, the MiniLibX calls the corresponding function
|
||||||
|
with fixed parameters:
|
||||||
|
.nf
|
||||||
|
|
||||||
|
expose_hook(void *param);
|
||||||
|
key_hook(int keycode,void *param);
|
||||||
|
mouse_hook(int button,int x,int y,void *param);
|
||||||
|
loop_hook(void *param);
|
||||||
|
|
||||||
|
.fi
|
||||||
|
These function names are arbitrary. They here are used to distinguish
|
||||||
|
parameters according to the event. These functions are NOT part of the
|
||||||
|
MiniLibX.
|
||||||
|
|
||||||
|
.I param
|
||||||
|
is the address specified in the mlx_*_hook calls. This address is never
|
||||||
|
used nor modified by the MiniLibX. On key and mouse events, additional
|
||||||
|
information is passed:
|
||||||
|
.I keycode
|
||||||
|
tells you which key is pressed (look for the X11 include file "keysymdef.h"),
|
||||||
|
(
|
||||||
|
.I x
|
||||||
|
,
|
||||||
|
.I y
|
||||||
|
) are the coordinates of the mouse click in the window, and
|
||||||
|
.I button
|
||||||
|
tells you which mouse button was pressed.
|
||||||
|
|
||||||
|
.SH GOING FURTHER WITH EVENTS
|
||||||
|
The MiniLibX provides a much generic access to all X-Window events. The
|
||||||
|
.I mlx.h
|
||||||
|
include define
|
||||||
|
.B mlx_hook()
|
||||||
|
in the same manner mlx_*_hook functions work. The event and mask values
|
||||||
|
will be taken from the X11 include file "X.h".
|
||||||
|
|
||||||
|
See source code of mlx_int_param_event.c to find out how the MiniLibX will
|
||||||
|
call your own function for a specific event.
|
||||||
|
|
||||||
|
.SH SEE ALSO
|
||||||
|
mlx(3), mlx_new_window(3), mlx_pixel_put(3), mlx_new_image(3)
|
||||||
|
|
||||||
|
.SH AUTHOR
|
||||||
|
Copyright ol@ - 2002-2014 - Olivier Crouzet
|
||||||
192
mlx/man/man3/mlx_new_image.3
Normal file
192
mlx/man/man3/mlx_new_image.3
Normal file
@@ -0,0 +1,192 @@
|
|||||||
|
.TH MiniLibX 3 "September 19, 2002"
|
||||||
|
.SH NAME
|
||||||
|
MiniLibX - Manipulating images
|
||||||
|
.SH SYNOPSYS
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I void *
|
||||||
|
.fi
|
||||||
|
.B mlx_new_image
|
||||||
|
(
|
||||||
|
.I void *mlx_ptr, int width, int height
|
||||||
|
);
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I char *
|
||||||
|
.fi
|
||||||
|
.B mlx_get_data_addr
|
||||||
|
(
|
||||||
|
.I void *img_ptr, int *bits_per_pixel, int *size_line, int *endian
|
||||||
|
);
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I int
|
||||||
|
.fi
|
||||||
|
.B mlx_put_image_to_window
|
||||||
|
(
|
||||||
|
.I void *mlx_ptr, void *win_ptr, void *img_ptr, int x, int y
|
||||||
|
);
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I unsigned int
|
||||||
|
.fi
|
||||||
|
.B mlx_get_color_value
|
||||||
|
(
|
||||||
|
.I void *mlx_ptr, int color
|
||||||
|
);
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I void *
|
||||||
|
.fi
|
||||||
|
.B mlx_xpm_to_image
|
||||||
|
(
|
||||||
|
.I void *mlx_ptr, char **xpm_data, int *width, int *height
|
||||||
|
);
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I void *
|
||||||
|
.fi
|
||||||
|
.B mlx_xpm_file_to_image
|
||||||
|
(
|
||||||
|
.I void *mlx_ptr, char *filename, int *width, int *height
|
||||||
|
);
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I int
|
||||||
|
.fi
|
||||||
|
.B mlx_destroy_image
|
||||||
|
(
|
||||||
|
.I void *mlx_ptr, void *img_ptr
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
.SH DESCRIPTION
|
||||||
|
|
||||||
|
.B mlx_new_image
|
||||||
|
() creates a new image in memory. It returns a
|
||||||
|
.I void *
|
||||||
|
identifier needed to manipulate this image later. It only needs
|
||||||
|
the size of the image to be created, using the
|
||||||
|
.I width
|
||||||
|
and
|
||||||
|
.I height
|
||||||
|
parameters, and the
|
||||||
|
.I mlx_ptr
|
||||||
|
connection identifier (see the
|
||||||
|
.B mlx
|
||||||
|
manual).
|
||||||
|
|
||||||
|
The user can draw inside the image (see below), and
|
||||||
|
can dump the image inside a specified window at any time to
|
||||||
|
display it on the screen. This is done using
|
||||||
|
.B mlx_put_image_to_window
|
||||||
|
(). Three identifiers are needed here, for the connection to the
|
||||||
|
display, the window to use, and the image (respectively
|
||||||
|
.I mlx_ptr
|
||||||
|
,
|
||||||
|
.I win_ptr
|
||||||
|
and
|
||||||
|
.I img_ptr
|
||||||
|
). The (
|
||||||
|
.I x
|
||||||
|
,
|
||||||
|
.I y
|
||||||
|
) coordinates define where the image should be placed in the window.
|
||||||
|
|
||||||
|
.B mlx_get_data_addr
|
||||||
|
() returns information about the created image, allowing a user
|
||||||
|
to modify it later. The
|
||||||
|
.I img_ptr
|
||||||
|
parameter specifies the image to use. The three next parameters should
|
||||||
|
be the addresses of three different valid integers.
|
||||||
|
.I bits_per_pixel
|
||||||
|
will be filled with the number of bits needed to represent a pixel color
|
||||||
|
(also called the depth of the image).
|
||||||
|
.I size_line
|
||||||
|
is the number of bytes used to store one line of the image in memory.
|
||||||
|
This information is needed to move from one line to another in the image.
|
||||||
|
.I endian
|
||||||
|
tells you wether the pixel color in the image needs to be stored in
|
||||||
|
little endian (
|
||||||
|
.I endian
|
||||||
|
== 0), or big endian (
|
||||||
|
.I endian
|
||||||
|
== 1).
|
||||||
|
|
||||||
|
.B mlx_get_data_addr
|
||||||
|
returns a
|
||||||
|
.I char *
|
||||||
|
address that represents the begining of the memory area where the image
|
||||||
|
is stored. From this adress, the first
|
||||||
|
.I bits_per_pixel
|
||||||
|
bits represent the color of the first pixel in the first line of
|
||||||
|
the image. The second group of
|
||||||
|
.I bits_per_pixel
|
||||||
|
bits represent the second pixel of the first line, and so on.
|
||||||
|
Add
|
||||||
|
.I size_line
|
||||||
|
to the adress to get the begining of the second line. You can reach any
|
||||||
|
pixels of the image that way.
|
||||||
|
|
||||||
|
.B mlx_destroy_image
|
||||||
|
destroys the given image (
|
||||||
|
.I img_ptr
|
||||||
|
).
|
||||||
|
|
||||||
|
.SH STORING COLOR INSIDE IMAGES
|
||||||
|
|
||||||
|
Depending on the display, the number of bits used to store a pixel color
|
||||||
|
can change. The user usually represents a color in RGB mode, using
|
||||||
|
one byte for each component (see
|
||||||
|
.B mlx_pixel_put
|
||||||
|
manual). This must be translated to fit the
|
||||||
|
.I bits_per_pixel
|
||||||
|
requirement of the image, and make the color understandable to the X-Server.
|
||||||
|
That is the purpose of the
|
||||||
|
.B mlx_get_color_value
|
||||||
|
() function. It takes a standard RGB
|
||||||
|
.I color
|
||||||
|
parameter, and returns an
|
||||||
|
.I unsigned int
|
||||||
|
value.
|
||||||
|
The
|
||||||
|
.I bits_per_pixel
|
||||||
|
least significant bits of this value can be stored in the image.
|
||||||
|
|
||||||
|
Keep in mind that the least significant bits position depends on the local
|
||||||
|
computer's endian. If the endian of the image (in fact the endian of
|
||||||
|
the X-Server's computer) differs from the local endian, then the value should
|
||||||
|
be transformed before being used.
|
||||||
|
|
||||||
|
.SH XPM IMAGES
|
||||||
|
|
||||||
|
The
|
||||||
|
.B mlx_xpm_to_image
|
||||||
|
() and
|
||||||
|
.B mlx_xpm_file_to_image
|
||||||
|
() functions will create a new image the same way.
|
||||||
|
They will fill it using the specified
|
||||||
|
.I xpm_data
|
||||||
|
or
|
||||||
|
.I filename
|
||||||
|
, depending on which function is used.
|
||||||
|
Note that MiniLibX does not use the standard
|
||||||
|
Xpm library to deal with xpm images. You may not be able to
|
||||||
|
read all types of xpm images. It however handles transparency.
|
||||||
|
|
||||||
|
.SH RETURN VALUES
|
||||||
|
The three functions that create images,
|
||||||
|
.B mlx_new_image()
|
||||||
|
,
|
||||||
|
.B mlx_xpm_to_image()
|
||||||
|
and
|
||||||
|
.B mlx_xpm_file_to_image()
|
||||||
|
, will return NULL if an error occurs. Otherwise they return a non-null pointer
|
||||||
|
as an image identifier.
|
||||||
|
|
||||||
|
|
||||||
|
.SH SEE ALSO
|
||||||
|
mlx(3), mlx_new_window(3), mlx_pixel_put(3), mlx_loop(3)
|
||||||
|
|
||||||
|
.SH AUTHOR
|
||||||
|
Copyright ol@ - 2002-2014 - Olivier Crouzet
|
||||||
79
mlx/man/man3/mlx_new_window.3
Normal file
79
mlx/man/man3/mlx_new_window.3
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
.TH MiniLibX 3 "September 19, 2002"
|
||||||
|
.SH NAME
|
||||||
|
MiniLibX - Managing windows
|
||||||
|
.SH SYNOPSYS
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I void *
|
||||||
|
.fi
|
||||||
|
.B mlx_new_window
|
||||||
|
(
|
||||||
|
.I void *mlx_ptr, int size_x, int size_y, char *title
|
||||||
|
);
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I int
|
||||||
|
.fi
|
||||||
|
.B mlx_clear_window
|
||||||
|
(
|
||||||
|
.I void *mlx_ptr, void *win_ptr
|
||||||
|
);
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I int
|
||||||
|
.fi
|
||||||
|
.B mlx_destroy_window
|
||||||
|
(
|
||||||
|
.I void *mlx_ptr, void *win_ptr
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
.SH DESCRIPTION
|
||||||
|
The
|
||||||
|
.B mlx_new_window
|
||||||
|
() function creates a new window on the screen, using the
|
||||||
|
.I size_x
|
||||||
|
and
|
||||||
|
.I size_y
|
||||||
|
parameters to determine its size, and
|
||||||
|
.I title
|
||||||
|
as the text that should be displayed in the window's title bar.
|
||||||
|
The
|
||||||
|
.I mlx_ptr
|
||||||
|
parameter is the connection identifier returned by
|
||||||
|
.B mlx_init
|
||||||
|
() (see the
|
||||||
|
.B mlx
|
||||||
|
man page).
|
||||||
|
.B mlx_new_window
|
||||||
|
() returns a
|
||||||
|
.I void *
|
||||||
|
window identifier that can be used by other MiniLibX calls.
|
||||||
|
Note that the MiniLibX
|
||||||
|
can handle an arbitrary number of separate windows.
|
||||||
|
|
||||||
|
.B mlx_clear_window
|
||||||
|
() and
|
||||||
|
.B mlx_destroy_window
|
||||||
|
() respectively clear (in black) and destroy the given window. They both have
|
||||||
|
the same parameters:
|
||||||
|
.I mlx_ptr
|
||||||
|
is the screen connection identifier, and
|
||||||
|
.I win_ptr
|
||||||
|
is a window identifier.
|
||||||
|
|
||||||
|
.SH RETURN VALUES
|
||||||
|
If
|
||||||
|
.B mlx_new_window()
|
||||||
|
fails to create a new window (for wathever reason), it will return NULL,
|
||||||
|
otherwise a non-null pointer is returned as a window identifier.
|
||||||
|
.B mlx_clear_window
|
||||||
|
and
|
||||||
|
.B mlx_destroy_window
|
||||||
|
right now return nothing.
|
||||||
|
|
||||||
|
.SH SEE ALSO
|
||||||
|
mlx(3), mlx_pixel_put(3), mlx_new_image(3), mlx_loop(3)
|
||||||
|
|
||||||
|
.SH AUTHOR
|
||||||
|
Copyright ol@ - 2002-2014 - Olivier Crouzet
|
||||||
81
mlx/man/man3/mlx_pixel_put.3
Normal file
81
mlx/man/man3/mlx_pixel_put.3
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
.TH MiniLibX 3 "September 19, 2002"
|
||||||
|
.SH NAME
|
||||||
|
MiniLibX - Drawing inside windows
|
||||||
|
.SH SYNOPSYS
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I int
|
||||||
|
.fi
|
||||||
|
.B mlx_pixel_put
|
||||||
|
(
|
||||||
|
.I void *mlx_ptr, void *win_ptr, int x, int y, int color
|
||||||
|
);
|
||||||
|
|
||||||
|
.nf
|
||||||
|
.I int
|
||||||
|
.fi
|
||||||
|
.B mlx_string_put
|
||||||
|
(
|
||||||
|
.I void *mlx_ptr, void *win_ptr, int x, int y, int color, char *string
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
.SH DESCRIPTION
|
||||||
|
The
|
||||||
|
.B mlx_pixel_put
|
||||||
|
() function draws a defined pixel in the window
|
||||||
|
.I win_ptr
|
||||||
|
using the (
|
||||||
|
.I x
|
||||||
|
,
|
||||||
|
.I y
|
||||||
|
) coordinates, and the specified
|
||||||
|
.I color
|
||||||
|
\&. The origin (0,0) is the upper left corner of the window, the x and y axis
|
||||||
|
respectively pointing right and down. The connection
|
||||||
|
identifier,
|
||||||
|
.I mlx_ptr
|
||||||
|
, is needed (see the
|
||||||
|
.B mlx
|
||||||
|
man page).
|
||||||
|
|
||||||
|
Parameters for
|
||||||
|
.B mlx_string_put
|
||||||
|
() have the same meaning. Instead of a simple pixel, the specified
|
||||||
|
.I string
|
||||||
|
will be displayed at (
|
||||||
|
.I x
|
||||||
|
,
|
||||||
|
.I y
|
||||||
|
).
|
||||||
|
|
||||||
|
In both functions, it is impossible to display anything outside the
|
||||||
|
specified window, nor display in another window in front of the selected one.
|
||||||
|
|
||||||
|
.SH COLOR MANAGEMENT
|
||||||
|
The
|
||||||
|
.I color
|
||||||
|
parameter has an integer type. The displayed color needs to be encoded
|
||||||
|
in this integer, following a defined scheme. All displayable colors
|
||||||
|
can be split in 3 basic colors: red, green and blue. Three associated
|
||||||
|
values, in the 0-255 range, represent how much of each color is mixed up
|
||||||
|
to create the original color. Theses three values must be set inside the
|
||||||
|
integer to display the right color. The three least significant bytes of
|
||||||
|
this integer are filled as shown in the picture below:
|
||||||
|
|
||||||
|
.nf
|
||||||
|
| 0 | R | G | B | color integer
|
||||||
|
+---+---+---+---+
|
||||||
|
.fi
|
||||||
|
|
||||||
|
|
||||||
|
While filling the integer, make sure you avoid endian problems. Remember
|
||||||
|
that the "blue" byte should always be the least significant one.
|
||||||
|
|
||||||
|
|
||||||
|
.SH SEE ALSO
|
||||||
|
mlx(3), mlx_new_window(3), mlx_new_image(3), mlx_loop(3)
|
||||||
|
|
||||||
|
|
||||||
|
.SH AUTHOR
|
||||||
|
Copyright ol@ - 2002-2014 - Olivier Crouzet
|
||||||
139
mlx/mlx.h
Normal file
139
mlx/mlx.h
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
/*
|
||||||
|
** mlx.h for MinilibX in
|
||||||
|
**
|
||||||
|
** Made by Charlie Root
|
||||||
|
** Login <ol@epitech.net>
|
||||||
|
**
|
||||||
|
** Started on Mon Jul 31 16:37:50 2000 Charlie Root
|
||||||
|
** Last update Tue May 15 16:23:28 2007 Olivier Crouzet
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
** MinilibX - Please report bugs
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
** FR msg - FR msg - FR msg
|
||||||
|
**
|
||||||
|
** La MinilibX utilise 2 librairies supplementaires qu'il
|
||||||
|
** est necessaire de rajouter a la compilation :
|
||||||
|
** -lmlx -lXext -lX11
|
||||||
|
**
|
||||||
|
** La MinilibX permet le chargement des images de type Xpm.
|
||||||
|
** Notez que cette implementation est incomplete.
|
||||||
|
** Merci de communiquer tout probleme de chargement d'image
|
||||||
|
** de ce type.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef MLX_H
|
||||||
|
|
||||||
|
#define MLX_H
|
||||||
|
|
||||||
|
|
||||||
|
void *mlx_init();
|
||||||
|
/*
|
||||||
|
** needed before everything else.
|
||||||
|
** return (void *)0 if failed
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Basic actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
void *mlx_new_window(void *mlx_ptr, int size_x, int size_y, char *title);
|
||||||
|
/*
|
||||||
|
** return void *0 if failed
|
||||||
|
*/
|
||||||
|
int mlx_clear_window(void *mlx_ptr, void *win_ptr);
|
||||||
|
int mlx_pixel_put(void *mlx_ptr, void *win_ptr, int x, int y, int color);
|
||||||
|
/*
|
||||||
|
** origin for x & y is top left corner of the window
|
||||||
|
** y down is positive
|
||||||
|
** color is 0x00RRGGBB
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Image stuff
|
||||||
|
*/
|
||||||
|
|
||||||
|
void *mlx_new_image(void *mlx_ptr,int width,int height);
|
||||||
|
/*
|
||||||
|
** return void *0 if failed
|
||||||
|
** obsolete : image2 data is stored using bit planes
|
||||||
|
** void *mlx_new_image2(void *mlx_ptr,int width,int height);
|
||||||
|
*/
|
||||||
|
char *mlx_get_data_addr(void *img_ptr, int *bits_per_pixel,
|
||||||
|
int *size_line, int *endian);
|
||||||
|
/*
|
||||||
|
** endian : 0 = sever X is little endian, 1 = big endian
|
||||||
|
** for mlx_new_image2, 2nd arg of mlx_get_data_addr is number_of_planes
|
||||||
|
*/
|
||||||
|
int mlx_put_image_to_window(void *mlx_ptr, void *win_ptr, void *img_ptr,
|
||||||
|
int x, int y);
|
||||||
|
int mlx_get_color_value(void *mlx_ptr, int color);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
** dealing with Events
|
||||||
|
*/
|
||||||
|
|
||||||
|
int mlx_mouse_hook (void *win_ptr, int (*funct_ptr)(), void *param);
|
||||||
|
int mlx_key_hook (void *win_ptr, int (*funct_ptr)(), void *param);
|
||||||
|
int mlx_expose_hook (void *win_ptr, int (*funct_ptr)(), void *param);
|
||||||
|
|
||||||
|
int mlx_loop_hook (void *mlx_ptr, int (*funct_ptr)(), void *param);
|
||||||
|
int mlx_loop (void *mlx_ptr);
|
||||||
|
int mlx_loop_end (void *mlx_ptr);
|
||||||
|
|
||||||
|
/*
|
||||||
|
** hook funct are called as follow :
|
||||||
|
**
|
||||||
|
** expose_hook(void *param);
|
||||||
|
** key_hook(int keycode, void *param);
|
||||||
|
** mouse_hook(int button, int x,int y, void *param);
|
||||||
|
** loop_hook(void *param);
|
||||||
|
**
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Usually asked...
|
||||||
|
*/
|
||||||
|
|
||||||
|
int mlx_string_put(void *mlx_ptr, void *win_ptr, int x, int y, int color,
|
||||||
|
char *string);
|
||||||
|
void mlx_set_font(void *mlx_ptr, void *win_ptr, char *name);
|
||||||
|
void *mlx_xpm_to_image(void *mlx_ptr, char **xpm_data,
|
||||||
|
int *width, int *height);
|
||||||
|
void *mlx_xpm_file_to_image(void *mlx_ptr, char *filename,
|
||||||
|
int *width, int *height);
|
||||||
|
int mlx_destroy_window(void *mlx_ptr, void *win_ptr);
|
||||||
|
|
||||||
|
int mlx_destroy_image(void *mlx_ptr, void *img_ptr);
|
||||||
|
|
||||||
|
int mlx_destroy_display(void *mlx_ptr);
|
||||||
|
|
||||||
|
/*
|
||||||
|
** generic hook system for all events, and minilibX functions that
|
||||||
|
** can be hooked. Some macro and defines from X11/X.h are needed here.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int mlx_hook(void *win_ptr, int x_event, int x_mask,
|
||||||
|
int (*funct)(), void *param);
|
||||||
|
|
||||||
|
int mlx_do_key_autorepeatoff(void *mlx_ptr);
|
||||||
|
int mlx_do_key_autorepeaton(void *mlx_ptr);
|
||||||
|
int mlx_do_sync(void *mlx_ptr);
|
||||||
|
|
||||||
|
int mlx_mouse_get_pos(void *mlx_ptr, void *win_ptr, int *x, int *y);
|
||||||
|
int mlx_mouse_move(void *mlx_ptr, void *win_ptr, int x, int y);
|
||||||
|
int mlx_mouse_hide(void *mlx_ptr, void *win_ptr);
|
||||||
|
int mlx_mouse_show(void *mlx_ptr, void *win_ptr);
|
||||||
|
|
||||||
|
int mlx_get_screen_size(void *mlx_ptr, int *sizex, int *sizey);
|
||||||
|
|
||||||
|
#endif /* MLX_H */
|
||||||
21
mlx/mlx_clear_window.c
Normal file
21
mlx/mlx_clear_window.c
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
** mlx_clear_window.c for MiniLibX in
|
||||||
|
**
|
||||||
|
** Made by Charlie Root
|
||||||
|
** Login <ol@epitech.net>
|
||||||
|
**
|
||||||
|
** Started on Thu Sep 7 19:46:15 2000 Charlie Root
|
||||||
|
** Last update Tue Sep 25 17:11:19 2001 Charlie Root
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_clear_window(t_xvar *xvar,t_win_list *win)
|
||||||
|
{
|
||||||
|
XClearWindow(xvar->display,win->window);
|
||||||
|
if (xvar->do_flush)
|
||||||
|
XFlush(xvar->display);
|
||||||
|
}
|
||||||
18
mlx/mlx_destroy_display.c
Normal file
18
mlx/mlx_destroy_display.c
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* mlx_destroy_display.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: mg <mg@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2020/10/03 18:56:35 by mg #+# #+# */
|
||||||
|
/* Updated: 2020/10/04 01:55:35 by mg ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
int mlx_destroy_display(t_xvar *xvar)
|
||||||
|
{
|
||||||
|
XCloseDisplay(xvar->display);
|
||||||
|
}
|
||||||
31
mlx/mlx_destroy_image.c
Normal file
31
mlx/mlx_destroy_image.c
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
** mlx_destroy_image.c for MinilibX in
|
||||||
|
**
|
||||||
|
** Made by Charlie Root
|
||||||
|
** Login <ol@epitech.net>
|
||||||
|
**
|
||||||
|
** Started on Tue Mar 12 10:25:15 2002 Charlie Root
|
||||||
|
** Last update Tue May 15 16:45:54 2007 Olivier Crouzet
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_destroy_image(t_xvar *xvar, t_img *img)
|
||||||
|
{
|
||||||
|
if (img->type == MLX_TYPE_SHM_PIXMAP ||
|
||||||
|
img->type == MLX_TYPE_SHM)
|
||||||
|
{
|
||||||
|
XShmDetach(xvar->display, &(img->shm));
|
||||||
|
shmdt(img->shm.shmaddr);
|
||||||
|
/* shmctl IPC_RMID already done */
|
||||||
|
}
|
||||||
|
XDestroyImage(img->image); /* For image & shm-image. Also free img->data */
|
||||||
|
XFreePixmap(xvar->display, img->pix);
|
||||||
|
if (img->gc)
|
||||||
|
XFreeGC(xvar->display, img->gc);
|
||||||
|
free(img);
|
||||||
|
if (xvar->do_flush)
|
||||||
|
XFlush(xvar->display);
|
||||||
|
}
|
||||||
38
mlx/mlx_destroy_window.c
Normal file
38
mlx/mlx_destroy_window.c
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
** mlx_destroy_window.c for MinilibX in
|
||||||
|
**
|
||||||
|
** Made by Charlie Root
|
||||||
|
** Login <ol@epitech.net>
|
||||||
|
**
|
||||||
|
** Started on Tue Mar 12 10:25:15 2002 Charlie Root
|
||||||
|
** Last update Tue May 15 16:46:08 2007 Olivier Crouzet
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_destroy_window(t_xvar *xvar,t_win_list *win)
|
||||||
|
{
|
||||||
|
t_win_list *w;
|
||||||
|
t_win_list *prev;
|
||||||
|
t_win_list first;
|
||||||
|
|
||||||
|
first.next = xvar->win_list;
|
||||||
|
prev = &first;
|
||||||
|
w = prev->next;
|
||||||
|
while (w)
|
||||||
|
{
|
||||||
|
if (w==win)
|
||||||
|
prev->next = w->next;
|
||||||
|
else
|
||||||
|
prev = w;
|
||||||
|
w = w->next;
|
||||||
|
}
|
||||||
|
xvar->win_list = first.next;
|
||||||
|
XDestroyWindow(xvar->display,win->window);
|
||||||
|
XFreeGC(xvar->display,win->gc);
|
||||||
|
free(win);
|
||||||
|
if (xvar->do_flush)
|
||||||
|
XFlush(xvar->display);
|
||||||
|
}
|
||||||
22
mlx/mlx_expose_hook.c
Normal file
22
mlx/mlx_expose_hook.c
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
** mlx_expose_hook.c for MiniLibX in
|
||||||
|
**
|
||||||
|
** Made by Charlie Root
|
||||||
|
** Login <ol@epitech.net>
|
||||||
|
**
|
||||||
|
** Started on Thu Aug 3 11:49:06 2000 Charlie Root
|
||||||
|
** Last update Fri Feb 23 17:07:42 2001 Charlie Root
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_expose_hook(t_win_list *win,int (*funct)(),void *param)
|
||||||
|
{
|
||||||
|
win->hooks[Expose].hook = funct;
|
||||||
|
win->hooks[Expose].param = param;
|
||||||
|
win->hooks[Expose].mask = ExposureMask;
|
||||||
|
}
|
||||||
104
mlx/mlx_ext_randr.c
Normal file
104
mlx/mlx_ext_randr.c
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <X11/extensions/Xrandr.h>
|
||||||
|
|
||||||
|
/* global for independant extension */
|
||||||
|
|
||||||
|
RRMode saved_mode = 0;
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_ext_fullscreen(t_xvar *xvar, t_win_list *win, int fullscreen)
|
||||||
|
{
|
||||||
|
XWindowAttributes watt;
|
||||||
|
int i;
|
||||||
|
int j;
|
||||||
|
XRRScreenResources *res;
|
||||||
|
XRROutputInfo *o_info;
|
||||||
|
XRRCrtcInfo *crtc;
|
||||||
|
RRMode mode_candidate;
|
||||||
|
int idx_output;
|
||||||
|
int idx_candidate;
|
||||||
|
|
||||||
|
if (!XGetWindowAttributes(xvar->display, win->window, &watt))
|
||||||
|
return (0);
|
||||||
|
|
||||||
|
res = XRRGetScreenResources(xvar->display, xvar->root);
|
||||||
|
o_info = NULL;
|
||||||
|
idx_output = -1;
|
||||||
|
i = res->noutput;
|
||||||
|
while (i--)
|
||||||
|
{
|
||||||
|
o_info = XRRGetOutputInfo(xvar->display, res, res->outputs[i]);
|
||||||
|
if (o_info->connection == RR_Connected)
|
||||||
|
{
|
||||||
|
idx_output = i;
|
||||||
|
i = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
XRRFreeOutputInfo(o_info);
|
||||||
|
}
|
||||||
|
if (!o_info)
|
||||||
|
{
|
||||||
|
XRRFreeScreenResources(res);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
idx_candidate = -1;
|
||||||
|
i = o_info->nmode;
|
||||||
|
while (i--)
|
||||||
|
{
|
||||||
|
j = res->nmode;
|
||||||
|
while (j--)
|
||||||
|
if (res->modes[j].id == o_info->modes[i])
|
||||||
|
if (res->modes[j].width >= watt.width && res->modes[j].height >= watt.height &&
|
||||||
|
(idx_candidate == -1 || res->modes[idx_candidate].width > res->modes[j].width ||
|
||||||
|
res->modes[idx_candidate].height > res->modes[j].height) )
|
||||||
|
idx_candidate = i;
|
||||||
|
}
|
||||||
|
if (idx_candidate < 0)
|
||||||
|
{
|
||||||
|
XRRFreeOutputInfo(o_info);
|
||||||
|
XRRFreeScreenResources(res);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
if (!fullscreen && saved_mode == -1)
|
||||||
|
idx_candidate = 0; /* if no clue, uses first mode, usually part of npreferred */
|
||||||
|
mode_candidate = o_info->modes[idx_candidate];
|
||||||
|
if (!fullscreen)
|
||||||
|
mode_candidate = saved_mode;
|
||||||
|
|
||||||
|
crtc = XRRGetCrtcInfo(xvar->display, res, o_info->crtc);
|
||||||
|
saved_mode = crtc->mode;
|
||||||
|
|
||||||
|
i = XRRSetCrtcConfig(xvar->display, res, o_info->crtc, CurrentTime, 0, 0, mode_candidate,
|
||||||
|
crtc->rotation, &res->outputs[idx_output], 1);
|
||||||
|
if (fullscreen)
|
||||||
|
printf("found mode : %d x %d\n Status %d\n", res->modes[idx_candidate].width, res->modes[idx_candidate].height, i);
|
||||||
|
else
|
||||||
|
printf("back previous mode\n");
|
||||||
|
|
||||||
|
XMoveWindow(xvar->display, win->window, 0, 0);
|
||||||
|
XMapRaised(xvar->display, win->window);
|
||||||
|
|
||||||
|
if (fullscreen)
|
||||||
|
{
|
||||||
|
// XGrabPointer(xvar->display, win->window, True, 0, GrabModeAsync, GrabModeAsync, win->window, 0L, CurrentTime);
|
||||||
|
XGrabKeyboard(xvar->display, win->window, False, GrabModeAsync, GrabModeAsync, CurrentTime);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
XUngrabPointer(xvar->display, CurrentTime);
|
||||||
|
XUngrabKeyboard(xvar->display, CurrentTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
XSync(xvar->display, False);
|
||||||
|
sleep(1);
|
||||||
|
|
||||||
|
XRRFreeCrtcInfo(crtc);
|
||||||
|
XRRFreeOutputInfo(o_info);
|
||||||
|
XRRFreeScreenResources(res);
|
||||||
|
}
|
||||||
25
mlx/mlx_flush_event.c
Normal file
25
mlx/mlx_flush_event.c
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
** mlx_flush_event.c for MiniLibX in
|
||||||
|
**
|
||||||
|
** Made by Charlie Root
|
||||||
|
** Login <ol@epitech.net>
|
||||||
|
**
|
||||||
|
** Started on Wed Aug 2 18:58:11 2000 Charlie Root
|
||||||
|
** Last update Fri Feb 23 17:08:48 2001 Charlie Root
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_flush_event(t_xvar *xvar)
|
||||||
|
{
|
||||||
|
XEvent ev;
|
||||||
|
|
||||||
|
while (XPending(xvar->display))
|
||||||
|
{
|
||||||
|
XNextEvent(xvar->display,&ev);
|
||||||
|
}
|
||||||
|
}
|
||||||
33
mlx/mlx_get_color_value.c
Normal file
33
mlx/mlx_get_color_value.c
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
** mlx_get_color_value.c for MiniLibX in
|
||||||
|
**
|
||||||
|
** Made by Charlie Root
|
||||||
|
** Login <ol@epitech.net>
|
||||||
|
**
|
||||||
|
** Started on Mon Jul 31 19:01:33 2000 Charlie Root
|
||||||
|
** Last update Thu Oct 4 15:04:13 2001 Charlie Root
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_get_color_value(t_xvar *xvar,int color)
|
||||||
|
{
|
||||||
|
return(mlx_int_get_good_color(xvar,color));
|
||||||
|
}
|
||||||
|
|
||||||
|
int mlx_int_get_good_color(t_xvar *xvar,int color)
|
||||||
|
{
|
||||||
|
XColor xc;
|
||||||
|
|
||||||
|
if (xvar->depth>=24)
|
||||||
|
return (color);
|
||||||
|
xc.red = (color>>8)&0xFF00;
|
||||||
|
xc.green = color&0xFF00;
|
||||||
|
xc.blue = (color<<8)&0xFF00;
|
||||||
|
xc.pixel = ((xc.red>>(16-xvar->decrgb[1]))<<xvar->decrgb[0])+
|
||||||
|
((xc.green>>(16-xvar->decrgb[3]))<<xvar->decrgb[2])+
|
||||||
|
((xc.blue>>(16-xvar->decrgb[5]))<<xvar->decrgb[4]);
|
||||||
|
return (xc.pixel);
|
||||||
|
}
|
||||||
23
mlx/mlx_get_data_addr.c
Normal file
23
mlx/mlx_get_data_addr.c
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
** mlx_get_data_addr.c for MiniLibX in raytraceur
|
||||||
|
**
|
||||||
|
** Made by Charlie Root
|
||||||
|
** Login <ol@epitech.net>
|
||||||
|
**
|
||||||
|
** Started on Mon Aug 14 15:45:57 2000 Charlie Root
|
||||||
|
** Last update Thu Sep 27 19:05:25 2001 Charlie Root
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
|
||||||
|
char *mlx_get_data_addr(t_img *img,int *bits_per_pixel,
|
||||||
|
int *size_line,int *endian)
|
||||||
|
{
|
||||||
|
*bits_per_pixel = img->bpp;
|
||||||
|
*size_line = img->size_line;
|
||||||
|
*endian = img->image->byte_order;
|
||||||
|
return (img->data);
|
||||||
|
}
|
||||||
40
mlx/mlx_hook.c
Normal file
40
mlx/mlx_hook.c
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
** mlx_hook.c for MiniLibX in
|
||||||
|
**
|
||||||
|
** Made by Charlie Root
|
||||||
|
** Login <ol@epitech.net>
|
||||||
|
**
|
||||||
|
** Started on Thu Aug 3 11:49:06 2000 Charlie Root
|
||||||
|
** Last update Fri Jan 28 17:05:28 2005 Olivier Crouzet
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_hook(t_win_list *win, int x_event, int x_mask,
|
||||||
|
int (*funct)(),void *param)
|
||||||
|
{
|
||||||
|
win->hooks[x_event].hook = funct;
|
||||||
|
win->hooks[x_event].param = param;
|
||||||
|
win->hooks[x_event].mask = x_mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_do_key_autorepeatoff(t_xvar *xvar)
|
||||||
|
{
|
||||||
|
XAutoRepeatOff(xvar->display);
|
||||||
|
}
|
||||||
|
|
||||||
|
int mlx_do_key_autorepeaton(t_xvar *xvar)
|
||||||
|
{
|
||||||
|
XAutoRepeatOn(xvar->display);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_do_sync(t_xvar *xvar)
|
||||||
|
{
|
||||||
|
XSync(xvar->display, False);
|
||||||
|
}
|
||||||
99
mlx/mlx_init.c
Normal file
99
mlx/mlx_init.c
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
/*
|
||||||
|
** mlx_init.c for MiniLibX in
|
||||||
|
**
|
||||||
|
** Made by Charlie Root
|
||||||
|
** Login <ol@epitech.net>
|
||||||
|
**
|
||||||
|
** Started on Mon Jul 31 16:52:42 2000 Charlie Root
|
||||||
|
** Last update Fri Jan 28 17:05:09 2005 Olivier Crouzet
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void *mlx_init()
|
||||||
|
{
|
||||||
|
t_xvar *xvar;
|
||||||
|
|
||||||
|
if (!(xvar = malloc(sizeof(*xvar))))
|
||||||
|
return ((void*)0);
|
||||||
|
if ((xvar->display = XOpenDisplay("")) == 0)
|
||||||
|
{
|
||||||
|
free(xvar);
|
||||||
|
return ((void*)0);
|
||||||
|
}
|
||||||
|
xvar->screen = DefaultScreen(xvar->display);
|
||||||
|
xvar->root = DefaultRootWindow(xvar->display);
|
||||||
|
xvar->cmap = DefaultColormap(xvar->display,xvar->screen);
|
||||||
|
xvar->depth = DefaultDepth(xvar->display,xvar->screen);
|
||||||
|
if (mlx_int_get_visual(xvar)==-1)
|
||||||
|
{
|
||||||
|
printf(ERR_NO_TRUECOLOR);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
xvar->win_list = 0;
|
||||||
|
xvar->loop_hook = 0;
|
||||||
|
xvar->loop_param = (void *)0;
|
||||||
|
xvar->do_flush = 1;
|
||||||
|
xvar->wm_delete_window = XInternAtom (xvar->display, "WM_DELETE_WINDOW", False);
|
||||||
|
xvar->wm_protocols = XInternAtom (xvar->display, "WM_PROTOCOLS", False);
|
||||||
|
mlx_int_deal_shm(xvar);
|
||||||
|
if (xvar->private_cmap)
|
||||||
|
xvar->cmap = XCreateColormap(xvar->display,xvar->root,
|
||||||
|
xvar->visual,AllocNone);
|
||||||
|
mlx_int_rgb_conversion(xvar);
|
||||||
|
xvar->end_loop = 0;
|
||||||
|
return (xvar);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
** pshm_format of -1 : Not XYBitmap|XYPixmap|ZPixmap
|
||||||
|
** alpha libX need a check of the DISPLAY env var, or shm is allowed
|
||||||
|
** in remote Xserver connections.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int mlx_int_deal_shm(t_xvar *xvar)
|
||||||
|
{
|
||||||
|
int use_pshm;
|
||||||
|
int bidon;
|
||||||
|
char *dpy;
|
||||||
|
char buff[33];
|
||||||
|
|
||||||
|
xvar->use_xshm = XShmQueryVersion(xvar->display,&bidon,&bidon,&(use_pshm));
|
||||||
|
if (xvar->use_xshm && use_pshm)
|
||||||
|
xvar->pshm_format = XShmPixmapFormat(xvar->display);
|
||||||
|
else
|
||||||
|
xvar->pshm_format = -1;
|
||||||
|
gethostname(buff,32);
|
||||||
|
dpy = getenv(ENV_DISPLAY);
|
||||||
|
if (dpy && strlen(dpy) && *dpy!=':' && strncmp(dpy,buff,strlen(buff)) &&
|
||||||
|
strncmp(dpy,LOCALHOST,strlen(LOCALHOST)) )
|
||||||
|
{
|
||||||
|
xvar->pshm_format = -1;
|
||||||
|
xvar->use_xshm = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** TrueColor Visual is needed to have *_mask correctly set
|
||||||
|
*/
|
||||||
|
|
||||||
|
int mlx_int_rgb_conversion(t_xvar *xvar)
|
||||||
|
{
|
||||||
|
bzero(xvar->decrgb,sizeof(int)*6);
|
||||||
|
while (!(xvar->visual->red_mask&1))
|
||||||
|
{ xvar->visual->red_mask >>= 1; xvar->decrgb[0] ++; }
|
||||||
|
while (xvar->visual->red_mask&1)
|
||||||
|
{ xvar->visual->red_mask >>= 1; xvar->decrgb[1] ++; }
|
||||||
|
while (!(xvar->visual->green_mask&1))
|
||||||
|
{ xvar->visual->green_mask >>= 1; xvar->decrgb[2] ++; }
|
||||||
|
while (xvar->visual->green_mask&1)
|
||||||
|
{ xvar->visual->green_mask >>= 1; xvar->decrgb[3] ++; }
|
||||||
|
while (!(xvar->visual->blue_mask&1))
|
||||||
|
{ xvar->visual->blue_mask >>= 1; xvar->decrgb[4] ++; }
|
||||||
|
while (xvar->visual->blue_mask&1)
|
||||||
|
{ xvar->visual->blue_mask >>= 1; xvar->decrgb[5] ++; }
|
||||||
|
}
|
||||||
140
mlx/mlx_int.h
Normal file
140
mlx/mlx_int.h
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
/*
|
||||||
|
** mlx_int.h for mlx in
|
||||||
|
**
|
||||||
|
** Made by Charlie Root
|
||||||
|
** Login <ol@epitech.net>
|
||||||
|
**
|
||||||
|
** Started on Mon Jul 31 16:45:48 2000 Charlie Root
|
||||||
|
** Last update Wed May 25 16:44:16 2011 Olivier Crouzet
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Internal settings for MiniLibX
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MLX_INT_H
|
||||||
|
|
||||||
|
# define MLX_INT_H
|
||||||
|
|
||||||
|
# include <stdlib.h>
|
||||||
|
# include <stdio.h>
|
||||||
|
# include <string.h>
|
||||||
|
# include <unistd.h>
|
||||||
|
# include <fcntl.h>
|
||||||
|
# include <sys/mman.h>
|
||||||
|
# include <X11/Xlib.h>
|
||||||
|
# include <X11/Xutil.h>
|
||||||
|
# include <sys/ipc.h>
|
||||||
|
# include <sys/shm.h>
|
||||||
|
# include <X11/extensions/XShm.h>
|
||||||
|
# include <X11/XKBlib.h>
|
||||||
|
/* #include <X11/xpm.h> */
|
||||||
|
|
||||||
|
|
||||||
|
# define MLX_TYPE_SHM_PIXMAP 3
|
||||||
|
# define MLX_TYPE_SHM 2
|
||||||
|
# define MLX_TYPE_XIMAGE 1
|
||||||
|
|
||||||
|
# define MLX_MAX_EVENT LASTEvent
|
||||||
|
|
||||||
|
|
||||||
|
# define ENV_DISPLAY "DISPLAY"
|
||||||
|
# define LOCALHOST "localhost"
|
||||||
|
# define ERR_NO_TRUECOLOR "MinilibX Error : No TrueColor Visual available.\n"
|
||||||
|
# define WARN_SHM_ATTACH "MinilibX Warning : X server can't attach shared memory.\n"
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct s_xpm_col
|
||||||
|
{
|
||||||
|
int name;
|
||||||
|
int col;
|
||||||
|
} t_xpm_col;
|
||||||
|
|
||||||
|
|
||||||
|
struct s_col_name
|
||||||
|
{
|
||||||
|
char *name;
|
||||||
|
int color;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct s_event_list
|
||||||
|
{
|
||||||
|
int mask;
|
||||||
|
int (*hook)();
|
||||||
|
void *param;
|
||||||
|
} t_event_list;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct s_win_list
|
||||||
|
{
|
||||||
|
Window window;
|
||||||
|
GC gc;
|
||||||
|
struct s_win_list *next;
|
||||||
|
int (*mouse_hook)();
|
||||||
|
int (*key_hook)();
|
||||||
|
int (*expose_hook)();
|
||||||
|
void *mouse_param;
|
||||||
|
void *key_param;
|
||||||
|
void *expose_param;
|
||||||
|
t_event_list hooks[MLX_MAX_EVENT];
|
||||||
|
} t_win_list;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct s_img
|
||||||
|
{
|
||||||
|
XImage *image;
|
||||||
|
Pixmap pix;
|
||||||
|
GC gc;
|
||||||
|
int size_line;
|
||||||
|
int bpp;
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
int type;
|
||||||
|
int format;
|
||||||
|
char *data;
|
||||||
|
XShmSegmentInfo shm;
|
||||||
|
} t_img;
|
||||||
|
|
||||||
|
typedef struct s_xvar
|
||||||
|
{
|
||||||
|
Display *display;
|
||||||
|
Window root;
|
||||||
|
int screen;
|
||||||
|
int depth;
|
||||||
|
Visual *visual;
|
||||||
|
Colormap cmap;
|
||||||
|
int private_cmap;
|
||||||
|
t_win_list *win_list;
|
||||||
|
int (*loop_hook)();
|
||||||
|
void *loop_param;
|
||||||
|
int use_xshm;
|
||||||
|
int pshm_format;
|
||||||
|
int do_flush;
|
||||||
|
int decrgb[6];
|
||||||
|
Atom wm_delete_window;
|
||||||
|
Atom wm_protocols;
|
||||||
|
int end_loop;
|
||||||
|
} t_xvar;
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_int_do_nothing();
|
||||||
|
int mlx_get_color_value();
|
||||||
|
int mlx_int_get_good_color();
|
||||||
|
int mlx_int_find_in_pcm();
|
||||||
|
int mlx_int_anti_resize_win();
|
||||||
|
int mlx_int_wait_first_expose();
|
||||||
|
int mlx_int_rgb_conversion();
|
||||||
|
int mlx_int_deal_shm();
|
||||||
|
void *mlx_int_new_xshm_image();
|
||||||
|
char **mlx_int_str_to_wordtab();
|
||||||
|
void *mlx_new_image();
|
||||||
|
int shm_att_pb();
|
||||||
|
int mlx_int_get_visual(t_xvar *xvar);
|
||||||
|
int mlx_int_set_win_event_mask(t_xvar *xvar);
|
||||||
|
int mlx_int_str_str_cote(char *str,char *find,int len);
|
||||||
|
int mlx_int_str_str(char *str,char *find,int len);
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
28
mlx/mlx_int_anti_resize_win.c
Normal file
28
mlx/mlx_int_anti_resize_win.c
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
** mlx_int_anti_resize_win.c for MiniLibX in
|
||||||
|
**
|
||||||
|
** Made by Charlie Root
|
||||||
|
** Login <ol@epitech.net>
|
||||||
|
**
|
||||||
|
** Started on Tue Aug 8 14:31:05 2000 Charlie Root
|
||||||
|
** Last update Tue Sep 25 15:56:58 2001 Charlie Root
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_int_anti_resize_win(t_xvar *xvar,Window win,int w,int h)
|
||||||
|
{
|
||||||
|
XSizeHints hints;
|
||||||
|
long toto;
|
||||||
|
|
||||||
|
XGetWMNormalHints(xvar->display,win,&hints,&toto);
|
||||||
|
hints.width = w;
|
||||||
|
hints.height = h;
|
||||||
|
hints.min_width = w;
|
||||||
|
hints.min_height = h;
|
||||||
|
hints.max_width = w;
|
||||||
|
hints.max_height = h;
|
||||||
|
hints.flags = PPosition | PSize | PMinSize | PMaxSize;
|
||||||
|
XSetWMNormalHints(xvar->display,win,&hints);
|
||||||
|
}
|
||||||
16
mlx/mlx_int_do_nothing.c
Normal file
16
mlx/mlx_int_do_nothing.c
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
** mlx_int_do_nothing.c for MiniLibX in
|
||||||
|
**
|
||||||
|
** Made by Charlie Root
|
||||||
|
** Login <ol@epitech.net>
|
||||||
|
**
|
||||||
|
** Started on Tue Aug 8 12:58:24 2000 Charlie Root
|
||||||
|
** Last update Tue Sep 25 15:56:22 2001 Charlie Root
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_int_do_nothing(void *param)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
39
mlx/mlx_int_get_visual.c
Normal file
39
mlx/mlx_int_get_visual.c
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
** mlx_int_get_visual.c for MinilibX in
|
||||||
|
**
|
||||||
|
** Made by Charlie Root
|
||||||
|
** Login <ol@epitech.net>
|
||||||
|
**
|
||||||
|
** Started on Wed Oct 3 17:01:51 2001 Charlie Root
|
||||||
|
** Last update Thu Oct 4 15:00:45 2001 Charlie Root
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
** We need a private colormap for non-default Visual.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_int_get_visual(t_xvar *xvar)
|
||||||
|
{
|
||||||
|
XVisualInfo *vi;
|
||||||
|
XVisualInfo template;
|
||||||
|
int nb_item;
|
||||||
|
|
||||||
|
xvar->private_cmap = 0;
|
||||||
|
xvar->visual = DefaultVisual(xvar->display,xvar->screen);
|
||||||
|
if (xvar->visual->class == TrueColor)
|
||||||
|
return (0);
|
||||||
|
template.class = TrueColor;
|
||||||
|
template.depth = xvar->depth;
|
||||||
|
if (!(vi = XGetVisualInfo(xvar->display,VisualDepthMask|VisualClassMask,
|
||||||
|
&template,&nb_item)) )
|
||||||
|
return (-1);
|
||||||
|
xvar->visual = vi->visual;
|
||||||
|
xvar->private_cmap = 1;
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
100
mlx/mlx_int_param_event.c
Normal file
100
mlx/mlx_int_param_event.c
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
/*
|
||||||
|
** mlx_int_param_event.c for MinilibX in
|
||||||
|
**
|
||||||
|
** Made by Charlie Root
|
||||||
|
** Login <ol@epitech.net>
|
||||||
|
**
|
||||||
|
** Started on Mon Jul 31 16:37:50 2000 Charlie Root
|
||||||
|
** Last update Wed Oct 6 13:14:52 2004 Olivier Crouzet
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
int mlx_int_param_undef()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int mlx_int_param_KeyPress(t_xvar *xvar, XEvent *ev, t_win_list *win)
|
||||||
|
{
|
||||||
|
win->hooks[KeyPress].hook(XkbKeycodeToKeysym(xvar->display,
|
||||||
|
ev->xkey.keycode, 0, 0),
|
||||||
|
win->hooks[KeyPress].param);
|
||||||
|
}
|
||||||
|
|
||||||
|
int mlx_int_param_KeyRelease(t_xvar *xvar, XEvent *ev, t_win_list *win)
|
||||||
|
{
|
||||||
|
win->hooks[KeyRelease].hook(XkbKeycodeToKeysym(xvar->display,
|
||||||
|
ev->xkey.keycode, 0, 0),
|
||||||
|
win->hooks[KeyRelease].param);
|
||||||
|
}
|
||||||
|
|
||||||
|
int mlx_int_param_ButtonPress(t_xvar *xvar, XEvent *ev, t_win_list *win)
|
||||||
|
{
|
||||||
|
win->hooks[ButtonPress].hook(ev->xbutton.button,ev->xbutton.x,ev->xbutton.y,
|
||||||
|
win->hooks[ButtonPress].param);
|
||||||
|
}
|
||||||
|
|
||||||
|
int mlx_int_param_ButtonRelease(t_xvar *xvar, XEvent *ev, t_win_list *win)
|
||||||
|
{
|
||||||
|
win->hooks[ButtonRelease].hook(ev->xbutton.button,
|
||||||
|
ev->xbutton.x, ev->xbutton.y,
|
||||||
|
win->hooks[ButtonRelease].param);
|
||||||
|
}
|
||||||
|
|
||||||
|
int mlx_int_param_MotionNotify(t_xvar *xvar, XEvent *ev, t_win_list *win)
|
||||||
|
{
|
||||||
|
win->hooks[MotionNotify].hook(ev->xbutton.x,ev->xbutton.y,
|
||||||
|
win->hooks[MotionNotify].param);
|
||||||
|
}
|
||||||
|
|
||||||
|
int mlx_int_param_Expose(t_xvar *xvar, XEvent *ev, t_win_list *win)
|
||||||
|
{
|
||||||
|
if (!ev->xexpose.count)
|
||||||
|
win->hooks[Expose].hook(win->hooks[Expose].param);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_int_param_generic(t_xvar *xvar, XEvent *ev, t_win_list *win)
|
||||||
|
{
|
||||||
|
win->hooks[ev->type].hook(win->hooks[ev->type].param);
|
||||||
|
}
|
||||||
|
|
||||||
|
int (*(mlx_int_param_event[]))() =
|
||||||
|
{
|
||||||
|
mlx_int_param_undef, /* 0 */
|
||||||
|
mlx_int_param_undef,
|
||||||
|
mlx_int_param_KeyPress,
|
||||||
|
mlx_int_param_KeyRelease, /* 3 */
|
||||||
|
mlx_int_param_ButtonPress,
|
||||||
|
mlx_int_param_ButtonRelease,
|
||||||
|
mlx_int_param_MotionNotify, /* 6 */
|
||||||
|
mlx_int_param_generic,
|
||||||
|
mlx_int_param_generic,
|
||||||
|
mlx_int_param_generic,
|
||||||
|
mlx_int_param_generic,
|
||||||
|
mlx_int_param_generic,
|
||||||
|
mlx_int_param_Expose, /* 12 */
|
||||||
|
mlx_int_param_generic,
|
||||||
|
mlx_int_param_generic,
|
||||||
|
mlx_int_param_generic,
|
||||||
|
mlx_int_param_generic,
|
||||||
|
mlx_int_param_generic,
|
||||||
|
mlx_int_param_generic,
|
||||||
|
mlx_int_param_generic,
|
||||||
|
mlx_int_param_generic,
|
||||||
|
mlx_int_param_generic,
|
||||||
|
mlx_int_param_generic,
|
||||||
|
mlx_int_param_generic,
|
||||||
|
mlx_int_param_generic,
|
||||||
|
mlx_int_param_generic,
|
||||||
|
mlx_int_param_generic,
|
||||||
|
mlx_int_param_generic,
|
||||||
|
mlx_int_param_generic,
|
||||||
|
mlx_int_param_generic,
|
||||||
|
mlx_int_param_generic,
|
||||||
|
mlx_int_param_generic,
|
||||||
|
mlx_int_param_generic,
|
||||||
|
mlx_int_param_generic,
|
||||||
|
mlx_int_param_generic,
|
||||||
|
mlx_int_param_generic
|
||||||
|
};
|
||||||
34
mlx/mlx_int_set_win_event_mask.c
Normal file
34
mlx/mlx_int_set_win_event_mask.c
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
** mlx_int_set_win_event_mask.c for MiniLibX in
|
||||||
|
**
|
||||||
|
** Made by Charlie Root
|
||||||
|
** Login <ol@epitech.net>
|
||||||
|
**
|
||||||
|
** Started on Thu Aug 3 11:49:06 2000 Charlie Root
|
||||||
|
** Last update Fri Feb 23 17:07:42 2001 Charlie Root
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_int_set_win_event_mask(t_xvar *xvar)
|
||||||
|
{
|
||||||
|
t_win_list *win;
|
||||||
|
int mask;
|
||||||
|
int i;
|
||||||
|
XSetWindowAttributes xwa;
|
||||||
|
|
||||||
|
win = xvar->win_list;
|
||||||
|
while (win)
|
||||||
|
{
|
||||||
|
xwa.event_mask = 0;
|
||||||
|
i = MLX_MAX_EVENT;
|
||||||
|
while (i--)
|
||||||
|
xwa.event_mask |= win->hooks[i].mask;
|
||||||
|
XChangeWindowAttributes(xvar->display, win->window, CWEventMask, &xwa);
|
||||||
|
win = win->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
113
mlx/mlx_int_str_to_wordtab.c
Normal file
113
mlx/mlx_int_str_to_wordtab.c
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
/*
|
||||||
|
** mlx_int_str_to_wordtab.c for MinilibX in
|
||||||
|
**
|
||||||
|
** Made by Charlie Root
|
||||||
|
** Login <ol@epitech.net>
|
||||||
|
**
|
||||||
|
** Started on Wed Sep 13 11:36:09 2000 Charlie Root
|
||||||
|
** Last update Fri Dec 14 11:02:09 2001 Charlie Root
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_int_str_str(char *str,char *find,int len)
|
||||||
|
{
|
||||||
|
int len_f;
|
||||||
|
int pos;
|
||||||
|
char *s;
|
||||||
|
char *f;
|
||||||
|
|
||||||
|
len_f = strlen(find);
|
||||||
|
if (len_f>len)
|
||||||
|
return (-1);
|
||||||
|
pos = 0;
|
||||||
|
while (*(str+len_f-1))
|
||||||
|
{
|
||||||
|
s = str;
|
||||||
|
f = find;
|
||||||
|
while (*(f++) == *(s++))
|
||||||
|
if (!*f)
|
||||||
|
return (pos);
|
||||||
|
str ++;
|
||||||
|
pos ++;
|
||||||
|
}
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_int_str_str_cote(char *str,char *find,int len)
|
||||||
|
{
|
||||||
|
int len_f;
|
||||||
|
int pos;
|
||||||
|
char *s;
|
||||||
|
char *f;
|
||||||
|
int cote;
|
||||||
|
|
||||||
|
len_f = strlen(find);
|
||||||
|
if (len_f>len)
|
||||||
|
return (-1);
|
||||||
|
cote = 0;
|
||||||
|
pos = 0;
|
||||||
|
while (*(str+len_f-1))
|
||||||
|
{
|
||||||
|
if (*str=='"')
|
||||||
|
cote = 1-cote;
|
||||||
|
if (!cote)
|
||||||
|
{
|
||||||
|
s = str;
|
||||||
|
f = find;
|
||||||
|
while (*(f++) == *(s++))
|
||||||
|
if (!*f)
|
||||||
|
return (pos);
|
||||||
|
}
|
||||||
|
str ++;
|
||||||
|
pos ++;
|
||||||
|
}
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char **mlx_int_str_to_wordtab(char *str)
|
||||||
|
{
|
||||||
|
char **tab;
|
||||||
|
int pos;
|
||||||
|
int nb_word;
|
||||||
|
int len;
|
||||||
|
|
||||||
|
len = strlen(str);
|
||||||
|
nb_word = 0;
|
||||||
|
pos = 0;
|
||||||
|
while (pos<len)
|
||||||
|
{
|
||||||
|
while (*(str+pos)==' ' || *(str+pos)=='\t')
|
||||||
|
pos ++;
|
||||||
|
if (*(str+pos))
|
||||||
|
nb_word ++;
|
||||||
|
while (*(str+pos) && *(str+pos)!=' ' && *(str+pos)!='\t')
|
||||||
|
pos ++;
|
||||||
|
}
|
||||||
|
if (!(tab = malloc((1+nb_word)*sizeof(*tab))))
|
||||||
|
return ((char **)0);
|
||||||
|
nb_word = 0;
|
||||||
|
pos = 0;
|
||||||
|
while (pos<len)
|
||||||
|
{
|
||||||
|
while (*(str+pos)==' ' || *(str+pos)=='\t')
|
||||||
|
{
|
||||||
|
*(str+pos) = 0;
|
||||||
|
pos ++;
|
||||||
|
}
|
||||||
|
if (*(str+pos))
|
||||||
|
{
|
||||||
|
tab[nb_word] = str+pos;
|
||||||
|
nb_word ++;
|
||||||
|
}
|
||||||
|
while (*(str+pos) && *(str+pos)!=' ' && *(str+pos)!='\t')
|
||||||
|
pos ++;
|
||||||
|
}
|
||||||
|
tab[nb_word] = 0;
|
||||||
|
return (tab);
|
||||||
|
}
|
||||||
23
mlx/mlx_int_wait_first_expose.c
Normal file
23
mlx/mlx_int_wait_first_expose.c
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
** mlx_int_wait_first_expose.c for minilibx in
|
||||||
|
**
|
||||||
|
** Made by olivier crouzet
|
||||||
|
** Login <ol@epita.fr>
|
||||||
|
**
|
||||||
|
** Started on Tue Oct 17 09:26:45 2000 olivier crouzet
|
||||||
|
** Last update Fri Feb 23 17:27:10 2001 Charlie Root
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_int_wait_first_expose(t_xvar *xvar,Window win)
|
||||||
|
{
|
||||||
|
XEvent ev;
|
||||||
|
|
||||||
|
XWindowEvent(xvar->display,win,ExposureMask,&ev);
|
||||||
|
XPutBackEvent(xvar->display,&ev);
|
||||||
|
}
|
||||||
22
mlx/mlx_key_hook.c
Normal file
22
mlx/mlx_key_hook.c
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
** mlx_key_hook.c for MiniLibX in
|
||||||
|
**
|
||||||
|
** Made by Charlie Root
|
||||||
|
** Login <ol@epitech.net>
|
||||||
|
**
|
||||||
|
** Started on Thu Aug 3 11:49:06 2000 Charlie Root
|
||||||
|
** Last update Fri Feb 23 17:10:09 2001 Charlie Root
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_key_hook(t_win_list *win,int (*funct)(),void *param)
|
||||||
|
{
|
||||||
|
win->hooks[KeyRelease].hook = funct;
|
||||||
|
win->hooks[KeyRelease].param = param;
|
||||||
|
win->hooks[KeyRelease].mask = KeyReleaseMask;
|
||||||
|
}
|
||||||
96
mlx/mlx_lib_xpm.c
Normal file
96
mlx/mlx_lib_xpm.c
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
/*
|
||||||
|
** mlx_xpm.c for minilibX in
|
||||||
|
**
|
||||||
|
** Made by Charlie Root
|
||||||
|
** Login <ol@epitech.net>
|
||||||
|
**
|
||||||
|
** Started on Fri Dec 8 11:07:24 2000 Charlie Root
|
||||||
|
** Last update Thu Oct 4 16:00:22 2001 Charlie Root
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void *mlx_int_xpm_f_image(t_xvar *xvar,int *width,int *height,
|
||||||
|
int (*xpm_func)(),void *param)
|
||||||
|
{
|
||||||
|
XImage *img1;
|
||||||
|
XImage *img2;
|
||||||
|
t_img *im2;
|
||||||
|
XpmAttributes xpm_att;
|
||||||
|
|
||||||
|
xpm_att.visual = xvar->visual;
|
||||||
|
xpm_att.colormap = xvar->cmap;
|
||||||
|
xpm_att.depth = xvar->depth;
|
||||||
|
xpm_att.bitmap_format = ZPixmap;
|
||||||
|
xpm_att.valuemask = XpmDepth|XpmBitmapFormat|XpmVisual|XpmColormap;
|
||||||
|
if (xpm_func(xvar->display,param,&img1,&img2,&xpm_att))
|
||||||
|
return ((void *)0);
|
||||||
|
if (img2)
|
||||||
|
XDestroyImage(img2);
|
||||||
|
|
||||||
|
if (!(im2 = (void *)mlx_new_image(xvar,img1->width,img1->height)))
|
||||||
|
{
|
||||||
|
XDestroyImage(img1);
|
||||||
|
return ((void *)0);
|
||||||
|
}
|
||||||
|
*width = img1->width;
|
||||||
|
*height = img1->height;
|
||||||
|
if (mlx_int_egal_img(im2->image,img1))
|
||||||
|
{
|
||||||
|
bcopy(img1->data,im2->data,img1->height*img1->bytes_per_line);
|
||||||
|
XDestroyImage(img1);
|
||||||
|
return (im2);
|
||||||
|
}
|
||||||
|
if (im2->type==MLX_TYPE_SHM_PIXMAP)
|
||||||
|
{
|
||||||
|
XFreePixmap(xvar->display,im2->pix);
|
||||||
|
im2->pix = XCreatePixmap(xvar->display,xvar->root,
|
||||||
|
*width,*height,xvar->depth);
|
||||||
|
}
|
||||||
|
if (im2->type>MLX_TYPE_XIMAGE)
|
||||||
|
{
|
||||||
|
XShmDetach(xvar->display,&(im2->shm));
|
||||||
|
shmdt(im2->data);
|
||||||
|
}
|
||||||
|
XDestroyImage(im2->image);
|
||||||
|
im2->image = img1;
|
||||||
|
im2->data = img1->data;
|
||||||
|
im2->type = MLX_TYPE_XIMAGE;
|
||||||
|
im2->size_line = img1->bytes_per_line;
|
||||||
|
im2->bpp = img1->bits_per_pixel;
|
||||||
|
return (im2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_int_egal_img(XImage *img1,XImage *img2)
|
||||||
|
{
|
||||||
|
if (img1->width!=img2->width || img1->height!=img2->height ||
|
||||||
|
img1->xoffset!=img2->xoffset || img1->format!=img2->format ||
|
||||||
|
img1->byte_order!=img2->byte_order ||
|
||||||
|
img1->bitmap_unit!=img2->bitmap_unit ||
|
||||||
|
img1->bitmap_bit_order!=img2->bitmap_bit_order ||
|
||||||
|
img1->bitmap_pad!=img2->bitmap_pad || img1->depth!=img2->depth ||
|
||||||
|
img1->bytes_per_line!=img2->bytes_per_line ||
|
||||||
|
img1->bits_per_pixel!=img2->bits_per_pixel ||
|
||||||
|
img1->red_mask!=img2->red_mask || img1->green_mask!=img2->green_mask ||
|
||||||
|
img1->blue_mask!=img2->blue_mask )
|
||||||
|
return (0);
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void *mlx_xpm_file_to_image(t_xvar *xvar,char *filename,
|
||||||
|
int *width,int *height)
|
||||||
|
{
|
||||||
|
return (mlx_int_xpm_f_image(xvar,width,height,XpmReadFileToImage,filename));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void *mlx_xpm_to_image(t_xvar *xvar,char **data,int *width,int *height)
|
||||||
|
{
|
||||||
|
return (mlx_int_xpm_f_image(xvar,width,height,XpmCreateImageFromData,(void *)data));
|
||||||
|
}
|
||||||
62
mlx/mlx_loop.c
Normal file
62
mlx/mlx_loop.c
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
** mlx_loop.c for MiniLibX in
|
||||||
|
**
|
||||||
|
** Made by Charlie Root
|
||||||
|
** Login <ol@epitech.net>
|
||||||
|
**
|
||||||
|
** Started on Wed Aug 2 18:58:11 2000 Charlie Root
|
||||||
|
** Last update Fri Sep 30 14:47:41 2005 Olivier Crouzet
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
extern int (*(mlx_int_param_event[]))();
|
||||||
|
|
||||||
|
static int win_count(t_xvar *xvar)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
t_win_list *win;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
win = xvar->win_list;
|
||||||
|
while (win)
|
||||||
|
{
|
||||||
|
win = win->next;
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
return (i);
|
||||||
|
}
|
||||||
|
|
||||||
|
int mlx_loop_end(t_xvar *xvar)
|
||||||
|
{
|
||||||
|
xvar->end_loop = 1;
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int mlx_loop(t_xvar *xvar)
|
||||||
|
{
|
||||||
|
XEvent ev;
|
||||||
|
t_win_list *win;
|
||||||
|
|
||||||
|
mlx_int_set_win_event_mask(xvar);
|
||||||
|
xvar->do_flush = 0;
|
||||||
|
while (win_count(xvar) && !xvar->end_loop)
|
||||||
|
{
|
||||||
|
while (!xvar->end_loop && (!xvar->loop_hook || XPending(xvar->display)))
|
||||||
|
{
|
||||||
|
XNextEvent(xvar->display,&ev);
|
||||||
|
win = xvar->win_list;
|
||||||
|
while (win && (win->window!=ev.xany.window))
|
||||||
|
win = win->next;
|
||||||
|
|
||||||
|
if (win && ev.type == ClientMessage && ev.xclient.message_type == xvar->wm_protocols && ev.xclient.data.l[0] == xvar->wm_delete_window && win->hooks[DestroyNotify].hook)
|
||||||
|
win->hooks[DestroyNotify].hook(win->hooks[DestroyNotify].param);
|
||||||
|
if (win && ev.type < MLX_MAX_EVENT && win->hooks[ev.type].hook)
|
||||||
|
mlx_int_param_event[ev.type](xvar, &ev, win);
|
||||||
|
}
|
||||||
|
XSync(xvar->display, False);
|
||||||
|
xvar->loop_hook(xvar->loop_param);
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
21
mlx/mlx_loop_hook.c
Normal file
21
mlx/mlx_loop_hook.c
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
** mlx_loop_hook.c for MiniLibX in
|
||||||
|
**
|
||||||
|
** Made by Charlie Root
|
||||||
|
** Login <ol@epitech.net>
|
||||||
|
**
|
||||||
|
** Started on Thu Aug 3 11:49:06 2000 Charlie Root
|
||||||
|
** Last update Fri Feb 23 17:11:39 2001 Charlie Root
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_loop_hook(t_xvar *xvar,int (*funct)(),void *param)
|
||||||
|
{
|
||||||
|
xvar->loop_hook = funct;
|
||||||
|
xvar->loop_param = param;
|
||||||
|
}
|
||||||
48
mlx/mlx_mouse.c
Normal file
48
mlx/mlx_mouse.c
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
int mlx_mouse_move(t_xvar *xvar, t_win_list *win, int x, int y)
|
||||||
|
{
|
||||||
|
XWarpPointer(xvar->display, None, win->window, 0, 0, 0, 0, x, y);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int mlx_mouse_hide(t_xvar *xvar, t_win_list *win)
|
||||||
|
{
|
||||||
|
static char data[1] = {0};
|
||||||
|
Cursor cursor;
|
||||||
|
Pixmap blank;
|
||||||
|
XColor dummy;
|
||||||
|
|
||||||
|
blank = XCreateBitmapFromData(xvar->display, win->window, data, 1, 1);
|
||||||
|
cursor = XCreatePixmapCursor(xvar->display, blank, blank, &dummy, &dummy, 0, 0);
|
||||||
|
XDefineCursor(xvar->display, win->window, cursor);
|
||||||
|
XFreePixmap(xvar->display, blank);
|
||||||
|
XFreeCursor(xvar->display, cursor);
|
||||||
|
}
|
||||||
|
|
||||||
|
int mlx_mouse_show(t_xvar *xvar, t_win_list *win)
|
||||||
|
{
|
||||||
|
XUndefineCursor(xvar->display, win->window);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Queries the position of the mouse pointer relative to the origin of the
|
||||||
|
** specified window and saves it to the provided location.
|
||||||
|
**
|
||||||
|
** If the pointer is not on the same screen as the specified window, both
|
||||||
|
** win_x_return and win_y_return are set to zero and the function returns 0.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int mlx_mouse_get_pos(t_xvar *xvar, t_win_list *win, \
|
||||||
|
int *win_x_return, int *win_y_return)
|
||||||
|
{
|
||||||
|
Window root_return;
|
||||||
|
Window child_return;
|
||||||
|
int root_x_return;
|
||||||
|
int root_y_return;
|
||||||
|
unsigned mask_return;
|
||||||
|
|
||||||
|
return (XQueryPointer(xvar->display, win->window, \
|
||||||
|
&root_return, &child_return, &root_x_return, &root_y_return, \
|
||||||
|
win_x_return, win_y_return, &mask_return));
|
||||||
|
}
|
||||||
22
mlx/mlx_mouse_hook.c
Normal file
22
mlx/mlx_mouse_hook.c
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
** mlx_mouse_hook.c for MiniLibX in
|
||||||
|
**
|
||||||
|
** Made by Charlie Root
|
||||||
|
** Login <ol@epitech.net>
|
||||||
|
**
|
||||||
|
** Started on Thu Aug 3 11:49:06 2000 Charlie Root
|
||||||
|
** Last update Fri Feb 23 17:11:05 2001 Charlie Root
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_mouse_hook(t_win_list *win,int (*funct)(),void *param)
|
||||||
|
{
|
||||||
|
win->hooks[ButtonPress].hook = funct;
|
||||||
|
win->hooks[ButtonPress].param = param;
|
||||||
|
win->hooks[ButtonPress].mask = ButtonPressMask;
|
||||||
|
}
|
||||||
159
mlx/mlx_new_image.c
Normal file
159
mlx/mlx_new_image.c
Normal file
@@ -0,0 +1,159 @@
|
|||||||
|
/*
|
||||||
|
** mlx_new_image.c for MiniLibX in raytraceur
|
||||||
|
**
|
||||||
|
** Made by Charlie Root
|
||||||
|
** Login <ol@epitech.net>
|
||||||
|
**
|
||||||
|
** Started on Mon Aug 14 15:29:14 2000 Charlie Root
|
||||||
|
** Last update Wed May 25 16:46:31 2011 Olivier Crouzet
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
** To handle X errors
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define X_ShmAttach 1
|
||||||
|
|
||||||
|
int mlx_X_error;
|
||||||
|
|
||||||
|
int shm_att_pb(Display *d,XErrorEvent *ev)
|
||||||
|
{
|
||||||
|
if (ev->request_code==146 && ev->minor_code==X_ShmAttach)
|
||||||
|
write(2,WARN_SHM_ATTACH,strlen(WARN_SHM_ATTACH));
|
||||||
|
mlx_X_error = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Data malloc : width+32 ( bitmap_pad=32 ), *4 = *32 / 8bit
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
void *mlx_int_new_xshm_image(t_xvar *xvar,int width,int height,int format)
|
||||||
|
{
|
||||||
|
t_img *img;
|
||||||
|
int (*save_handler)();
|
||||||
|
|
||||||
|
if (!(img = malloc(sizeof(*img))))
|
||||||
|
return ((void *)0);
|
||||||
|
bzero(img,sizeof(*img));
|
||||||
|
img->data = 0;
|
||||||
|
img->image = XShmCreateImage(xvar->display,xvar->visual,xvar->depth,
|
||||||
|
format,img->data,&(img->shm),width,height);
|
||||||
|
if (!img->image)
|
||||||
|
{
|
||||||
|
free(img);
|
||||||
|
return ((void *)0);
|
||||||
|
}
|
||||||
|
img->width = width;
|
||||||
|
img->height = height;
|
||||||
|
img->size_line = img->image->bytes_per_line;
|
||||||
|
img->bpp = img->image->bits_per_pixel;
|
||||||
|
img->format = format;
|
||||||
|
img->shm.shmid = shmget(IPC_PRIVATE,(width+32)*height*4,IPC_CREAT|0777);
|
||||||
|
if (img->shm.shmid==-1)
|
||||||
|
{
|
||||||
|
XDestroyImage(img->image);
|
||||||
|
free(img);
|
||||||
|
return ((void *)0);
|
||||||
|
}
|
||||||
|
img->data = img->shm.shmaddr = img->image->data = shmat(img->shm.shmid,0,0);
|
||||||
|
if (img->data==(void *)-1)
|
||||||
|
{
|
||||||
|
shmctl(img->shm.shmid,IPC_RMID,0);
|
||||||
|
XDestroyImage(img->image);
|
||||||
|
free(img);
|
||||||
|
return ((void *)0);
|
||||||
|
}
|
||||||
|
img->shm.readOnly = False;
|
||||||
|
mlx_X_error = 0;
|
||||||
|
save_handler = XSetErrorHandler(shm_att_pb);
|
||||||
|
if (!XShmAttach(xvar->display,&(img->shm)) ||
|
||||||
|
0&XSync(xvar->display,False) || mlx_X_error)
|
||||||
|
{
|
||||||
|
XSetErrorHandler(save_handler);
|
||||||
|
shmdt(img->data);
|
||||||
|
shmctl(img->shm.shmid,IPC_RMID,0);
|
||||||
|
XDestroyImage(img->image);
|
||||||
|
free(img);
|
||||||
|
return ((void *)0);
|
||||||
|
}
|
||||||
|
XSetErrorHandler(save_handler);
|
||||||
|
shmctl(img->shm.shmid,IPC_RMID,0);
|
||||||
|
if (xvar->pshm_format==format)
|
||||||
|
{
|
||||||
|
img->pix = XShmCreatePixmap(xvar->display,xvar->root,img->shm.shmaddr,
|
||||||
|
&(img->shm),width,height,xvar->depth);
|
||||||
|
img->type = MLX_TYPE_SHM_PIXMAP;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
img->pix = XCreatePixmap(xvar->display,xvar->root,
|
||||||
|
width,height,xvar->depth);
|
||||||
|
img->type = MLX_TYPE_SHM;
|
||||||
|
}
|
||||||
|
if (xvar->do_flush)
|
||||||
|
XFlush(xvar->display);
|
||||||
|
return (img);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void *mlx_int_new_image(t_xvar *xvar,int width, int height,int format)
|
||||||
|
{
|
||||||
|
t_img *img;
|
||||||
|
|
||||||
|
if (!(img = malloc(sizeof(*img))))
|
||||||
|
return ((void *)0);
|
||||||
|
if (!(img->data = malloc((width+32)*height*4)))
|
||||||
|
{
|
||||||
|
free(img);
|
||||||
|
return ((void *)0);
|
||||||
|
}
|
||||||
|
bzero(img->data,(width+32)*height*4);
|
||||||
|
img->image = XCreateImage(xvar->display,xvar->visual,xvar->depth,format,0,
|
||||||
|
img->data,width,height,32,0);
|
||||||
|
if (!img->image)
|
||||||
|
{
|
||||||
|
free(img->data);
|
||||||
|
free(img);
|
||||||
|
return ((void *)0);
|
||||||
|
}
|
||||||
|
img->gc = 0;
|
||||||
|
img->size_line = img->image->bytes_per_line;
|
||||||
|
img->bpp = img->image->bits_per_pixel;
|
||||||
|
img->width = width;
|
||||||
|
img->height = height;
|
||||||
|
img->pix = XCreatePixmap(xvar->display,xvar->root,width,height,xvar->depth);
|
||||||
|
img->format = format;
|
||||||
|
img->type = MLX_TYPE_XIMAGE;
|
||||||
|
if (xvar->do_flush)
|
||||||
|
XFlush(xvar->display);
|
||||||
|
return (img);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void *mlx_new_image(t_xvar *xvar,int width, int height)
|
||||||
|
{
|
||||||
|
t_img *img;
|
||||||
|
|
||||||
|
if (xvar->use_xshm)
|
||||||
|
if (img = mlx_int_new_xshm_image(xvar,width,height,ZPixmap))
|
||||||
|
return (img);
|
||||||
|
return (mlx_int_new_image(xvar,width,height,ZPixmap));
|
||||||
|
}
|
||||||
|
|
||||||
|
void *mlx_new_image2(t_xvar *xvar,int width, int height)
|
||||||
|
{
|
||||||
|
t_img *img;
|
||||||
|
|
||||||
|
if (xvar->use_xshm)
|
||||||
|
if (img = mlx_int_new_xshm_image(xvar,width,height,XYPixmap))
|
||||||
|
return (img);
|
||||||
|
return (mlx_int_new_image(xvar,width,height,XYPixmap));
|
||||||
|
}
|
||||||
62
mlx/mlx_new_window.c
Normal file
62
mlx/mlx_new_window.c
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
** mlx_new_window.c for MiniLibX in
|
||||||
|
**
|
||||||
|
** Made by Charlie Root
|
||||||
|
** Login <ol@epitech.net>
|
||||||
|
**
|
||||||
|
** Started on Mon Jul 31 17:29:02 2000 Charlie Root
|
||||||
|
** Last update Thu Oct 4 15:44:43 2001 Charlie Root
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
** We do not use White/BlackPixel macro, TrueColor Visual make sure
|
||||||
|
** 0 is black & -1 is white
|
||||||
|
**
|
||||||
|
** With mlx_int_wait_first_expose, no flush is needed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
|
||||||
|
void *mlx_new_window(t_xvar *xvar,int size_x,int size_y,char *title)
|
||||||
|
{
|
||||||
|
t_win_list *new_win;
|
||||||
|
XSetWindowAttributes xswa;
|
||||||
|
XGCValues xgcv;
|
||||||
|
|
||||||
|
xswa.background_pixel = 0;
|
||||||
|
xswa.border_pixel = -1;
|
||||||
|
xswa.colormap = xvar->cmap;
|
||||||
|
/*
|
||||||
|
xswa.event_mask = ButtonPressMask | ButtonReleaseMask | ExposureMask |
|
||||||
|
KeyPressMask | KeyReleaseMask | StructureNotifyMask;
|
||||||
|
*/
|
||||||
|
/* xswa.event_mask = ExposureMask; */
|
||||||
|
xswa.event_mask = 0xFFFFFF; /* all events */
|
||||||
|
if (!(new_win = malloc(sizeof(*new_win))))
|
||||||
|
return ((void *)0);
|
||||||
|
new_win->window = XCreateWindow(xvar->display,xvar->root,0,0,size_x,size_y,
|
||||||
|
0,CopyFromParent,InputOutput,xvar->visual,
|
||||||
|
CWEventMask|CWBackPixel|CWBorderPixel|
|
||||||
|
CWColormap,&xswa);
|
||||||
|
mlx_int_anti_resize_win(xvar,new_win->window,size_x,size_y);
|
||||||
|
XStoreName(xvar->display,new_win->window,title);
|
||||||
|
XSetWMProtocols(xvar->display, new_win->window, &(xvar->wm_delete_window), 1);
|
||||||
|
xgcv.foreground = -1;
|
||||||
|
xgcv.function = GXcopy;
|
||||||
|
xgcv.plane_mask = AllPlanes;
|
||||||
|
new_win->gc = XCreateGC(xvar->display,new_win->window,
|
||||||
|
GCFunction|GCPlaneMask|GCForeground,&xgcv);
|
||||||
|
new_win->next = xvar->win_list;
|
||||||
|
xvar->win_list = new_win;
|
||||||
|
/*
|
||||||
|
new_win->mouse_hook = mlx_int_do_nothing;
|
||||||
|
new_win->key_hook = mlx_int_do_nothing;
|
||||||
|
new_win->expose_hook = mlx_int_do_nothing;
|
||||||
|
*/
|
||||||
|
bzero(&(new_win->hooks), sizeof(new_win->hooks));
|
||||||
|
XMapRaised(xvar->display,new_win->window);
|
||||||
|
mlx_int_wait_first_expose(xvar,new_win->window);
|
||||||
|
return (new_win);
|
||||||
|
}
|
||||||
26
mlx/mlx_pixel_put.c
Normal file
26
mlx/mlx_pixel_put.c
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
** mlx_pixel_put.c for MiniLibX in
|
||||||
|
**
|
||||||
|
** Made by Charlie Root
|
||||||
|
** Login <ol@epitech.net>
|
||||||
|
**
|
||||||
|
** Started on Mon Jul 31 19:01:33 2000 Charlie Root
|
||||||
|
** Last update Tue Sep 25 17:09:49 2001 Charlie Root
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_pixel_put(t_xvar *xvar,t_win_list *win,
|
||||||
|
int x,int y,int color)
|
||||||
|
{
|
||||||
|
XGCValues xgcv;
|
||||||
|
|
||||||
|
xgcv.foreground = mlx_int_get_good_color(xvar,color);
|
||||||
|
XChangeGC(xvar->display,win->gc,GCForeground,&xgcv);
|
||||||
|
XDrawPoint(xvar->display,win->window,win->gc,x,y);
|
||||||
|
if (xvar->do_flush)
|
||||||
|
XFlush(xvar->display);
|
||||||
|
}
|
||||||
37
mlx/mlx_put_image_to_window.c
Normal file
37
mlx/mlx_put_image_to_window.c
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
** mlx_put_image_to_window.c for MiniLibX in raytraceur
|
||||||
|
**
|
||||||
|
** Made by Charlie Root
|
||||||
|
** Login <ol@epitech.net>
|
||||||
|
**
|
||||||
|
** Started on Mon Aug 14 15:55:49 2000 Charlie Root
|
||||||
|
** Last update Sun Oct 2 09:53:00 2005 Olivier Crouzet
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_put_image_to_window(t_xvar *xvar,t_win_list *win,t_img *img,
|
||||||
|
int x,int y)
|
||||||
|
{
|
||||||
|
GC gc;
|
||||||
|
|
||||||
|
gc = win->gc;
|
||||||
|
if (img->gc)
|
||||||
|
{
|
||||||
|
gc = img->gc;
|
||||||
|
XSetClipOrigin(xvar->display, gc, x, y);
|
||||||
|
}
|
||||||
|
if (img->type==MLX_TYPE_SHM)
|
||||||
|
XShmPutImage(xvar->display,img->pix, win->gc, img->image,0,0,0,0,
|
||||||
|
img->width,img->height,False);
|
||||||
|
if (img->type==MLX_TYPE_XIMAGE)
|
||||||
|
XPutImage(xvar->display,img->pix, win->gc, img->image,0,0,0,0,
|
||||||
|
img->width,img->height);
|
||||||
|
XCopyArea(xvar->display,img->pix,win->window, gc,
|
||||||
|
0,0,img->width,img->height,x,y);
|
||||||
|
if (xvar->do_flush)
|
||||||
|
XFlush(xvar->display);
|
||||||
|
}
|
||||||
764
mlx/mlx_rgb.c
Normal file
764
mlx/mlx_rgb.c
Normal file
@@ -0,0 +1,764 @@
|
|||||||
|
/*
|
||||||
|
** This is a generated file with rgb2c.pl and rgb.txt from
|
||||||
|
** the XFree86 distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
struct s_col_name mlx_col_name[] =
|
||||||
|
{
|
||||||
|
{ "snow" , 0xfffafa },
|
||||||
|
{ "ghost white" , 0xf8f8ff },
|
||||||
|
{ "ghostwhite" , 0xf8f8ff },
|
||||||
|
{ "white smoke" , 0xf5f5f5 },
|
||||||
|
{ "whitesmoke" , 0xf5f5f5 },
|
||||||
|
{ "gainsboro" , 0xdcdcdc },
|
||||||
|
{ "floral white" , 0xfffaf0 },
|
||||||
|
{ "floralwhite" , 0xfffaf0 },
|
||||||
|
{ "old lace" , 0xfdf5e6 },
|
||||||
|
{ "oldlace" , 0xfdf5e6 },
|
||||||
|
{ "linen" , 0xfaf0e6 },
|
||||||
|
{ "antique white" , 0xfaebd7 },
|
||||||
|
{ "antiquewhite" , 0xfaebd7 },
|
||||||
|
{ "papaya whip" , 0xffefd5 },
|
||||||
|
{ "papayawhip" , 0xffefd5 },
|
||||||
|
{ "blanched almond" , 0xffebcd },
|
||||||
|
{ "blanchedalmond" , 0xffebcd },
|
||||||
|
{ "bisque" , 0xffe4c4 },
|
||||||
|
{ "peach puff" , 0xffdab9 },
|
||||||
|
{ "peachpuff" , 0xffdab9 },
|
||||||
|
{ "navajo white" , 0xffdead },
|
||||||
|
{ "navajowhite" , 0xffdead },
|
||||||
|
{ "moccasin" , 0xffe4b5 },
|
||||||
|
{ "cornsilk" , 0xfff8dc },
|
||||||
|
{ "ivory" , 0xfffff0 },
|
||||||
|
{ "lemon chiffon" , 0xfffacd },
|
||||||
|
{ "lemonchiffon" , 0xfffacd },
|
||||||
|
{ "seashell" , 0xfff5ee },
|
||||||
|
{ "honeydew" , 0xf0fff0 },
|
||||||
|
{ "mint cream" , 0xf5fffa },
|
||||||
|
{ "mintcream" , 0xf5fffa },
|
||||||
|
{ "azure" , 0xf0ffff },
|
||||||
|
{ "alice blue" , 0xf0f8ff },
|
||||||
|
{ "aliceblue" , 0xf0f8ff },
|
||||||
|
{ "lavender" , 0xe6e6fa },
|
||||||
|
{ "lavender blush" , 0xfff0f5 },
|
||||||
|
{ "lavenderblush" , 0xfff0f5 },
|
||||||
|
{ "misty rose" , 0xffe4e1 },
|
||||||
|
{ "mistyrose" , 0xffe4e1 },
|
||||||
|
{ "white" , 0xffffff },
|
||||||
|
{ "black" , 0x0 },
|
||||||
|
{ "dark slate" , 0x2f4f4f },
|
||||||
|
{ "darkslategray" , 0x2f4f4f },
|
||||||
|
{ "dark slate" , 0x2f4f4f },
|
||||||
|
{ "darkslategrey" , 0x2f4f4f },
|
||||||
|
{ "dim gray" , 0x696969 },
|
||||||
|
{ "dimgray" , 0x696969 },
|
||||||
|
{ "dim grey" , 0x696969 },
|
||||||
|
{ "dimgrey" , 0x696969 },
|
||||||
|
{ "slate gray" , 0x708090 },
|
||||||
|
{ "slategray" , 0x708090 },
|
||||||
|
{ "slate grey" , 0x708090 },
|
||||||
|
{ "slategrey" , 0x708090 },
|
||||||
|
{ "light slate" , 0x778899 },
|
||||||
|
{ "lightslategray" , 0x778899 },
|
||||||
|
{ "light slate" , 0x778899 },
|
||||||
|
{ "lightslategrey" , 0x778899 },
|
||||||
|
{ "gray" , 0xbebebe },
|
||||||
|
{ "grey" , 0xbebebe },
|
||||||
|
{ "light grey" , 0xd3d3d3 },
|
||||||
|
{ "lightgrey" , 0xd3d3d3 },
|
||||||
|
{ "light gray" , 0xd3d3d3 },
|
||||||
|
{ "lightgray" , 0xd3d3d3 },
|
||||||
|
{ "midnight blue" , 0x191970 },
|
||||||
|
{ "midnightblue" , 0x191970 },
|
||||||
|
{ "navy" , 0x80 },
|
||||||
|
{ "navy blue" , 0x80 },
|
||||||
|
{ "navyblue" , 0x80 },
|
||||||
|
{ "cornflower blue" , 0x6495ed },
|
||||||
|
{ "cornflowerblue" , 0x6495ed },
|
||||||
|
{ "dark slate" , 0x483d8b },
|
||||||
|
{ "darkslateblue" , 0x483d8b },
|
||||||
|
{ "slate blue" , 0x6a5acd },
|
||||||
|
{ "slateblue" , 0x6a5acd },
|
||||||
|
{ "medium slate" , 0x7b68ee },
|
||||||
|
{ "mediumslateblue" , 0x7b68ee },
|
||||||
|
{ "light slate" , 0x8470ff },
|
||||||
|
{ "lightslateblue" , 0x8470ff },
|
||||||
|
{ "medium blue" , 0xcd },
|
||||||
|
{ "mediumblue" , 0xcd },
|
||||||
|
{ "royal blue" , 0x4169e1 },
|
||||||
|
{ "royalblue" , 0x4169e1 },
|
||||||
|
{ "blue" , 0xff },
|
||||||
|
{ "dodger blue" , 0x1e90ff },
|
||||||
|
{ "dodgerblue" , 0x1e90ff },
|
||||||
|
{ "deep sky" , 0xbfff },
|
||||||
|
{ "deepskyblue" , 0xbfff },
|
||||||
|
{ "sky blue" , 0x87ceeb },
|
||||||
|
{ "skyblue" , 0x87ceeb },
|
||||||
|
{ "light sky" , 0x87cefa },
|
||||||
|
{ "lightskyblue" , 0x87cefa },
|
||||||
|
{ "steel blue" , 0x4682b4 },
|
||||||
|
{ "steelblue" , 0x4682b4 },
|
||||||
|
{ "light steel" , 0xb0c4de },
|
||||||
|
{ "lightsteelblue" , 0xb0c4de },
|
||||||
|
{ "light blue" , 0xadd8e6 },
|
||||||
|
{ "lightblue" , 0xadd8e6 },
|
||||||
|
{ "powder blue" , 0xb0e0e6 },
|
||||||
|
{ "powderblue" , 0xb0e0e6 },
|
||||||
|
{ "pale turquoise" , 0xafeeee },
|
||||||
|
{ "paleturquoise" , 0xafeeee },
|
||||||
|
{ "dark turquoise" , 0xced1 },
|
||||||
|
{ "darkturquoise" , 0xced1 },
|
||||||
|
{ "medium turquoise" , 0x48d1cc },
|
||||||
|
{ "mediumturquoise" , 0x48d1cc },
|
||||||
|
{ "turquoise" , 0x40e0d0 },
|
||||||
|
{ "cyan" , 0xffff },
|
||||||
|
{ "light cyan" , 0xe0ffff },
|
||||||
|
{ "lightcyan" , 0xe0ffff },
|
||||||
|
{ "cadet blue" , 0x5f9ea0 },
|
||||||
|
{ "cadetblue" , 0x5f9ea0 },
|
||||||
|
{ "medium aquamarine" , 0x66cdaa },
|
||||||
|
{ "mediumaquamarine" , 0x66cdaa },
|
||||||
|
{ "aquamarine" , 0x7fffd4 },
|
||||||
|
{ "dark green" , 0x6400 },
|
||||||
|
{ "darkgreen" , 0x6400 },
|
||||||
|
{ "dark olive" , 0x556b2f },
|
||||||
|
{ "darkolivegreen" , 0x556b2f },
|
||||||
|
{ "dark sea" , 0x8fbc8f },
|
||||||
|
{ "darkseagreen" , 0x8fbc8f },
|
||||||
|
{ "sea green" , 0x2e8b57 },
|
||||||
|
{ "seagreen" , 0x2e8b57 },
|
||||||
|
{ "medium sea" , 0x3cb371 },
|
||||||
|
{ "mediumseagreen" , 0x3cb371 },
|
||||||
|
{ "light sea" , 0x20b2aa },
|
||||||
|
{ "lightseagreen" , 0x20b2aa },
|
||||||
|
{ "pale green" , 0x98fb98 },
|
||||||
|
{ "palegreen" , 0x98fb98 },
|
||||||
|
{ "spring green" , 0xff7f },
|
||||||
|
{ "springgreen" , 0xff7f },
|
||||||
|
{ "lawn green" , 0x7cfc00 },
|
||||||
|
{ "lawngreen" , 0x7cfc00 },
|
||||||
|
{ "green" , 0xff00 },
|
||||||
|
{ "chartreuse" , 0x7fff00 },
|
||||||
|
{ "medium spring" , 0xfa9a },
|
||||||
|
{ "mediumspringgreen" , 0xfa9a },
|
||||||
|
{ "green yellow" , 0xadff2f },
|
||||||
|
{ "greenyellow" , 0xadff2f },
|
||||||
|
{ "lime green" , 0x32cd32 },
|
||||||
|
{ "limegreen" , 0x32cd32 },
|
||||||
|
{ "yellow green" , 0x9acd32 },
|
||||||
|
{ "yellowgreen" , 0x9acd32 },
|
||||||
|
{ "forest green" , 0x228b22 },
|
||||||
|
{ "forestgreen" , 0x228b22 },
|
||||||
|
{ "olive drab" , 0x6b8e23 },
|
||||||
|
{ "olivedrab" , 0x6b8e23 },
|
||||||
|
{ "dark khaki" , 0xbdb76b },
|
||||||
|
{ "darkkhaki" , 0xbdb76b },
|
||||||
|
{ "khaki" , 0xf0e68c },
|
||||||
|
{ "pale goldenrod" , 0xeee8aa },
|
||||||
|
{ "palegoldenrod" , 0xeee8aa },
|
||||||
|
{ "light goldenrod" , 0xfafad2 },
|
||||||
|
{ "lightgoldenrodyellow" , 0xfafad2 },
|
||||||
|
{ "light yellow" , 0xffffe0 },
|
||||||
|
{ "lightyellow" , 0xffffe0 },
|
||||||
|
{ "yellow" , 0xffff00 },
|
||||||
|
{ "gold" , 0xffd700 },
|
||||||
|
{ "light goldenrod" , 0xeedd82 },
|
||||||
|
{ "lightgoldenrod" , 0xeedd82 },
|
||||||
|
{ "goldenrod" , 0xdaa520 },
|
||||||
|
{ "dark goldenrod" , 0xb8860b },
|
||||||
|
{ "darkgoldenrod" , 0xb8860b },
|
||||||
|
{ "rosy brown" , 0xbc8f8f },
|
||||||
|
{ "rosybrown" , 0xbc8f8f },
|
||||||
|
{ "indian red" , 0xcd5c5c },
|
||||||
|
{ "indianred" , 0xcd5c5c },
|
||||||
|
{ "saddle brown" , 0x8b4513 },
|
||||||
|
{ "saddlebrown" , 0x8b4513 },
|
||||||
|
{ "sienna" , 0xa0522d },
|
||||||
|
{ "peru" , 0xcd853f },
|
||||||
|
{ "burlywood" , 0xdeb887 },
|
||||||
|
{ "beige" , 0xf5f5dc },
|
||||||
|
{ "wheat" , 0xf5deb3 },
|
||||||
|
{ "sandy brown" , 0xf4a460 },
|
||||||
|
{ "sandybrown" , 0xf4a460 },
|
||||||
|
{ "tan" , 0xd2b48c },
|
||||||
|
{ "chocolate" , 0xd2691e },
|
||||||
|
{ "firebrick" , 0xb22222 },
|
||||||
|
{ "brown" , 0xa52a2a },
|
||||||
|
{ "dark salmon" , 0xe9967a },
|
||||||
|
{ "darksalmon" , 0xe9967a },
|
||||||
|
{ "salmon" , 0xfa8072 },
|
||||||
|
{ "light salmon" , 0xffa07a },
|
||||||
|
{ "lightsalmon" , 0xffa07a },
|
||||||
|
{ "orange" , 0xffa500 },
|
||||||
|
{ "dark orange" , 0xff8c00 },
|
||||||
|
{ "darkorange" , 0xff8c00 },
|
||||||
|
{ "coral" , 0xff7f50 },
|
||||||
|
{ "light coral" , 0xf08080 },
|
||||||
|
{ "lightcoral" , 0xf08080 },
|
||||||
|
{ "tomato" , 0xff6347 },
|
||||||
|
{ "orange red" , 0xff4500 },
|
||||||
|
{ "orangered" , 0xff4500 },
|
||||||
|
{ "red" , 0xff0000 },
|
||||||
|
{ "hot pink" , 0xff69b4 },
|
||||||
|
{ "hotpink" , 0xff69b4 },
|
||||||
|
{ "deep pink" , 0xff1493 },
|
||||||
|
{ "deeppink" , 0xff1493 },
|
||||||
|
{ "pink" , 0xffc0cb },
|
||||||
|
{ "light pink" , 0xffb6c1 },
|
||||||
|
{ "lightpink" , 0xffb6c1 },
|
||||||
|
{ "pale violet" , 0xdb7093 },
|
||||||
|
{ "palevioletred" , 0xdb7093 },
|
||||||
|
{ "maroon" , 0xb03060 },
|
||||||
|
{ "medium violet" , 0xc71585 },
|
||||||
|
{ "mediumvioletred" , 0xc71585 },
|
||||||
|
{ "violet red" , 0xd02090 },
|
||||||
|
{ "violetred" , 0xd02090 },
|
||||||
|
{ "magenta" , 0xff00ff },
|
||||||
|
{ "violet" , 0xee82ee },
|
||||||
|
{ "plum" , 0xdda0dd },
|
||||||
|
{ "orchid" , 0xda70d6 },
|
||||||
|
{ "medium orchid" , 0xba55d3 },
|
||||||
|
{ "mediumorchid" , 0xba55d3 },
|
||||||
|
{ "dark orchid" , 0x9932cc },
|
||||||
|
{ "darkorchid" , 0x9932cc },
|
||||||
|
{ "dark violet" , 0x9400d3 },
|
||||||
|
{ "darkviolet" , 0x9400d3 },
|
||||||
|
{ "blue violet" , 0x8a2be2 },
|
||||||
|
{ "blueviolet" , 0x8a2be2 },
|
||||||
|
{ "purple" , 0xa020f0 },
|
||||||
|
{ "medium purple" , 0x9370db },
|
||||||
|
{ "mediumpurple" , 0x9370db },
|
||||||
|
{ "thistle" , 0xd8bfd8 },
|
||||||
|
{ "snow1" , 0xfffafa },
|
||||||
|
{ "snow2" , 0xeee9e9 },
|
||||||
|
{ "snow3" , 0xcdc9c9 },
|
||||||
|
{ "snow4" , 0x8b8989 },
|
||||||
|
{ "seashell1" , 0xfff5ee },
|
||||||
|
{ "seashell2" , 0xeee5de },
|
||||||
|
{ "seashell3" , 0xcdc5bf },
|
||||||
|
{ "seashell4" , 0x8b8682 },
|
||||||
|
{ "antiquewhite1" , 0xffefdb },
|
||||||
|
{ "antiquewhite2" , 0xeedfcc },
|
||||||
|
{ "antiquewhite3" , 0xcdc0b0 },
|
||||||
|
{ "antiquewhite4" , 0x8b8378 },
|
||||||
|
{ "bisque1" , 0xffe4c4 },
|
||||||
|
{ "bisque2" , 0xeed5b7 },
|
||||||
|
{ "bisque3" , 0xcdb79e },
|
||||||
|
{ "bisque4" , 0x8b7d6b },
|
||||||
|
{ "peachpuff1" , 0xffdab9 },
|
||||||
|
{ "peachpuff2" , 0xeecbad },
|
||||||
|
{ "peachpuff3" , 0xcdaf95 },
|
||||||
|
{ "peachpuff4" , 0x8b7765 },
|
||||||
|
{ "navajowhite1" , 0xffdead },
|
||||||
|
{ "navajowhite2" , 0xeecfa1 },
|
||||||
|
{ "navajowhite3" , 0xcdb38b },
|
||||||
|
{ "navajowhite4" , 0x8b795e },
|
||||||
|
{ "lemonchiffon1" , 0xfffacd },
|
||||||
|
{ "lemonchiffon2" , 0xeee9bf },
|
||||||
|
{ "lemonchiffon3" , 0xcdc9a5 },
|
||||||
|
{ "lemonchiffon4" , 0x8b8970 },
|
||||||
|
{ "cornsilk1" , 0xfff8dc },
|
||||||
|
{ "cornsilk2" , 0xeee8cd },
|
||||||
|
{ "cornsilk3" , 0xcdc8b1 },
|
||||||
|
{ "cornsilk4" , 0x8b8878 },
|
||||||
|
{ "ivory1" , 0xfffff0 },
|
||||||
|
{ "ivory2" , 0xeeeee0 },
|
||||||
|
{ "ivory3" , 0xcdcdc1 },
|
||||||
|
{ "ivory4" , 0x8b8b83 },
|
||||||
|
{ "honeydew1" , 0xf0fff0 },
|
||||||
|
{ "honeydew2" , 0xe0eee0 },
|
||||||
|
{ "honeydew3" , 0xc1cdc1 },
|
||||||
|
{ "honeydew4" , 0x838b83 },
|
||||||
|
{ "lavenderblush1" , 0xfff0f5 },
|
||||||
|
{ "lavenderblush2" , 0xeee0e5 },
|
||||||
|
{ "lavenderblush3" , 0xcdc1c5 },
|
||||||
|
{ "lavenderblush4" , 0x8b8386 },
|
||||||
|
{ "mistyrose1" , 0xffe4e1 },
|
||||||
|
{ "mistyrose2" , 0xeed5d2 },
|
||||||
|
{ "mistyrose3" , 0xcdb7b5 },
|
||||||
|
{ "mistyrose4" , 0x8b7d7b },
|
||||||
|
{ "azure1" , 0xf0ffff },
|
||||||
|
{ "azure2" , 0xe0eeee },
|
||||||
|
{ "azure3" , 0xc1cdcd },
|
||||||
|
{ "azure4" , 0x838b8b },
|
||||||
|
{ "slateblue1" , 0x836fff },
|
||||||
|
{ "slateblue2" , 0x7a67ee },
|
||||||
|
{ "slateblue3" , 0x6959cd },
|
||||||
|
{ "slateblue4" , 0x473c8b },
|
||||||
|
{ "royalblue1" , 0x4876ff },
|
||||||
|
{ "royalblue2" , 0x436eee },
|
||||||
|
{ "royalblue3" , 0x3a5fcd },
|
||||||
|
{ "royalblue4" , 0x27408b },
|
||||||
|
{ "blue1" , 0xff },
|
||||||
|
{ "blue2" , 0xee },
|
||||||
|
{ "blue3" , 0xcd },
|
||||||
|
{ "blue4" , 0x8b },
|
||||||
|
{ "dodgerblue1" , 0x1e90ff },
|
||||||
|
{ "dodgerblue2" , 0x1c86ee },
|
||||||
|
{ "dodgerblue3" , 0x1874cd },
|
||||||
|
{ "dodgerblue4" , 0x104e8b },
|
||||||
|
{ "steelblue1" , 0x63b8ff },
|
||||||
|
{ "steelblue2" , 0x5cacee },
|
||||||
|
{ "steelblue3" , 0x4f94cd },
|
||||||
|
{ "steelblue4" , 0x36648b },
|
||||||
|
{ "deepskyblue1" , 0xbfff },
|
||||||
|
{ "deepskyblue2" , 0xb2ee },
|
||||||
|
{ "deepskyblue3" , 0x9acd },
|
||||||
|
{ "deepskyblue4" , 0x688b },
|
||||||
|
{ "skyblue1" , 0x87ceff },
|
||||||
|
{ "skyblue2" , 0x7ec0ee },
|
||||||
|
{ "skyblue3" , 0x6ca6cd },
|
||||||
|
{ "skyblue4" , 0x4a708b },
|
||||||
|
{ "lightskyblue1" , 0xb0e2ff },
|
||||||
|
{ "lightskyblue2" , 0xa4d3ee },
|
||||||
|
{ "lightskyblue3" , 0x8db6cd },
|
||||||
|
{ "lightskyblue4" , 0x607b8b },
|
||||||
|
{ "slategray1" , 0xc6e2ff },
|
||||||
|
{ "slategray2" , 0xb9d3ee },
|
||||||
|
{ "slategray3" , 0x9fb6cd },
|
||||||
|
{ "slategray4" , 0x6c7b8b },
|
||||||
|
{ "lightsteelblue1" , 0xcae1ff },
|
||||||
|
{ "lightsteelblue2" , 0xbcd2ee },
|
||||||
|
{ "lightsteelblue3" , 0xa2b5cd },
|
||||||
|
{ "lightsteelblue4" , 0x6e7b8b },
|
||||||
|
{ "lightblue1" , 0xbfefff },
|
||||||
|
{ "lightblue2" , 0xb2dfee },
|
||||||
|
{ "lightblue3" , 0x9ac0cd },
|
||||||
|
{ "lightblue4" , 0x68838b },
|
||||||
|
{ "lightcyan1" , 0xe0ffff },
|
||||||
|
{ "lightcyan2" , 0xd1eeee },
|
||||||
|
{ "lightcyan3" , 0xb4cdcd },
|
||||||
|
{ "lightcyan4" , 0x7a8b8b },
|
||||||
|
{ "paleturquoise1" , 0xbbffff },
|
||||||
|
{ "paleturquoise2" , 0xaeeeee },
|
||||||
|
{ "paleturquoise3" , 0x96cdcd },
|
||||||
|
{ "paleturquoise4" , 0x668b8b },
|
||||||
|
{ "cadetblue1" , 0x98f5ff },
|
||||||
|
{ "cadetblue2" , 0x8ee5ee },
|
||||||
|
{ "cadetblue3" , 0x7ac5cd },
|
||||||
|
{ "cadetblue4" , 0x53868b },
|
||||||
|
{ "turquoise1" , 0xf5ff },
|
||||||
|
{ "turquoise2" , 0xe5ee },
|
||||||
|
{ "turquoise3" , 0xc5cd },
|
||||||
|
{ "turquoise4" , 0x868b },
|
||||||
|
{ "cyan1" , 0xffff },
|
||||||
|
{ "cyan2" , 0xeeee },
|
||||||
|
{ "cyan3" , 0xcdcd },
|
||||||
|
{ "cyan4" , 0x8b8b },
|
||||||
|
{ "darkslategray1" , 0x97ffff },
|
||||||
|
{ "darkslategray2" , 0x8deeee },
|
||||||
|
{ "darkslategray3" , 0x79cdcd },
|
||||||
|
{ "darkslategray4" , 0x528b8b },
|
||||||
|
{ "aquamarine1" , 0x7fffd4 },
|
||||||
|
{ "aquamarine2" , 0x76eec6 },
|
||||||
|
{ "aquamarine3" , 0x66cdaa },
|
||||||
|
{ "aquamarine4" , 0x458b74 },
|
||||||
|
{ "darkseagreen1" , 0xc1ffc1 },
|
||||||
|
{ "darkseagreen2" , 0xb4eeb4 },
|
||||||
|
{ "darkseagreen3" , 0x9bcd9b },
|
||||||
|
{ "darkseagreen4" , 0x698b69 },
|
||||||
|
{ "seagreen1" , 0x54ff9f },
|
||||||
|
{ "seagreen2" , 0x4eee94 },
|
||||||
|
{ "seagreen3" , 0x43cd80 },
|
||||||
|
{ "seagreen4" , 0x2e8b57 },
|
||||||
|
{ "palegreen1" , 0x9aff9a },
|
||||||
|
{ "palegreen2" , 0x90ee90 },
|
||||||
|
{ "palegreen3" , 0x7ccd7c },
|
||||||
|
{ "palegreen4" , 0x548b54 },
|
||||||
|
{ "springgreen1" , 0xff7f },
|
||||||
|
{ "springgreen2" , 0xee76 },
|
||||||
|
{ "springgreen3" , 0xcd66 },
|
||||||
|
{ "springgreen4" , 0x8b45 },
|
||||||
|
{ "green1" , 0xff00 },
|
||||||
|
{ "green2" , 0xee00 },
|
||||||
|
{ "green3" , 0xcd00 },
|
||||||
|
{ "green4" , 0x8b00 },
|
||||||
|
{ "chartreuse1" , 0x7fff00 },
|
||||||
|
{ "chartreuse2" , 0x76ee00 },
|
||||||
|
{ "chartreuse3" , 0x66cd00 },
|
||||||
|
{ "chartreuse4" , 0x458b00 },
|
||||||
|
{ "olivedrab1" , 0xc0ff3e },
|
||||||
|
{ "olivedrab2" , 0xb3ee3a },
|
||||||
|
{ "olivedrab3" , 0x9acd32 },
|
||||||
|
{ "olivedrab4" , 0x698b22 },
|
||||||
|
{ "darkolivegreen1" , 0xcaff70 },
|
||||||
|
{ "darkolivegreen2" , 0xbcee68 },
|
||||||
|
{ "darkolivegreen3" , 0xa2cd5a },
|
||||||
|
{ "darkolivegreen4" , 0x6e8b3d },
|
||||||
|
{ "khaki1" , 0xfff68f },
|
||||||
|
{ "khaki2" , 0xeee685 },
|
||||||
|
{ "khaki3" , 0xcdc673 },
|
||||||
|
{ "khaki4" , 0x8b864e },
|
||||||
|
{ "lightgoldenrod1" , 0xffec8b },
|
||||||
|
{ "lightgoldenrod2" , 0xeedc82 },
|
||||||
|
{ "lightgoldenrod3" , 0xcdbe70 },
|
||||||
|
{ "lightgoldenrod4" , 0x8b814c },
|
||||||
|
{ "lightyellow1" , 0xffffe0 },
|
||||||
|
{ "lightyellow2" , 0xeeeed1 },
|
||||||
|
{ "lightyellow3" , 0xcdcdb4 },
|
||||||
|
{ "lightyellow4" , 0x8b8b7a },
|
||||||
|
{ "yellow1" , 0xffff00 },
|
||||||
|
{ "yellow2" , 0xeeee00 },
|
||||||
|
{ "yellow3" , 0xcdcd00 },
|
||||||
|
{ "yellow4" , 0x8b8b00 },
|
||||||
|
{ "gold1" , 0xffd700 },
|
||||||
|
{ "gold2" , 0xeec900 },
|
||||||
|
{ "gold3" , 0xcdad00 },
|
||||||
|
{ "gold4" , 0x8b7500 },
|
||||||
|
{ "goldenrod1" , 0xffc125 },
|
||||||
|
{ "goldenrod2" , 0xeeb422 },
|
||||||
|
{ "goldenrod3" , 0xcd9b1d },
|
||||||
|
{ "goldenrod4" , 0x8b6914 },
|
||||||
|
{ "darkgoldenrod1" , 0xffb90f },
|
||||||
|
{ "darkgoldenrod2" , 0xeead0e },
|
||||||
|
{ "darkgoldenrod3" , 0xcd950c },
|
||||||
|
{ "darkgoldenrod4" , 0x8b6508 },
|
||||||
|
{ "rosybrown1" , 0xffc1c1 },
|
||||||
|
{ "rosybrown2" , 0xeeb4b4 },
|
||||||
|
{ "rosybrown3" , 0xcd9b9b },
|
||||||
|
{ "rosybrown4" , 0x8b6969 },
|
||||||
|
{ "indianred1" , 0xff6a6a },
|
||||||
|
{ "indianred2" , 0xee6363 },
|
||||||
|
{ "indianred3" , 0xcd5555 },
|
||||||
|
{ "indianred4" , 0x8b3a3a },
|
||||||
|
{ "sienna1" , 0xff8247 },
|
||||||
|
{ "sienna2" , 0xee7942 },
|
||||||
|
{ "sienna3" , 0xcd6839 },
|
||||||
|
{ "sienna4" , 0x8b4726 },
|
||||||
|
{ "burlywood1" , 0xffd39b },
|
||||||
|
{ "burlywood2" , 0xeec591 },
|
||||||
|
{ "burlywood3" , 0xcdaa7d },
|
||||||
|
{ "burlywood4" , 0x8b7355 },
|
||||||
|
{ "wheat1" , 0xffe7ba },
|
||||||
|
{ "wheat2" , 0xeed8ae },
|
||||||
|
{ "wheat3" , 0xcdba96 },
|
||||||
|
{ "wheat4" , 0x8b7e66 },
|
||||||
|
{ "tan1" , 0xffa54f },
|
||||||
|
{ "tan2" , 0xee9a49 },
|
||||||
|
{ "tan3" , 0xcd853f },
|
||||||
|
{ "tan4" , 0x8b5a2b },
|
||||||
|
{ "chocolate1" , 0xff7f24 },
|
||||||
|
{ "chocolate2" , 0xee7621 },
|
||||||
|
{ "chocolate3" , 0xcd661d },
|
||||||
|
{ "chocolate4" , 0x8b4513 },
|
||||||
|
{ "firebrick1" , 0xff3030 },
|
||||||
|
{ "firebrick2" , 0xee2c2c },
|
||||||
|
{ "firebrick3" , 0xcd2626 },
|
||||||
|
{ "firebrick4" , 0x8b1a1a },
|
||||||
|
{ "brown1" , 0xff4040 },
|
||||||
|
{ "brown2" , 0xee3b3b },
|
||||||
|
{ "brown3" , 0xcd3333 },
|
||||||
|
{ "brown4" , 0x8b2323 },
|
||||||
|
{ "salmon1" , 0xff8c69 },
|
||||||
|
{ "salmon2" , 0xee8262 },
|
||||||
|
{ "salmon3" , 0xcd7054 },
|
||||||
|
{ "salmon4" , 0x8b4c39 },
|
||||||
|
{ "lightsalmon1" , 0xffa07a },
|
||||||
|
{ "lightsalmon2" , 0xee9572 },
|
||||||
|
{ "lightsalmon3" , 0xcd8162 },
|
||||||
|
{ "lightsalmon4" , 0x8b5742 },
|
||||||
|
{ "orange1" , 0xffa500 },
|
||||||
|
{ "orange2" , 0xee9a00 },
|
||||||
|
{ "orange3" , 0xcd8500 },
|
||||||
|
{ "orange4" , 0x8b5a00 },
|
||||||
|
{ "darkorange1" , 0xff7f00 },
|
||||||
|
{ "darkorange2" , 0xee7600 },
|
||||||
|
{ "darkorange3" , 0xcd6600 },
|
||||||
|
{ "darkorange4" , 0x8b4500 },
|
||||||
|
{ "coral1" , 0xff7256 },
|
||||||
|
{ "coral2" , 0xee6a50 },
|
||||||
|
{ "coral3" , 0xcd5b45 },
|
||||||
|
{ "coral4" , 0x8b3e2f },
|
||||||
|
{ "tomato1" , 0xff6347 },
|
||||||
|
{ "tomato2" , 0xee5c42 },
|
||||||
|
{ "tomato3" , 0xcd4f39 },
|
||||||
|
{ "tomato4" , 0x8b3626 },
|
||||||
|
{ "orangered1" , 0xff4500 },
|
||||||
|
{ "orangered2" , 0xee4000 },
|
||||||
|
{ "orangered3" , 0xcd3700 },
|
||||||
|
{ "orangered4" , 0x8b2500 },
|
||||||
|
{ "red1" , 0xff0000 },
|
||||||
|
{ "red2" , 0xee0000 },
|
||||||
|
{ "red3" , 0xcd0000 },
|
||||||
|
{ "red4" , 0x8b0000 },
|
||||||
|
{ "deeppink1" , 0xff1493 },
|
||||||
|
{ "deeppink2" , 0xee1289 },
|
||||||
|
{ "deeppink3" , 0xcd1076 },
|
||||||
|
{ "deeppink4" , 0x8b0a50 },
|
||||||
|
{ "hotpink1" , 0xff6eb4 },
|
||||||
|
{ "hotpink2" , 0xee6aa7 },
|
||||||
|
{ "hotpink3" , 0xcd6090 },
|
||||||
|
{ "hotpink4" , 0x8b3a62 },
|
||||||
|
{ "pink1" , 0xffb5c5 },
|
||||||
|
{ "pink2" , 0xeea9b8 },
|
||||||
|
{ "pink3" , 0xcd919e },
|
||||||
|
{ "pink4" , 0x8b636c },
|
||||||
|
{ "lightpink1" , 0xffaeb9 },
|
||||||
|
{ "lightpink2" , 0xeea2ad },
|
||||||
|
{ "lightpink3" , 0xcd8c95 },
|
||||||
|
{ "lightpink4" , 0x8b5f65 },
|
||||||
|
{ "palevioletred1" , 0xff82ab },
|
||||||
|
{ "palevioletred2" , 0xee799f },
|
||||||
|
{ "palevioletred3" , 0xcd6889 },
|
||||||
|
{ "palevioletred4" , 0x8b475d },
|
||||||
|
{ "maroon1" , 0xff34b3 },
|
||||||
|
{ "maroon2" , 0xee30a7 },
|
||||||
|
{ "maroon3" , 0xcd2990 },
|
||||||
|
{ "maroon4" , 0x8b1c62 },
|
||||||
|
{ "violetred1" , 0xff3e96 },
|
||||||
|
{ "violetred2" , 0xee3a8c },
|
||||||
|
{ "violetred3" , 0xcd3278 },
|
||||||
|
{ "violetred4" , 0x8b2252 },
|
||||||
|
{ "magenta1" , 0xff00ff },
|
||||||
|
{ "magenta2" , 0xee00ee },
|
||||||
|
{ "magenta3" , 0xcd00cd },
|
||||||
|
{ "magenta4" , 0x8b008b },
|
||||||
|
{ "orchid1" , 0xff83fa },
|
||||||
|
{ "orchid2" , 0xee7ae9 },
|
||||||
|
{ "orchid3" , 0xcd69c9 },
|
||||||
|
{ "orchid4" , 0x8b4789 },
|
||||||
|
{ "plum1" , 0xffbbff },
|
||||||
|
{ "plum2" , 0xeeaeee },
|
||||||
|
{ "plum3" , 0xcd96cd },
|
||||||
|
{ "plum4" , 0x8b668b },
|
||||||
|
{ "mediumorchid1" , 0xe066ff },
|
||||||
|
{ "mediumorchid2" , 0xd15fee },
|
||||||
|
{ "mediumorchid3" , 0xb452cd },
|
||||||
|
{ "mediumorchid4" , 0x7a378b },
|
||||||
|
{ "darkorchid1" , 0xbf3eff },
|
||||||
|
{ "darkorchid2" , 0xb23aee },
|
||||||
|
{ "darkorchid3" , 0x9a32cd },
|
||||||
|
{ "darkorchid4" , 0x68228b },
|
||||||
|
{ "purple1" , 0x9b30ff },
|
||||||
|
{ "purple2" , 0x912cee },
|
||||||
|
{ "purple3" , 0x7d26cd },
|
||||||
|
{ "purple4" , 0x551a8b },
|
||||||
|
{ "mediumpurple1" , 0xab82ff },
|
||||||
|
{ "mediumpurple2" , 0x9f79ee },
|
||||||
|
{ "mediumpurple3" , 0x8968cd },
|
||||||
|
{ "mediumpurple4" , 0x5d478b },
|
||||||
|
{ "thistle1" , 0xffe1ff },
|
||||||
|
{ "thistle2" , 0xeed2ee },
|
||||||
|
{ "thistle3" , 0xcdb5cd },
|
||||||
|
{ "thistle4" , 0x8b7b8b },
|
||||||
|
{ "gray0" , 0x0 },
|
||||||
|
{ "grey0" , 0x0 },
|
||||||
|
{ "gray1" , 0x30303 },
|
||||||
|
{ "grey1" , 0x30303 },
|
||||||
|
{ "gray2" , 0x50505 },
|
||||||
|
{ "grey2" , 0x50505 },
|
||||||
|
{ "gray3" , 0x80808 },
|
||||||
|
{ "grey3" , 0x80808 },
|
||||||
|
{ "gray4" , 0xa0a0a },
|
||||||
|
{ "grey4" , 0xa0a0a },
|
||||||
|
{ "gray5" , 0xd0d0d },
|
||||||
|
{ "grey5" , 0xd0d0d },
|
||||||
|
{ "gray6" , 0xf0f0f },
|
||||||
|
{ "grey6" , 0xf0f0f },
|
||||||
|
{ "gray7" , 0x121212 },
|
||||||
|
{ "grey7" , 0x121212 },
|
||||||
|
{ "gray8" , 0x141414 },
|
||||||
|
{ "grey8" , 0x141414 },
|
||||||
|
{ "gray9" , 0x171717 },
|
||||||
|
{ "grey9" , 0x171717 },
|
||||||
|
{ "gray10" , 0x1a1a1a },
|
||||||
|
{ "grey10" , 0x1a1a1a },
|
||||||
|
{ "gray11" , 0x1c1c1c },
|
||||||
|
{ "grey11" , 0x1c1c1c },
|
||||||
|
{ "gray12" , 0x1f1f1f },
|
||||||
|
{ "grey12" , 0x1f1f1f },
|
||||||
|
{ "gray13" , 0x212121 },
|
||||||
|
{ "grey13" , 0x212121 },
|
||||||
|
{ "gray14" , 0x242424 },
|
||||||
|
{ "grey14" , 0x242424 },
|
||||||
|
{ "gray15" , 0x262626 },
|
||||||
|
{ "grey15" , 0x262626 },
|
||||||
|
{ "gray16" , 0x292929 },
|
||||||
|
{ "grey16" , 0x292929 },
|
||||||
|
{ "gray17" , 0x2b2b2b },
|
||||||
|
{ "grey17" , 0x2b2b2b },
|
||||||
|
{ "gray18" , 0x2e2e2e },
|
||||||
|
{ "grey18" , 0x2e2e2e },
|
||||||
|
{ "gray19" , 0x303030 },
|
||||||
|
{ "grey19" , 0x303030 },
|
||||||
|
{ "gray20" , 0x333333 },
|
||||||
|
{ "grey20" , 0x333333 },
|
||||||
|
{ "gray21" , 0x363636 },
|
||||||
|
{ "grey21" , 0x363636 },
|
||||||
|
{ "gray22" , 0x383838 },
|
||||||
|
{ "grey22" , 0x383838 },
|
||||||
|
{ "gray23" , 0x3b3b3b },
|
||||||
|
{ "grey23" , 0x3b3b3b },
|
||||||
|
{ "gray24" , 0x3d3d3d },
|
||||||
|
{ "grey24" , 0x3d3d3d },
|
||||||
|
{ "gray25" , 0x404040 },
|
||||||
|
{ "grey25" , 0x404040 },
|
||||||
|
{ "gray26" , 0x424242 },
|
||||||
|
{ "grey26" , 0x424242 },
|
||||||
|
{ "gray27" , 0x454545 },
|
||||||
|
{ "grey27" , 0x454545 },
|
||||||
|
{ "gray28" , 0x474747 },
|
||||||
|
{ "grey28" , 0x474747 },
|
||||||
|
{ "gray29" , 0x4a4a4a },
|
||||||
|
{ "grey29" , 0x4a4a4a },
|
||||||
|
{ "gray30" , 0x4d4d4d },
|
||||||
|
{ "grey30" , 0x4d4d4d },
|
||||||
|
{ "gray31" , 0x4f4f4f },
|
||||||
|
{ "grey31" , 0x4f4f4f },
|
||||||
|
{ "gray32" , 0x525252 },
|
||||||
|
{ "grey32" , 0x525252 },
|
||||||
|
{ "gray33" , 0x545454 },
|
||||||
|
{ "grey33" , 0x545454 },
|
||||||
|
{ "gray34" , 0x575757 },
|
||||||
|
{ "grey34" , 0x575757 },
|
||||||
|
{ "gray35" , 0x595959 },
|
||||||
|
{ "grey35" , 0x595959 },
|
||||||
|
{ "gray36" , 0x5c5c5c },
|
||||||
|
{ "grey36" , 0x5c5c5c },
|
||||||
|
{ "gray37" , 0x5e5e5e },
|
||||||
|
{ "grey37" , 0x5e5e5e },
|
||||||
|
{ "gray38" , 0x616161 },
|
||||||
|
{ "grey38" , 0x616161 },
|
||||||
|
{ "gray39" , 0x636363 },
|
||||||
|
{ "grey39" , 0x636363 },
|
||||||
|
{ "gray40" , 0x666666 },
|
||||||
|
{ "grey40" , 0x666666 },
|
||||||
|
{ "gray41" , 0x696969 },
|
||||||
|
{ "grey41" , 0x696969 },
|
||||||
|
{ "gray42" , 0x6b6b6b },
|
||||||
|
{ "grey42" , 0x6b6b6b },
|
||||||
|
{ "gray43" , 0x6e6e6e },
|
||||||
|
{ "grey43" , 0x6e6e6e },
|
||||||
|
{ "gray44" , 0x707070 },
|
||||||
|
{ "grey44" , 0x707070 },
|
||||||
|
{ "gray45" , 0x737373 },
|
||||||
|
{ "grey45" , 0x737373 },
|
||||||
|
{ "gray46" , 0x757575 },
|
||||||
|
{ "grey46" , 0x757575 },
|
||||||
|
{ "gray47" , 0x787878 },
|
||||||
|
{ "grey47" , 0x787878 },
|
||||||
|
{ "gray48" , 0x7a7a7a },
|
||||||
|
{ "grey48" , 0x7a7a7a },
|
||||||
|
{ "gray49" , 0x7d7d7d },
|
||||||
|
{ "grey49" , 0x7d7d7d },
|
||||||
|
{ "gray50" , 0x7f7f7f },
|
||||||
|
{ "grey50" , 0x7f7f7f },
|
||||||
|
{ "gray51" , 0x828282 },
|
||||||
|
{ "grey51" , 0x828282 },
|
||||||
|
{ "gray52" , 0x858585 },
|
||||||
|
{ "grey52" , 0x858585 },
|
||||||
|
{ "gray53" , 0x878787 },
|
||||||
|
{ "grey53" , 0x878787 },
|
||||||
|
{ "gray54" , 0x8a8a8a },
|
||||||
|
{ "grey54" , 0x8a8a8a },
|
||||||
|
{ "gray55" , 0x8c8c8c },
|
||||||
|
{ "grey55" , 0x8c8c8c },
|
||||||
|
{ "gray56" , 0x8f8f8f },
|
||||||
|
{ "grey56" , 0x8f8f8f },
|
||||||
|
{ "gray57" , 0x919191 },
|
||||||
|
{ "grey57" , 0x919191 },
|
||||||
|
{ "gray58" , 0x949494 },
|
||||||
|
{ "grey58" , 0x949494 },
|
||||||
|
{ "gray59" , 0x969696 },
|
||||||
|
{ "grey59" , 0x969696 },
|
||||||
|
{ "gray60" , 0x999999 },
|
||||||
|
{ "grey60" , 0x999999 },
|
||||||
|
{ "gray61" , 0x9c9c9c },
|
||||||
|
{ "grey61" , 0x9c9c9c },
|
||||||
|
{ "gray62" , 0x9e9e9e },
|
||||||
|
{ "grey62" , 0x9e9e9e },
|
||||||
|
{ "gray63" , 0xa1a1a1 },
|
||||||
|
{ "grey63" , 0xa1a1a1 },
|
||||||
|
{ "gray64" , 0xa3a3a3 },
|
||||||
|
{ "grey64" , 0xa3a3a3 },
|
||||||
|
{ "gray65" , 0xa6a6a6 },
|
||||||
|
{ "grey65" , 0xa6a6a6 },
|
||||||
|
{ "gray66" , 0xa8a8a8 },
|
||||||
|
{ "grey66" , 0xa8a8a8 },
|
||||||
|
{ "gray67" , 0xababab },
|
||||||
|
{ "grey67" , 0xababab },
|
||||||
|
{ "gray68" , 0xadadad },
|
||||||
|
{ "grey68" , 0xadadad },
|
||||||
|
{ "gray69" , 0xb0b0b0 },
|
||||||
|
{ "grey69" , 0xb0b0b0 },
|
||||||
|
{ "gray70" , 0xb3b3b3 },
|
||||||
|
{ "grey70" , 0xb3b3b3 },
|
||||||
|
{ "gray71" , 0xb5b5b5 },
|
||||||
|
{ "grey71" , 0xb5b5b5 },
|
||||||
|
{ "gray72" , 0xb8b8b8 },
|
||||||
|
{ "grey72" , 0xb8b8b8 },
|
||||||
|
{ "gray73" , 0xbababa },
|
||||||
|
{ "grey73" , 0xbababa },
|
||||||
|
{ "gray74" , 0xbdbdbd },
|
||||||
|
{ "grey74" , 0xbdbdbd },
|
||||||
|
{ "gray75" , 0xbfbfbf },
|
||||||
|
{ "grey75" , 0xbfbfbf },
|
||||||
|
{ "gray76" , 0xc2c2c2 },
|
||||||
|
{ "grey76" , 0xc2c2c2 },
|
||||||
|
{ "gray77" , 0xc4c4c4 },
|
||||||
|
{ "grey77" , 0xc4c4c4 },
|
||||||
|
{ "gray78" , 0xc7c7c7 },
|
||||||
|
{ "grey78" , 0xc7c7c7 },
|
||||||
|
{ "gray79" , 0xc9c9c9 },
|
||||||
|
{ "grey79" , 0xc9c9c9 },
|
||||||
|
{ "gray80" , 0xcccccc },
|
||||||
|
{ "grey80" , 0xcccccc },
|
||||||
|
{ "gray81" , 0xcfcfcf },
|
||||||
|
{ "grey81" , 0xcfcfcf },
|
||||||
|
{ "gray82" , 0xd1d1d1 },
|
||||||
|
{ "grey82" , 0xd1d1d1 },
|
||||||
|
{ "gray83" , 0xd4d4d4 },
|
||||||
|
{ "grey83" , 0xd4d4d4 },
|
||||||
|
{ "gray84" , 0xd6d6d6 },
|
||||||
|
{ "grey84" , 0xd6d6d6 },
|
||||||
|
{ "gray85" , 0xd9d9d9 },
|
||||||
|
{ "grey85" , 0xd9d9d9 },
|
||||||
|
{ "gray86" , 0xdbdbdb },
|
||||||
|
{ "grey86" , 0xdbdbdb },
|
||||||
|
{ "gray87" , 0xdedede },
|
||||||
|
{ "grey87" , 0xdedede },
|
||||||
|
{ "gray88" , 0xe0e0e0 },
|
||||||
|
{ "grey88" , 0xe0e0e0 },
|
||||||
|
{ "gray89" , 0xe3e3e3 },
|
||||||
|
{ "grey89" , 0xe3e3e3 },
|
||||||
|
{ "gray90" , 0xe5e5e5 },
|
||||||
|
{ "grey90" , 0xe5e5e5 },
|
||||||
|
{ "gray91" , 0xe8e8e8 },
|
||||||
|
{ "grey91" , 0xe8e8e8 },
|
||||||
|
{ "gray92" , 0xebebeb },
|
||||||
|
{ "grey92" , 0xebebeb },
|
||||||
|
{ "gray93" , 0xededed },
|
||||||
|
{ "grey93" , 0xededed },
|
||||||
|
{ "gray94" , 0xf0f0f0 },
|
||||||
|
{ "grey94" , 0xf0f0f0 },
|
||||||
|
{ "gray95" , 0xf2f2f2 },
|
||||||
|
{ "grey95" , 0xf2f2f2 },
|
||||||
|
{ "gray96" , 0xf5f5f5 },
|
||||||
|
{ "grey96" , 0xf5f5f5 },
|
||||||
|
{ "gray97" , 0xf7f7f7 },
|
||||||
|
{ "grey97" , 0xf7f7f7 },
|
||||||
|
{ "gray98" , 0xfafafa },
|
||||||
|
{ "grey98" , 0xfafafa },
|
||||||
|
{ "gray99" , 0xfcfcfc },
|
||||||
|
{ "grey99" , 0xfcfcfc },
|
||||||
|
{ "gray100" , 0xffffff },
|
||||||
|
{ "grey100" , 0xffffff },
|
||||||
|
{ "dark grey" , 0xa9a9a9 },
|
||||||
|
{ "darkgrey" , 0xa9a9a9 },
|
||||||
|
{ "dark gray" , 0xa9a9a9 },
|
||||||
|
{ "darkgray" , 0xa9a9a9 },
|
||||||
|
{ "dark blue" , 0x8b },
|
||||||
|
{ "darkblue" , 0x8b },
|
||||||
|
{ "dark cyan" , 0x8b8b },
|
||||||
|
{ "darkcyan" , 0x8b8b },
|
||||||
|
{ "dark magenta" , 0x8b008b },
|
||||||
|
{ "darkmagenta" , 0x8b008b },
|
||||||
|
{ "dark red" , 0x8b0000 },
|
||||||
|
{ "darkred" , 0x8b0000 },
|
||||||
|
{ "light green" , 0x90ee90 },
|
||||||
|
{ "lightgreen" , 0x90ee90 },
|
||||||
|
{ "none", -1 },
|
||||||
|
{ 0, 0 }
|
||||||
|
};
|
||||||
13
mlx/mlx_screen_size.c
Normal file
13
mlx/mlx_screen_size.c
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
int mlx_get_screen_size(void *mlx_ptr, int *sizex, int *sizey)
|
||||||
|
{
|
||||||
|
XWindowAttributes xwAttr;
|
||||||
|
Status ret;
|
||||||
|
t_xvar *xvar;
|
||||||
|
|
||||||
|
xvar = mlx_ptr;
|
||||||
|
ret = XGetWindowAttributes(xvar->display, xvar->root, &xwAttr);
|
||||||
|
(*sizex) = xwAttr.width;
|
||||||
|
(*sizey) = xwAttr.height;
|
||||||
|
}
|
||||||
30
mlx/mlx_set_font.c
Normal file
30
mlx/mlx_set_font.c
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* mlx_set_font.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: amalliar <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2020/09/30 13:30:47 by amalliar #+# #+# */
|
||||||
|
/* Updated: 2020/09/30 17:08:36 by amalliar ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Allows to specify the font that will be used by mlx_string_put.
|
||||||
|
**
|
||||||
|
** Note: only fixed-width bitmap fonts are supported by Xlib, refer to xfontsel
|
||||||
|
** utility to get valid font names for this function.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void mlx_set_font(t_xvar *xvar, t_win_list *win, char *name)
|
||||||
|
{
|
||||||
|
static Font font = 0;
|
||||||
|
|
||||||
|
if (font)
|
||||||
|
XUnloadFont(xvar->display, font);
|
||||||
|
font = XLoadFont(xvar->display, name);
|
||||||
|
XSetFont(xvar->display, win->gc, font);
|
||||||
|
}
|
||||||
26
mlx/mlx_string_put.c
Normal file
26
mlx/mlx_string_put.c
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
** mlx_string_put.c for MiniLibX in
|
||||||
|
**
|
||||||
|
** Made by Charlie Root
|
||||||
|
** Login <ol@epitech.net>
|
||||||
|
**
|
||||||
|
** Started on Mon Jul 31 19:01:33 2000 Charlie Root
|
||||||
|
** Last update Tue Sep 25 17:11:47 2001 Charlie Root
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_string_put(t_xvar *xvar,t_win_list *win,
|
||||||
|
int x,int y,int color,char *string)
|
||||||
|
{
|
||||||
|
XGCValues xgcv;
|
||||||
|
|
||||||
|
xgcv.foreground = mlx_int_get_good_color(xvar,color);
|
||||||
|
XChangeGC(xvar->display,win->gc,GCForeground,&xgcv);
|
||||||
|
XDrawString(xvar->display,win->window,win->gc,x,y,string,strlen(string));
|
||||||
|
if (xvar->do_flush)
|
||||||
|
XFlush(xvar->display);
|
||||||
|
}
|
||||||
345
mlx/mlx_xpm.c
Normal file
345
mlx/mlx_xpm.c
Normal file
@@ -0,0 +1,345 @@
|
|||||||
|
/*
|
||||||
|
** xpm-read.c for MinilibX in
|
||||||
|
**
|
||||||
|
** Made by Charlie Root
|
||||||
|
** Login <ol@epitech.net>
|
||||||
|
**
|
||||||
|
** Started on Tue Dec 11 15:25:27 2001 olivier crouzet
|
||||||
|
** Last update Sat Oct 1 14:56:13 2005 Olivier Crouzet
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
extern struct s_col_name mlx_col_name[];
|
||||||
|
|
||||||
|
|
||||||
|
#define RETURN { if (colors) free(colors); if (tab) free(tab); \
|
||||||
|
tab = (void *)0; if (colors_direct) free(colors_direct); \
|
||||||
|
if (img) {XDestroyImage(img->image); \
|
||||||
|
XFreePixmap(xvar->display,img->pix);free(img);} \
|
||||||
|
return ((void *)0);}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
char *mlx_int_get_line(char *ptr,int *pos,int size)
|
||||||
|
{
|
||||||
|
int pos2;
|
||||||
|
int pos3;
|
||||||
|
int pos4;
|
||||||
|
|
||||||
|
if ((pos2 = mlx_int_str_str(ptr+*pos,"\"",size-*pos))==-1)
|
||||||
|
return ((char *)0);
|
||||||
|
if ((pos3 = mlx_int_str_str(ptr+*pos+pos2+1,"\"",size-*pos-pos2-1))==-1)
|
||||||
|
return ((char *)0);
|
||||||
|
*(ptr+*pos+pos2) = 0;
|
||||||
|
*(ptr+*pos+pos2+1+pos3) = 0;
|
||||||
|
pos4 = *pos+pos2+1;
|
||||||
|
*pos += pos2+pos3+2;
|
||||||
|
return (ptr+pos4);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unsigned int strlcpy_is_not_posix(char *dest, char *src, unsigned int size)
|
||||||
|
{
|
||||||
|
unsigned count;
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
count = 0;
|
||||||
|
while (src[count] != '\0')
|
||||||
|
++count;
|
||||||
|
i = 0;
|
||||||
|
while (src[i] != '\0' && i < (size - 1))
|
||||||
|
{
|
||||||
|
dest[i] = src[i];
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
dest[i] = '\0';
|
||||||
|
return (count);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *mlx_int_static_line(char **xpm_data,int *pos,int size)
|
||||||
|
{
|
||||||
|
static char *copy = 0;
|
||||||
|
static int len = 0;
|
||||||
|
int len2;
|
||||||
|
char *str;
|
||||||
|
|
||||||
|
str = xpm_data[(*pos)++];
|
||||||
|
if ((len2 = strlen(str))>len)
|
||||||
|
{
|
||||||
|
if (copy)
|
||||||
|
free(copy);
|
||||||
|
if (!(copy = malloc(len2+1)))
|
||||||
|
return ((char *)0);
|
||||||
|
len = len2;
|
||||||
|
}
|
||||||
|
strlcpy_is_not_posix(copy, str, len2);
|
||||||
|
|
||||||
|
return (copy);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_int_get_col_name(char *str,int size)
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
|
||||||
|
result = 0;
|
||||||
|
while (size--)
|
||||||
|
result = (result<<8)+*(str++);
|
||||||
|
|
||||||
|
return (result);
|
||||||
|
}
|
||||||
|
|
||||||
|
int mlx_int_get_text_rgb(char *name, char *end)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
char buff[64];
|
||||||
|
|
||||||
|
if (*name == '#')
|
||||||
|
return (strtol(name+1,0,16));
|
||||||
|
if (end)
|
||||||
|
{
|
||||||
|
snprintf(buff, 64, "%s %s", name, end);
|
||||||
|
name = buff;
|
||||||
|
}
|
||||||
|
i = 0;
|
||||||
|
while (mlx_col_name[i].name)
|
||||||
|
{
|
||||||
|
if (!strcasecmp(mlx_col_name[i].name, name))
|
||||||
|
return (mlx_col_name[i].color);
|
||||||
|
i ++;
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_int_xpm_set_pixel(t_img *img, char *data, int opp, int col, int x)
|
||||||
|
{
|
||||||
|
int dec;
|
||||||
|
|
||||||
|
dec = opp;
|
||||||
|
while (dec--)
|
||||||
|
{
|
||||||
|
if (img->image->byte_order)
|
||||||
|
*(data+x*opp+dec) = col&0xFF;
|
||||||
|
else
|
||||||
|
*(data+x*opp+opp-dec-1) = col&0xFF;
|
||||||
|
col >>= 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void *mlx_int_parse_xpm(t_xvar *xvar,void *info,int info_size,char *(*f)())
|
||||||
|
{
|
||||||
|
int pos;
|
||||||
|
char *line;
|
||||||
|
char **tab;
|
||||||
|
char *data;
|
||||||
|
char *clip_data;
|
||||||
|
int nc;
|
||||||
|
int opp;
|
||||||
|
int cpp;
|
||||||
|
int col;
|
||||||
|
int rgb_col;
|
||||||
|
int col_name;
|
||||||
|
int method;
|
||||||
|
int x;
|
||||||
|
int i;
|
||||||
|
int j;
|
||||||
|
t_img *img;
|
||||||
|
t_xpm_col *colors;
|
||||||
|
int *colors_direct;
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
XImage *clip_img;
|
||||||
|
XGCValues xgcv;
|
||||||
|
Pixmap clip_pix;
|
||||||
|
|
||||||
|
colors = 0;
|
||||||
|
colors_direct = 0;
|
||||||
|
img = 0;
|
||||||
|
tab = 0;
|
||||||
|
pos = 0;
|
||||||
|
if (!(line = f(info,&pos,info_size)) ||
|
||||||
|
!(tab = mlx_int_str_to_wordtab(line)) || !(width = atoi(tab[0])) ||
|
||||||
|
!(height = atoi(tab[1])) || !(nc = atoi(tab[2])) ||
|
||||||
|
!(cpp = atoi(tab[3])) )
|
||||||
|
RETURN;
|
||||||
|
free(tab);
|
||||||
|
tab = 0;
|
||||||
|
|
||||||
|
method = 0;
|
||||||
|
if (cpp<=2)
|
||||||
|
{
|
||||||
|
method = 1;
|
||||||
|
if (!(colors_direct = malloc((cpp==2?65536:256)*sizeof(int))))
|
||||||
|
RETURN;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (!(colors = malloc(nc*sizeof(*colors))))
|
||||||
|
RETURN;
|
||||||
|
|
||||||
|
clip_data = 0;
|
||||||
|
|
||||||
|
i = nc;
|
||||||
|
while (i--)
|
||||||
|
{
|
||||||
|
if (!(line = f(info,&pos,info_size)) ||
|
||||||
|
!(tab = mlx_int_str_to_wordtab(line+cpp)) )
|
||||||
|
RETURN;
|
||||||
|
j = 0;
|
||||||
|
while (tab[j] && strcmp(tab[j++],"c"));
|
||||||
|
|
||||||
|
if (!tab[j])
|
||||||
|
RETURN;
|
||||||
|
rgb_col = mlx_int_get_text_rgb(tab[j], tab[j+1]);
|
||||||
|
/*
|
||||||
|
if ((rgb_col = mlx_int_get_text_rgb(tab[j], tab[j+1]))==-1)
|
||||||
|
{
|
||||||
|
if (!(clip_data = malloc(4*width*height)) || ok, nice size ..
|
||||||
|
!(clip_img = XCreateImage(xvar->display, xvar->visual,
|
||||||
|
1, XYPixmap, 0, clip_data,
|
||||||
|
width, height, 8, (width+7)/8)) )
|
||||||
|
RETURN;
|
||||||
|
memset(clip_data, 0xFF, 4*width*height);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
if (method)
|
||||||
|
colors_direct[mlx_int_get_col_name(line,cpp)] = rgb_col;
|
||||||
|
// rgb_col>=0?mlx_get_color_value(xvar, rgb_col):rgb_col;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
colors[i].name = mlx_int_get_col_name(line,cpp);
|
||||||
|
colors[i].col = rgb_col; //rgb_col>=0?mlx_get_color_value(xvar,rgb_col):rgb_col;
|
||||||
|
}
|
||||||
|
free(tab);
|
||||||
|
tab = (void *)0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(img = mlx_new_image(xvar,width,height)))
|
||||||
|
RETURN;
|
||||||
|
opp = img->bpp/8;
|
||||||
|
|
||||||
|
|
||||||
|
i = height;
|
||||||
|
data = img->data;
|
||||||
|
while (i--)
|
||||||
|
{
|
||||||
|
if (!(line = f(info,&pos,info_size)))
|
||||||
|
RETURN;
|
||||||
|
x = 0;
|
||||||
|
while (x<width)
|
||||||
|
{
|
||||||
|
col = 0;
|
||||||
|
col_name = mlx_int_get_col_name(line+cpp*x,cpp);
|
||||||
|
if (method)
|
||||||
|
col = colors_direct[col_name];
|
||||||
|
else
|
||||||
|
{
|
||||||
|
j = nc;
|
||||||
|
while (j--)
|
||||||
|
if (colors[j].name==col_name)
|
||||||
|
{
|
||||||
|
col = colors[j].col;
|
||||||
|
j = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
if (col==-1)
|
||||||
|
XPutPixel(clip_img, x, height-1-i, 0);
|
||||||
|
else
|
||||||
|
mlx_int_xpm_set_pixel(img, data, opp, col, x);
|
||||||
|
x ++;
|
||||||
|
*/
|
||||||
|
if (col==-1)
|
||||||
|
col = 0xFF000000;
|
||||||
|
mlx_int_xpm_set_pixel(img, data, opp, col, x);
|
||||||
|
++x;
|
||||||
|
}
|
||||||
|
data += img->size_line;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
if (clip_data)
|
||||||
|
{
|
||||||
|
if (!(clip_pix = XCreatePixmap(xvar->display, xvar->root,
|
||||||
|
width, height, 1)) )
|
||||||
|
RETURN;
|
||||||
|
img->gc = XCreateGC(xvar->display, clip_pix, 0, &xgcv);
|
||||||
|
XPutImage(xvar->display, clip_pix, img->gc, clip_img,
|
||||||
|
0, 0, 0, 0, width, height);
|
||||||
|
XFreeGC(xvar->display, img->gc);
|
||||||
|
xgcv.clip_mask = clip_pix;
|
||||||
|
xgcv.function = GXcopy;
|
||||||
|
xgcv.plane_mask = AllPlanes;
|
||||||
|
img->gc = XCreateGC(xvar->display, xvar->root, GCClipMask|GCFunction|
|
||||||
|
GCPlaneMask, &xgcv);
|
||||||
|
XSync(xvar->display, False);
|
||||||
|
XDestroyImage(clip_img);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
if (colors)
|
||||||
|
free(colors);
|
||||||
|
if (colors_direct)
|
||||||
|
free(colors_direct);
|
||||||
|
return (img);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_int_file_get_rid_comment(char *ptr, int size)
|
||||||
|
{
|
||||||
|
int com_begin;
|
||||||
|
int com_end;
|
||||||
|
|
||||||
|
while ((com_begin = mlx_int_str_str_cote(ptr,"/*",size))!=-1)
|
||||||
|
{
|
||||||
|
com_end = mlx_int_str_str(ptr+com_begin+2,"*/",size-com_begin-2);
|
||||||
|
memset(ptr+com_begin,' ',com_end+4);
|
||||||
|
}
|
||||||
|
while ((com_begin = mlx_int_str_str_cote(ptr,"//",size))!=-1)
|
||||||
|
{
|
||||||
|
com_end = mlx_int_str_str(ptr+com_begin+2,"\n",size-com_begin-2);
|
||||||
|
memset(ptr+com_begin,' ',com_end+3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void *mlx_xpm_file_to_image(t_xvar *xvar,char *file,int *width,int *height)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
int size;
|
||||||
|
char *ptr;
|
||||||
|
t_img *img;
|
||||||
|
|
||||||
|
fd = -1;
|
||||||
|
if ((fd = open(file,O_RDONLY))==-1 || (size = lseek(fd,0,SEEK_END))==-1 ||
|
||||||
|
(ptr = mmap(0,size,PROT_WRITE|PROT_READ,MAP_PRIVATE,fd,0))==
|
||||||
|
(void *)MAP_FAILED)
|
||||||
|
{
|
||||||
|
if (fd>=0)
|
||||||
|
close(fd);
|
||||||
|
return ((void *)0);
|
||||||
|
}
|
||||||
|
mlx_int_file_get_rid_comment(ptr, size);
|
||||||
|
if (img = mlx_int_parse_xpm(xvar,ptr,size,mlx_int_get_line))
|
||||||
|
{
|
||||||
|
*width = img->width;
|
||||||
|
*height = img->height;
|
||||||
|
}
|
||||||
|
munmap(ptr,size);
|
||||||
|
close(fd);
|
||||||
|
return (img);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *mlx_xpm_to_image(t_xvar *xvar,char **xpm_data,int *width,int *height)
|
||||||
|
{
|
||||||
|
t_img *img;
|
||||||
|
|
||||||
|
if (img = mlx_int_parse_xpm(xvar,xpm_data,0,mlx_int_static_line))
|
||||||
|
{
|
||||||
|
*width = img->width;
|
||||||
|
*height = img->height;
|
||||||
|
}
|
||||||
|
return (img);
|
||||||
|
}
|
||||||
310
mlx/mlx_xpm.c.ok
Normal file
310
mlx/mlx_xpm.c.ok
Normal file
@@ -0,0 +1,310 @@
|
|||||||
|
/*
|
||||||
|
** xpm-read.c for MinilibX in
|
||||||
|
**
|
||||||
|
** Made by Charlie Root
|
||||||
|
** Login <ol@epitech.net>
|
||||||
|
**
|
||||||
|
** Started on Tue Dec 11 15:25:27 2001 olivier crouzet
|
||||||
|
** Last update Sat Oct 1 14:40:55 2005 Olivier Crouzet
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
extern struct s_col_name mlx_col_name[];
|
||||||
|
|
||||||
|
|
||||||
|
#define RETURN { if (colors) free(colors); if (tab) free(tab); \
|
||||||
|
if (colors_direct) free(colors_direct); \
|
||||||
|
if (img) {XDestroyImage(img->image); \
|
||||||
|
XFreePixmap(xvar->display,img->pix);free(img);} \
|
||||||
|
return ((void *)0);}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
char *mlx_int_get_line(char *ptr,int *pos,int size)
|
||||||
|
{
|
||||||
|
int pos2;
|
||||||
|
int pos3;
|
||||||
|
int pos4;
|
||||||
|
|
||||||
|
if ((pos2 = mlx_int_str_str(ptr+*pos,"\"",size-*pos))==-1)
|
||||||
|
return ((char *)0);
|
||||||
|
if ((pos3 = mlx_int_str_str(ptr+*pos+pos2+1,"\"",size-*pos-pos2-1))==-1)
|
||||||
|
return ((char *)0);
|
||||||
|
*(ptr+*pos+pos2) = 0;
|
||||||
|
*(ptr+*pos+pos2+1+pos3) = 0;
|
||||||
|
pos4 = *pos+pos2+1;
|
||||||
|
*pos += pos2+pos3+2;
|
||||||
|
return (ptr+pos4);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
char *mlx_int_static_line(char **xpm_data,int *pos,int size)
|
||||||
|
{
|
||||||
|
static char *copy = 0;
|
||||||
|
static int len = 0;
|
||||||
|
int len2;
|
||||||
|
char *str;
|
||||||
|
|
||||||
|
str = xpm_data[(*pos)++];
|
||||||
|
if ((len2 = strlen(str))>len)
|
||||||
|
{
|
||||||
|
if (copy)
|
||||||
|
free(copy);
|
||||||
|
if (!(copy = malloc(len2+1)))
|
||||||
|
return ((char *)0);
|
||||||
|
len = len2;
|
||||||
|
}
|
||||||
|
/* strcpy(copy,str); */
|
||||||
|
strlcpy(copy, str, len2+1);
|
||||||
|
return (copy);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_int_get_col_name(char *str,int size)
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
|
||||||
|
result = 0;
|
||||||
|
while (size--)
|
||||||
|
result = (result<<8)+*(str++);
|
||||||
|
return (result);
|
||||||
|
}
|
||||||
|
|
||||||
|
int mlx_int_get_text_rgb(char *name)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (*name == '#')
|
||||||
|
return (strtol(name+1,0,16));
|
||||||
|
i = 0;
|
||||||
|
while (mlx_col_name[i].name)
|
||||||
|
{
|
||||||
|
if (!strcasecmp(mlx_col_name[i].name, name))
|
||||||
|
return (mlx_col_name[i].color);
|
||||||
|
i ++;
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_int_xpm_set_pixel(t_img *img, char *data, int opp, int col, int x)
|
||||||
|
{
|
||||||
|
int dec;
|
||||||
|
|
||||||
|
dec = opp;
|
||||||
|
while (dec--)
|
||||||
|
{
|
||||||
|
if (img->image->byte_order)
|
||||||
|
*(data+x*opp+dec) = col&0xFF;
|
||||||
|
else
|
||||||
|
*(data+x*opp+opp-dec-1) = col&0xFF;
|
||||||
|
col >>= 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void *mlx_int_parse_xpm(t_xvar *xvar,void *info,int info_size,char *(*f)())
|
||||||
|
{
|
||||||
|
int pos;
|
||||||
|
char *line;
|
||||||
|
char **tab;
|
||||||
|
char *data;
|
||||||
|
char *clip_data;
|
||||||
|
int nc;
|
||||||
|
int opp;
|
||||||
|
int cpp;
|
||||||
|
int col;
|
||||||
|
int rgb_col;
|
||||||
|
int col_name;
|
||||||
|
int method;
|
||||||
|
int x;
|
||||||
|
int i;
|
||||||
|
int j;
|
||||||
|
t_img *img;
|
||||||
|
t_xpm_col *colors;
|
||||||
|
int *colors_direct;
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
XImage *clip_img;
|
||||||
|
XGCValues xgcv;
|
||||||
|
Pixmap clip_pix;
|
||||||
|
|
||||||
|
colors = 0;
|
||||||
|
colors_direct = 0;
|
||||||
|
img = 0;
|
||||||
|
tab = 0;
|
||||||
|
pos = 0;
|
||||||
|
if (!(line = f(info,&pos,info_size)) ||
|
||||||
|
!(tab = mlx_int_str_to_wordtab(line)) || !(width = atoi(tab[0])) ||
|
||||||
|
!(height = atoi(tab[1])) || !(nc = atoi(tab[2])) ||
|
||||||
|
!(cpp = atoi(tab[3])) )
|
||||||
|
RETURN;
|
||||||
|
free(tab);
|
||||||
|
tab = 0;
|
||||||
|
|
||||||
|
method = 0;
|
||||||
|
if (cpp<=2)
|
||||||
|
{
|
||||||
|
method = 1;
|
||||||
|
if (!(colors_direct = malloc((cpp==2?65536:256)*sizeof(int))))
|
||||||
|
RETURN;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (!(colors = malloc(nc*sizeof(*colors))))
|
||||||
|
RETURN;
|
||||||
|
|
||||||
|
clip_data = 0;
|
||||||
|
|
||||||
|
i = nc;
|
||||||
|
while (i--)
|
||||||
|
{
|
||||||
|
if (!(line = f(info,&pos,info_size)) ||
|
||||||
|
!(tab = mlx_int_str_to_wordtab(line+cpp)) )
|
||||||
|
RETURN;
|
||||||
|
j = 0;
|
||||||
|
while (tab[j] && strcmp(tab[j++],"c"));
|
||||||
|
if (!tab[j])
|
||||||
|
RETURN;
|
||||||
|
|
||||||
|
if ((rgb_col = mlx_int_get_text_rgb(tab[j]))==-1)
|
||||||
|
{
|
||||||
|
if (!(clip_data = malloc(4*width*height)) || /* ok, nice size .. */
|
||||||
|
!(clip_img = XCreateImage(xvar->display, xvar->visual,
|
||||||
|
1, XYPixmap, 0, clip_data,
|
||||||
|
width, height, 8, (width+7)/8)) )
|
||||||
|
RETURN;
|
||||||
|
memset(clip_data, 0xFF, 4*width*height);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (method)
|
||||||
|
colors_direct[mlx_int_get_col_name(line,cpp)] =
|
||||||
|
rgb_col>=0?mlx_get_color_value(xvar, rgb_col):rgb_col;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
colors[i].name = mlx_int_get_col_name(line,cpp);
|
||||||
|
colors[i].col = rgb_col>=0?mlx_get_color_value(xvar,rgb_col):rgb_col;
|
||||||
|
}
|
||||||
|
free(tab);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(img = mlx_new_image(xvar,width,height)))
|
||||||
|
RETURN;
|
||||||
|
opp = img->bpp/8;
|
||||||
|
|
||||||
|
|
||||||
|
i = height;
|
||||||
|
data = img->data;
|
||||||
|
while (i--)
|
||||||
|
{
|
||||||
|
if (!(line = f(info,&pos,info_size)))
|
||||||
|
RETURN;
|
||||||
|
x = 0;
|
||||||
|
while (x<width)
|
||||||
|
{
|
||||||
|
col = 0;
|
||||||
|
col_name = mlx_int_get_col_name(line+cpp*x,cpp);
|
||||||
|
if (method)
|
||||||
|
col = colors_direct[col_name];
|
||||||
|
else
|
||||||
|
{
|
||||||
|
j = nc;
|
||||||
|
while (j--)
|
||||||
|
if (colors[j].name==col_name)
|
||||||
|
{
|
||||||
|
col = colors[j].col;
|
||||||
|
j = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (col==-1)
|
||||||
|
XPutPixel(clip_img, x, height-1-i, 0);
|
||||||
|
else
|
||||||
|
mlx_int_xpm_set_pixel(img, data, opp, col, x);
|
||||||
|
x ++;
|
||||||
|
}
|
||||||
|
data += img->size_line;
|
||||||
|
}
|
||||||
|
if (clip_data)
|
||||||
|
{
|
||||||
|
if (!(clip_pix = XCreatePixmap(xvar->display, xvar->root,
|
||||||
|
width, height, 1)) )
|
||||||
|
RETURN;
|
||||||
|
img->gc = XCreateGC(xvar->display, clip_pix, 0, &xgcv);
|
||||||
|
XPutImage(xvar->display, clip_pix, img->gc, clip_img,
|
||||||
|
0, 0, 0, 0, width, height);
|
||||||
|
XFreeGC(xvar->display, img->gc);
|
||||||
|
xgcv.clip_mask = clip_pix;
|
||||||
|
xgcv.function = GXcopy;
|
||||||
|
xgcv.plane_mask = AllPlanes;
|
||||||
|
img->gc = XCreateGC(xvar->display, xvar->root, GCClipMask|GCFunction|
|
||||||
|
GCPlaneMask, &xgcv);
|
||||||
|
XSync(xvar->display, False);
|
||||||
|
XDestroyImage(clip_img);
|
||||||
|
}
|
||||||
|
if (colors)
|
||||||
|
free(colors);
|
||||||
|
if (colors_direct)
|
||||||
|
free(colors_direct);
|
||||||
|
return (img);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int mlx_int_file_get_rid_comment(char *ptr, int size)
|
||||||
|
{
|
||||||
|
int com_begin;
|
||||||
|
int com_end;
|
||||||
|
|
||||||
|
while ((com_begin = mlx_int_str_str_cote(ptr,"/*",size))!=-1)
|
||||||
|
{
|
||||||
|
com_end = mlx_int_str_str(ptr+com_begin+2,"*/",size-com_begin-2);
|
||||||
|
memset(ptr+com_begin,' ',com_end+4);
|
||||||
|
}
|
||||||
|
while ((com_begin = mlx_int_str_str_cote(ptr,"//",size))!=-1)
|
||||||
|
{
|
||||||
|
com_end = mlx_int_str_str(ptr+com_begin+2,"\n",size-com_begin-2);
|
||||||
|
memset(ptr+com_begin,' ',com_end+3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void *mlx_xpm_file_to_image(t_xvar *xvar,char *file,int *width,int *height)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
int size;
|
||||||
|
char *ptr;
|
||||||
|
t_img *img;
|
||||||
|
|
||||||
|
fd = -1;
|
||||||
|
if ((fd = open(file,O_RDONLY))==-1 || (size = lseek(fd,0,SEEK_END))==-1 ||
|
||||||
|
(ptr = mmap(0,size,PROT_WRITE|PROT_READ,MAP_PRIVATE,fd,0))==
|
||||||
|
(void *)MAP_FAILED)
|
||||||
|
{
|
||||||
|
if (fd>=0)
|
||||||
|
close(fd);
|
||||||
|
return ((void *)0);
|
||||||
|
}
|
||||||
|
mlx_int_file_get_rid_comment(ptr, size);
|
||||||
|
if (img = mlx_int_parse_xpm(xvar,ptr,size,mlx_int_get_line))
|
||||||
|
{
|
||||||
|
*width = img->width;
|
||||||
|
*height = img->height;
|
||||||
|
}
|
||||||
|
munmap(ptr,size);
|
||||||
|
close(fd);
|
||||||
|
return (img);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *mlx_xpm_to_image(t_xvar *xvar,char **xpm_data,int *width,int *height)
|
||||||
|
{
|
||||||
|
t_img *img;
|
||||||
|
|
||||||
|
if (img = mlx_int_parse_xpm(xvar,xpm_data,0,mlx_int_static_line))
|
||||||
|
{
|
||||||
|
*width = img->width;
|
||||||
|
*height = img->height;
|
||||||
|
}
|
||||||
|
return (img);
|
||||||
|
}
|
||||||
38
mlx/rgb2c.pl
Executable file
38
mlx/rgb2c.pl
Executable file
@@ -0,0 +1,38 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
#
|
||||||
|
## rgb2c.pl for MiniLibX in /home/boulon/work/c/raytraceur/minilibx
|
||||||
|
##
|
||||||
|
## Made by Olivier Crouzet
|
||||||
|
## Login <ol@epitech.net>
|
||||||
|
##
|
||||||
|
## Started on Tue Oct 5 16:33:46 2004 Olivier Crouzet
|
||||||
|
## Last update Tue Oct 5 16:36:11 2004 Olivier Crouzet
|
||||||
|
##
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Generate a .c file with encoded colors, from the XFree86 rgb.txt file.
|
||||||
|
#
|
||||||
|
|
||||||
|
open(RGB, "/usr/X11/lib/X11/rgb.txt");
|
||||||
|
|
||||||
|
|
||||||
|
printf("/*\n** This is a generated file with rgb2c.pl and rgb.txt from\n");
|
||||||
|
printf("** the XFree86 distribution.\n*/\n\n");
|
||||||
|
printf("struct s_col_name mlx_col_name[] =\n{\n");
|
||||||
|
|
||||||
|
while (<RGB>)
|
||||||
|
{
|
||||||
|
@tab = split;
|
||||||
|
if ($tab[0] ne "!")
|
||||||
|
{
|
||||||
|
$color = $tab[3];
|
||||||
|
if ("$tab[4]" ne "")
|
||||||
|
{
|
||||||
|
$color = "$tab[3] $tab[4]";
|
||||||
|
}
|
||||||
|
printf(" { \"%s\" , 0x%x },\n", $color, $tab[0]*65536+$tab[1]*256+$tab[2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printf(" { 0, 0 }\n};\n");
|
||||||
41
mlx/test/Makefile.mk
Normal file
41
mlx/test/Makefile.mk
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
|
||||||
|
INC=%%%%
|
||||||
|
|
||||||
|
INCLIB=$(INC)/../lib
|
||||||
|
|
||||||
|
CC=gcc
|
||||||
|
|
||||||
|
CFLAGS= -I$(INC) -O3 -I.. -g
|
||||||
|
|
||||||
|
NAME= mlx-test
|
||||||
|
SRC = main.c
|
||||||
|
OBJ = $(SRC:%.c=%.o)
|
||||||
|
|
||||||
|
LFLAGS = -L.. -lmlx -L$(INCLIB) -lXext -lX11 -lm
|
||||||
|
|
||||||
|
UNAME := $(shell uname)
|
||||||
|
ifeq ($(UNAME), Darwin)
|
||||||
|
# mac
|
||||||
|
else
|
||||||
|
#Linux and others...
|
||||||
|
LFLAGS += -lbsd
|
||||||
|
endif
|
||||||
|
|
||||||
|
all: $(NAME)
|
||||||
|
|
||||||
|
$(NAME): $(OBJ)
|
||||||
|
$(CC) -o $(NAME) $(OBJ) $(LFLAGS)
|
||||||
|
|
||||||
|
show:
|
||||||
|
@printf "UNAME : $(UNAME)\n"
|
||||||
|
@printf "NAME : $(NAME)\n"
|
||||||
|
@printf "CC : $(CC)\n"
|
||||||
|
@printf "CFLAGS : $(CFLAGS)\n"
|
||||||
|
@printf "LFLAGS : $(LFLAGS)\n"
|
||||||
|
@printf "SRC :\n $(SRC)\n"
|
||||||
|
@printf "OBJ :\n $(OBJ)\n"
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(NAME) $(OBJ) *~ core *.core
|
||||||
|
|
||||||
|
re: clean all
|
||||||
287
mlx/test/main.c
Normal file
287
mlx/test/main.c
Normal file
@@ -0,0 +1,287 @@
|
|||||||
|
|
||||||
|
#include "mlx.h"
|
||||||
|
#include "mlx_int.h"
|
||||||
|
|
||||||
|
#define WIN1_SX 242
|
||||||
|
#define WIN1_SY 242
|
||||||
|
#define IM1_SX 42
|
||||||
|
#define IM1_SY 42
|
||||||
|
#define IM3_SX 242
|
||||||
|
#define IM3_SY 242
|
||||||
|
|
||||||
|
void *mlx;
|
||||||
|
void *win1;
|
||||||
|
void *win2;
|
||||||
|
void *win3;
|
||||||
|
void *im1;
|
||||||
|
void *im2;
|
||||||
|
void *im3;
|
||||||
|
void *im4;
|
||||||
|
int bpp1;
|
||||||
|
int bpp2;
|
||||||
|
int bpp3;
|
||||||
|
int bpp4;
|
||||||
|
int sl1;
|
||||||
|
int sl2;
|
||||||
|
int sl3;
|
||||||
|
int sl4;
|
||||||
|
int endian1;
|
||||||
|
int endian2;
|
||||||
|
int endian3;
|
||||||
|
int endian4;
|
||||||
|
char *data1;
|
||||||
|
char *data2;
|
||||||
|
char *data3;
|
||||||
|
char *data4;
|
||||||
|
int xpm1_x;
|
||||||
|
int xpm1_y;
|
||||||
|
|
||||||
|
int local_endian;
|
||||||
|
|
||||||
|
int color_map_1(void *win,int w,int h);
|
||||||
|
int color_map_2(unsigned char *data,int bpp,int sl,int w,int h,int endian, int type);
|
||||||
|
|
||||||
|
int expose_win1(void *p)
|
||||||
|
{
|
||||||
|
mlx_put_image_to_window(mlx,win1,im3,0,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int expose_win2(void *p)
|
||||||
|
{
|
||||||
|
mlx_put_image_to_window(mlx,win2,im4,0,0);
|
||||||
|
mlx_put_image_to_window(mlx,win2,im2,0,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int key_win1(int key,void *p)
|
||||||
|
{
|
||||||
|
printf("Key in Win1 : %d\n",key);
|
||||||
|
if (key==0xFF1B)
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int key_win2(int key,void *p)
|
||||||
|
{
|
||||||
|
printf("Key in Win2 : %d\n",key);
|
||||||
|
if (key==0xFF1B)
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int key_win3(int key,void *p)
|
||||||
|
{
|
||||||
|
printf("Key in Win3 : %d\n",key);
|
||||||
|
if (key==0xFF1B)
|
||||||
|
mlx_destroy_window(mlx,win3);
|
||||||
|
}
|
||||||
|
|
||||||
|
int mouse_win1(int button,int x,int y, void *p)
|
||||||
|
{
|
||||||
|
printf("Mouse in Win1, button %d at %dx%d.\n",button,x,y);
|
||||||
|
}
|
||||||
|
|
||||||
|
int mouse_win2(int button,int x,int y, void *p)
|
||||||
|
{
|
||||||
|
printf("Mouse in Win2, button %d at %dx%d.\n",button,x,y);
|
||||||
|
}
|
||||||
|
|
||||||
|
int mouse_win3(int x,int y, void *p)
|
||||||
|
{
|
||||||
|
printf("Mouse moving in Win3, at %dx%d.\n",x,y);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int a;
|
||||||
|
|
||||||
|
printf("MinilibX Test Program\n");
|
||||||
|
a = 0x11223344;
|
||||||
|
if (((unsigned char *)&a)[0] == 0x11)
|
||||||
|
local_endian = 1;
|
||||||
|
else
|
||||||
|
local_endian = 0;
|
||||||
|
printf(" => Local Endian : %d\n",local_endian);
|
||||||
|
|
||||||
|
printf(" => Connection ...");
|
||||||
|
if (!(mlx = mlx_init()))
|
||||||
|
{
|
||||||
|
printf(" !! KO !!\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
printf("OK (use_xshm %d pshm_format %d)\n",((t_xvar *)mlx)->use_xshm,((t_xvar *)mlx)->pshm_format);
|
||||||
|
|
||||||
|
printf(" => Window1 %dx%d \"Title 1\" ...",WIN1_SX,WIN1_SY);
|
||||||
|
if (!(win1 = mlx_new_window(mlx,WIN1_SX,WIN1_SY,"Title1")))
|
||||||
|
{
|
||||||
|
printf(" !! KO !!\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
printf("OK\n");
|
||||||
|
|
||||||
|
printf(" => Colormap sans event ...");
|
||||||
|
color_map_1(win1,WIN1_SX,WIN1_SY);
|
||||||
|
printf("OK\n");
|
||||||
|
sleep(2);
|
||||||
|
|
||||||
|
printf(" => Clear Window ...");
|
||||||
|
mlx_clear_window(mlx,win1);
|
||||||
|
printf("OK\n");
|
||||||
|
sleep(2);
|
||||||
|
|
||||||
|
printf(" => Image1 ZPixmap %dx%d ...",IM1_SX,IM1_SY);
|
||||||
|
if (!(im1 = mlx_new_image(mlx,IM1_SX,IM1_SY)))
|
||||||
|
{
|
||||||
|
printf(" !! KO !!\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
data1 = mlx_get_data_addr(im1,&bpp1,&sl1,&endian1);
|
||||||
|
printf("OK (bpp1: %d, sizeline1: %d endian: %d type: %d)\n",bpp1,sl1,endian1,
|
||||||
|
((t_img *)im1)->type);
|
||||||
|
|
||||||
|
printf(" => Fill Image1 ...");
|
||||||
|
color_map_2(data1,bpp1,sl1,IM1_SX,IM1_SY,endian1, 1);
|
||||||
|
printf("OK (pixmap : %d)\n",(int)((t_img *)im1)->pix);
|
||||||
|
|
||||||
|
printf(" => Put Image1 ...");
|
||||||
|
mlx_put_image_to_window(mlx,win1,im1,20,20);
|
||||||
|
printf("OK\n");
|
||||||
|
sleep(2);
|
||||||
|
|
||||||
|
printf(" => Destroy Image1 ... ");
|
||||||
|
mlx_destroy_image(mlx, im1);
|
||||||
|
printf("OK\n");
|
||||||
|
sleep(2);
|
||||||
|
|
||||||
|
printf(" => Image3 ZPixmap %dx%d ...",IM3_SX,IM3_SY);
|
||||||
|
if (!(im3 = mlx_new_image(mlx,IM3_SX,IM3_SY)))
|
||||||
|
{
|
||||||
|
printf(" !! KO !!\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
data3 = mlx_get_data_addr(im3,&bpp3,&sl3,&endian3);
|
||||||
|
printf("OK (bpp3 %d, sizeline3 %d endian3 %d type %d)\n",bpp3,sl3,endian3,
|
||||||
|
((t_img *)im3)->type);
|
||||||
|
|
||||||
|
printf(" => Fill Image3 ...");
|
||||||
|
color_map_2(data3,bpp3,sl3,IM3_SX,IM3_SY,endian3, 1);
|
||||||
|
printf("OK (pixmap : %d)\n",(int)((t_img *)im3)->pix);
|
||||||
|
|
||||||
|
printf(" => Put Image3 ...");
|
||||||
|
mlx_put_image_to_window(mlx,win1,im3,20,20);
|
||||||
|
printf("OK\n");
|
||||||
|
sleep(2);
|
||||||
|
|
||||||
|
printf(" => String ...");
|
||||||
|
mlx_string_put(mlx,win1,5,WIN1_SY/2,0xFF99FF,"String output");
|
||||||
|
mlx_string_put(mlx,win1,15,WIN1_SY/2+20,0x00FFFF,"MinilibX test");
|
||||||
|
printf("OK\n");
|
||||||
|
sleep(2);
|
||||||
|
|
||||||
|
printf(" => Xpm from file ...");
|
||||||
|
if (!(im2 = mlx_xpm_file_to_image(mlx,"open.xpm",&xpm1_x,&xpm1_y)))
|
||||||
|
{
|
||||||
|
printf(" !! KO !!\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
data2 = mlx_get_data_addr(im2,&bpp2,&sl2,&endian2);
|
||||||
|
printf("OK (xpm %dx%d)(img bpp2: %d, sizeline2: %d endian: %d type: %d)\n",
|
||||||
|
xpm1_x,xpm1_y,bpp2,sl2,endian2,((t_img *)im2)->type);
|
||||||
|
sleep(2);
|
||||||
|
|
||||||
|
printf(" => Put xpm ...");
|
||||||
|
mlx_put_image_to_window(mlx,win1,im2,0,0);
|
||||||
|
mlx_put_image_to_window(mlx,win1,im2,100,100);
|
||||||
|
printf("OK\n");
|
||||||
|
sleep(2);
|
||||||
|
|
||||||
|
printf(" => 2nd window,");
|
||||||
|
win2 = mlx_new_window(mlx,WIN1_SX,WIN1_SY,"Title2");
|
||||||
|
if (!(im4 = mlx_new_image(mlx,IM3_SX, IM3_SY)))
|
||||||
|
{
|
||||||
|
printf(" !! KO !!\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
data4 = mlx_get_data_addr(im4,&bpp4,&sl4,&endian4);
|
||||||
|
color_map_2(data4,bpp4,sl4,IM3_SX,IM3_SY,endian4, 2);
|
||||||
|
|
||||||
|
printf(" 3rd window, Installing hooks ...");
|
||||||
|
win3 = mlx_new_window(mlx,WIN1_SX,WIN1_SY,"Title3");
|
||||||
|
mlx_expose_hook(win1,expose_win1,0);
|
||||||
|
mlx_mouse_hook(win1,mouse_win1,0);
|
||||||
|
mlx_key_hook(win1,key_win1,0);
|
||||||
|
mlx_expose_hook(win2,expose_win2,0);
|
||||||
|
mlx_mouse_hook(win2,mouse_win2,0);
|
||||||
|
mlx_key_hook(win2,key_win2,0);
|
||||||
|
mlx_key_hook(win3,key_win3,0);
|
||||||
|
|
||||||
|
mlx_hook(win3, MotionNotify, PointerMotionMask, mouse_win3, 0);
|
||||||
|
|
||||||
|
printf("OK\nNow in Loop. Just play. Esc in 3 to destroy, 1&2 to quit.\n");
|
||||||
|
|
||||||
|
mlx_loop(mlx);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int color_map_1(void *win,int w,int h)
|
||||||
|
{
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
int color;
|
||||||
|
|
||||||
|
x = w;
|
||||||
|
while (x--)
|
||||||
|
{
|
||||||
|
y = h;
|
||||||
|
while (y--)
|
||||||
|
{
|
||||||
|
color = (x*255)/w+((((w-x)*255)/w)<<16)+(((y*255)/h)<<8);
|
||||||
|
mlx_pixel_put(mlx,win,x,y,color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int color_map_2(unsigned char *data,int bpp,int sl,int w,int h,int endian, int type)
|
||||||
|
{
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
int opp;
|
||||||
|
int dec;
|
||||||
|
int color;
|
||||||
|
int color2;
|
||||||
|
unsigned char *ptr;
|
||||||
|
|
||||||
|
opp = bpp/8;
|
||||||
|
printf("(opp : %d) ",opp);
|
||||||
|
y = h;
|
||||||
|
while (y--)
|
||||||
|
{
|
||||||
|
ptr = data+y*sl;
|
||||||
|
x = w;
|
||||||
|
while (x--)
|
||||||
|
{
|
||||||
|
if (type==2)
|
||||||
|
color = (y*255)/w+((((w-x)*255)/w)<<16)
|
||||||
|
+(((y*255)/h)<<8);
|
||||||
|
else
|
||||||
|
color = (x*255)/w+((((w-x)*255)/w)<<16)+(((y*255)/h)<<8);
|
||||||
|
color2 = mlx_get_color_value(mlx,color);
|
||||||
|
dec = opp;
|
||||||
|
while (dec--)
|
||||||
|
if (endian==local_endian)
|
||||||
|
{
|
||||||
|
if (endian)
|
||||||
|
*(ptr+x*opp+dec) = ((unsigned char *)(&color2))[4-opp+dec];
|
||||||
|
else
|
||||||
|
*(ptr+x*opp+dec) = ((unsigned char *)(&color2))[dec];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (endian)
|
||||||
|
*(ptr+x*opp+dec) = ((unsigned char *)(&color2))[opp-1-dec];
|
||||||
|
else
|
||||||
|
*(ptr+x*opp+dec) = ((unsigned char *)(&color2))[3-dec];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
31
mlx/test/new_win.c
Normal file
31
mlx/test/new_win.c
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "mlx.h"
|
||||||
|
|
||||||
|
|
||||||
|
void *mlx;
|
||||||
|
void *win1;
|
||||||
|
void *win2;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int gere_mouse(int x,int y,int button,void*toto)
|
||||||
|
{
|
||||||
|
printf("Mouse event - new win\n");
|
||||||
|
mlx_destroy_window(mlx,win1);
|
||||||
|
win1 = mlx_new_window(mlx,random()%500,random()%500,"new win");
|
||||||
|
mlx_mouse_hook(win1,gere_mouse,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
srandom(time(0));
|
||||||
|
mlx = mlx_init();
|
||||||
|
win1 = mlx_new_window(mlx,300,300,"win1");
|
||||||
|
win2 = mlx_new_window(mlx,600,600,"win2");
|
||||||
|
mlx_mouse_hook(win1,gere_mouse,0);
|
||||||
|
mlx_mouse_hook(win2,gere_mouse,0);
|
||||||
|
mlx_loop(mlx);
|
||||||
|
}
|
||||||
1439
mlx/test/open.xpm
Normal file
1439
mlx/test/open.xpm
Normal file
File diff suppressed because it is too large
Load Diff
230
mlx/test/open24.xpm
Normal file
230
mlx/test/open24.xpm
Normal file
@@ -0,0 +1,230 @@
|
|||||||
|
/* XPM */
|
||||||
|
static char *open[] = {
|
||||||
|
/* width height num_colors chars_per_pixel */
|
||||||
|
" 45 55 168 2",
|
||||||
|
/* colors */
|
||||||
|
".. s None c None",
|
||||||
|
".# c #450304",
|
||||||
|
".a c #ce7e7c",
|
||||||
|
".b c #b94344",
|
||||||
|
".c c #b65254",
|
||||||
|
".d c #780204",
|
||||||
|
".e c #b04c4c",
|
||||||
|
".f c #b00204",
|
||||||
|
".g c #8a8a64",
|
||||||
|
".h c #969a24",
|
||||||
|
".i c #b6b60c",
|
||||||
|
".j c #cac614",
|
||||||
|
".k c #cece34",
|
||||||
|
".l c #cace54",
|
||||||
|
".m c #caca94",
|
||||||
|
".n c #c24e4c",
|
||||||
|
".o c #aa0204",
|
||||||
|
".p c #9e4244",
|
||||||
|
".q c #bc0204",
|
||||||
|
".r c #a40204",
|
||||||
|
".s c #9e262c",
|
||||||
|
".t c #8c3a3c",
|
||||||
|
".u c #5c1414",
|
||||||
|
".v c #5b0204",
|
||||||
|
".w c #700204",
|
||||||
|
".x c #722214",
|
||||||
|
".y c #b52624",
|
||||||
|
".z c #8e3234",
|
||||||
|
".A c #b60204",
|
||||||
|
".B c #c20204",
|
||||||
|
".C c #860204",
|
||||||
|
".D c #560304",
|
||||||
|
".E c #800204",
|
||||||
|
".F c #9e0204",
|
||||||
|
".G c #920204",
|
||||||
|
".H c #620204",
|
||||||
|
".I c #a41314",
|
||||||
|
".J c #996a6c",
|
||||||
|
".K c #920d09",
|
||||||
|
".L c #c80204",
|
||||||
|
".M c #690204",
|
||||||
|
".N c #980204",
|
||||||
|
".O c #984c4c",
|
||||||
|
".P c #e2dedc",
|
||||||
|
".Q c #ae5e5c",
|
||||||
|
".R c #bc6a6c",
|
||||||
|
".S c #a21a1c",
|
||||||
|
".T c #8a0a04",
|
||||||
|
".U c #671e1c",
|
||||||
|
".V c #941b1c",
|
||||||
|
".W c #b8b4b4",
|
||||||
|
".X c #e8e6e4",
|
||||||
|
".Y c #ccb4b4",
|
||||||
|
".Z c #c07c7c",
|
||||||
|
".0 c #f3f2eb",
|
||||||
|
".1 c #b49696",
|
||||||
|
".2 c #521614",
|
||||||
|
".3 c #9e5a5c",
|
||||||
|
".4 c #d4d4d4",
|
||||||
|
".5 c #a7a5a1",
|
||||||
|
".6 c #dec4c4",
|
||||||
|
".7 c #e4d6d4",
|
||||||
|
".8 c #f4f2f4",
|
||||||
|
".9 c #cccac4",
|
||||||
|
"#. c #9a161c",
|
||||||
|
"## c #8c0204",
|
||||||
|
"#a c #862c2c",
|
||||||
|
"#b c #7e5e5c",
|
||||||
|
"#c c #a39694",
|
||||||
|
"#d c #6b6667",
|
||||||
|
"#e c #322624",
|
||||||
|
"#f c #b09e9c",
|
||||||
|
"#g c #b23234",
|
||||||
|
"#h c #500304",
|
||||||
|
"#i c #222224",
|
||||||
|
"#j c #2e322c",
|
||||||
|
"#k c #925c5c",
|
||||||
|
"#l c #721a1c",
|
||||||
|
"#m c #6e6e6c",
|
||||||
|
"#n c #0a0a0c",
|
||||||
|
"#o c #b2b2b4",
|
||||||
|
"#p c #8e6264",
|
||||||
|
"#q c #884444",
|
||||||
|
"#r c #8c5c5c",
|
||||||
|
"#s c #121214",
|
||||||
|
"#t c #b2aeac",
|
||||||
|
"#u c #c21e1c",
|
||||||
|
"#v c #6e0e0c",
|
||||||
|
"#w c #623e3c",
|
||||||
|
"#x c #b64e4c",
|
||||||
|
"#y c #bc3634",
|
||||||
|
"#z c #624e1c",
|
||||||
|
"#A c #6e727c",
|
||||||
|
"#B c #824e4c",
|
||||||
|
"#C c #8b8d87",
|
||||||
|
"#D c #a09674",
|
||||||
|
"#E c #766844",
|
||||||
|
"#F c #7a663c",
|
||||||
|
"#G c #828c90",
|
||||||
|
"#H c #beb6a4",
|
||||||
|
"#I c #3a0204",
|
||||||
|
"#J c #8e9298",
|
||||||
|
"#K c #562529",
|
||||||
|
"#L c #7c3838",
|
||||||
|
"#M c #bab294",
|
||||||
|
"#N c #7e4644",
|
||||||
|
"#O c #929a9c",
|
||||||
|
"#P c #762a2c",
|
||||||
|
"#Q c #a60e0c",
|
||||||
|
"#R c #ae1e1c",
|
||||||
|
"#S c #460a0c",
|
||||||
|
"#T c #a6aaa4",
|
||||||
|
"#U c #6a4a4c",
|
||||||
|
"#V c #784c50",
|
||||||
|
"#W c #761214",
|
||||||
|
"#X c #9e1e1c",
|
||||||
|
"#Y c #988c90",
|
||||||
|
"#Z c #821e1c",
|
||||||
|
"#0 c #7a1618",
|
||||||
|
"#1 c #7a6e74",
|
||||||
|
"#2 c #7e7a77",
|
||||||
|
"#3 c #808688",
|
||||||
|
"#4 c #828284",
|
||||||
|
"#5 c #828279",
|
||||||
|
"#6 c #827a64",
|
||||||
|
"#7 c #7e765c",
|
||||||
|
"#8 c #864a34",
|
||||||
|
"#9 c #825a44",
|
||||||
|
"a. c #766e54",
|
||||||
|
"a# c #7e7e74",
|
||||||
|
"aa c #806464",
|
||||||
|
"ab c #7e724c",
|
||||||
|
"ac c #766634",
|
||||||
|
"ad c #765a2c",
|
||||||
|
"ae c #8e7e54",
|
||||||
|
"af c #a69e8c",
|
||||||
|
"ag c #c7c2ac",
|
||||||
|
"ah c #9a2a1c",
|
||||||
|
"ai c #aa3a3c",
|
||||||
|
"aj c #979894",
|
||||||
|
"ak c #70684c",
|
||||||
|
"al c #62522c",
|
||||||
|
"am c #6e5e3c",
|
||||||
|
"an c #92866c",
|
||||||
|
"ao c #968e6c",
|
||||||
|
"ap c #826e54",
|
||||||
|
"aq c #84765c",
|
||||||
|
"ar c #86522c",
|
||||||
|
"as c #7e4624",
|
||||||
|
"at c #7e3614",
|
||||||
|
"au c #6e5254",
|
||||||
|
"av c #712e2c",
|
||||||
|
"aw c #7a5654",
|
||||||
|
"ax c #82727c",
|
||||||
|
"ay c #a63634",
|
||||||
|
"az c #8a6a6c",
|
||||||
|
"aA c #863534",
|
||||||
|
"aB c #5c1a18",
|
||||||
|
"aC c #6a2c2c",
|
||||||
|
"aD c #5e0e14",
|
||||||
|
"aE c #868684",
|
||||||
|
"aF c #922624",
|
||||||
|
"aG c #901614",
|
||||||
|
"aH c #c21614",
|
||||||
|
"aI c #520e0c",
|
||||||
|
"aJ c #805654",
|
||||||
|
"aK c #b00c0c",
|
||||||
|
"aL c #c2221c",
|
||||||
|
/* pixels */
|
||||||
|
"..........................................................................................",
|
||||||
|
"..........................................................................................",
|
||||||
|
".....................................#.a.#................................................",
|
||||||
|
"...................................#.b.c.#.#.#.#...........#.d............................",
|
||||||
|
".................................#.e.f.f.#.g.h.i.j.k.l.m...f.n............................",
|
||||||
|
".................................d.f.o.f.#.#.#.d.d.#.#.#...f.f.d..........................",
|
||||||
|
".................................p.q.q.r.s.t.u.v.w.x.d.d.#.d.r.y.d........................",
|
||||||
|
".................................z.A.B.q.C.D.E.F.G.E.H.E.I.F.q.A.d........................",
|
||||||
|
".................................J.G.f.G.w.K.f.L.B.B.r.M.f.B.L.A.d........................",
|
||||||
|
".................................d.w.N.M.O.P.Q.B.B.o.R.S.E.q.q.T.d........................",
|
||||||
|
".................................d.U.M.V.W.X.Y.q.B.Z.0.1.E.r.N.d..........................",
|
||||||
|
".................................d.2.r.3.4.5.6.A.f.7.8.9#.###a.#..........................",
|
||||||
|
"................................#b.d.L#c#d#e#f.N.V.5#d.4#g.E.d............................",
|
||||||
|
"...............................d#h.r.L#f#i#j#k.M#l#m#n#o.b.r.d............................",
|
||||||
|
"...............................d#h##.q#g#p#q##.q.N#r#s#t#u.q#v.#..........................",
|
||||||
|
"..............#j................#w.w.C.r.q##.r.B.f.T#x#y.L.r.M.d..........................",
|
||||||
|
"............#j#z#j#A#A#j.........d.D.r.M.C.f.r.r.r.q.B.C.N.E#B............................",
|
||||||
|
"..........#j#C#D#E#z#F#G#j.......d.d.#.G##.w.M.M.C.C.d.G.r.u.d............................",
|
||||||
|
"....................#E#H#C#j.........d#I.w.F.f.o.o.o.N.M.#.d..............................",
|
||||||
|
"......................#E#j#J#j......#K.M.#.#.v.w.M.v.##h.H#L.d............................",
|
||||||
|
"..........................#M#j.......v.F.q.r.d.w.w.C.E.M.v.M#N.d..........................",
|
||||||
|
"..........................#E#O#j#j#K##.f.L.L.L.B.q.f##.M.v.w.w#P.d.#...d.d................",
|
||||||
|
"............................#C#E.#.v.o.B.L.L.q.q.q.q.N.M.D#h.M.N.r#Q#R#S.H.J.#............",
|
||||||
|
"............................#j#T#U.C.q.q.o.G.F.f.q.A.N.d.v.v##.o.q.L.r.C.A###k............",
|
||||||
|
"..............................#C#V.N.A.N.f.q.F.C.E.f.F.E.H#n#W.K.I#X#a.z.V.q.d#p.d........",
|
||||||
|
"................................#Y.r.K#Z.K.q.A.G.w#0#b#1#2#3#4#5#5#6#6#7#8.q.G#9..........",
|
||||||
|
"..................#j#oa..5#j..#J#Ja##4#4aa.o.A##.E.xabacadae#Daf#M#Magah.r.qai.#..........",
|
||||||
|
"................aja#akalamanaoapaqaaarasat.r.o.E.w.T.T.E.H.#...........#.d.d.#............",
|
||||||
|
"...........E....#j#j#C#M#j#n#naa#V.O.f.N.F.q.G.d.w.r.C.d.H.#...............#..............",
|
||||||
|
"...........#.F.F.J#n#n#n#n#n#nauav#p.q.N.d.d.w.M.F.F.E.d.U................................",
|
||||||
|
".........E.F.E.E.d.z#n.d#n#n#naw.Uax.r##.d.w.D.M.r.N.E.w.d................................",
|
||||||
|
".........E.F.......d.Fay.E.F#naz.2#A.D#h.r.f.w##.r##.d.H.M................................",
|
||||||
|
".........F.#...........E.E.F.baAaB#A.#.E.f.r.w.N.N.E.waC.#................................",
|
||||||
|
".........F.#...............d.F.E#K#d.H.G.F.G.w.N##.d.D.#..................................",
|
||||||
|
".........F.#....................#Aau.v.E##.w.E.E.w.H.d.......d..av.d......................",
|
||||||
|
".........E.#..................#j#GaC.M.H.M.d.d.w.H.#.d.d.#aC.w.C##.E.d....................",
|
||||||
|
"...........F.................5#O...#aD.w.d.w.H.D.M######.G.F.o.f.o.N.3....................",
|
||||||
|
"...........F.E...........5aEakak.....#.##h#h.v.N.o.f.q.L.L.L.L.L.q.faF....................",
|
||||||
|
"...........E.E......#E#C.5aq#j.....#.v.N.F.d.N.r.F.r.F#Q.I.o.q.L.L.L.y....................",
|
||||||
|
".............E.....................#.E.B.qaG.d.d.d.....#.#.....d#x.b......................",
|
||||||
|
".............E.F...................E.w.L.LaG.#............................................",
|
||||||
|
"...............E.E.................EaA.q.qaG.#............................................",
|
||||||
|
"...............E.F.E.................E.r.r#Z.#............................................",
|
||||||
|
".................E.F.E...............E.G.NaA..............................................",
|
||||||
|
".................E#uaH.................w.dav..............................................",
|
||||||
|
"...................E.E.............EaI.M.w.v.#............................................",
|
||||||
|
"...................................E.D.d.E.waJ............................................",
|
||||||
|
".....................................C.N.N##.M............................................",
|
||||||
|
"..................................#W.f.q.A.f.G#q..........................................",
|
||||||
|
".....................................q.L.L.L.q.V.#........................................",
|
||||||
|
"...................................#.daK.q.qaL.d..........................................",
|
||||||
|
".......................................#.#.#..............................................",
|
||||||
|
"..........................................................................................",
|
||||||
|
"..........................................................................................",
|
||||||
|
".........................................................................................."
|
||||||
|
};
|
||||||
1439
mlx/test/open30.xpm
Normal file
1439
mlx/test/open30.xpm
Normal file
File diff suppressed because it is too large
Load Diff
90
mlx/test/run_tests.sh
Executable file
90
mlx/test/run_tests.sh
Executable file
@@ -0,0 +1,90 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# This very basic script simulate user inputs for the CI
|
||||||
|
# Feel free to update, improve or remove it if proper
|
||||||
|
# intergration tests and/or unit tests are added.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
BOLD="\e[1m"
|
||||||
|
RESET="\e[0m"
|
||||||
|
LIGHT_RED="\e[91m"
|
||||||
|
LIGHT_GREEN="\e[92m"
|
||||||
|
LIGHT_CYAN="\e[96m"
|
||||||
|
|
||||||
|
logging(){
|
||||||
|
local type=$1; shift
|
||||||
|
printf "${LIGHT_CYAN}${BOLD}run_tests${RESET} [%b] : %b\n" "$type" "$*"
|
||||||
|
}
|
||||||
|
log_info(){
|
||||||
|
logging "${LIGHT_GREEN}info${RESET}" "$@"
|
||||||
|
}
|
||||||
|
log_error(){
|
||||||
|
logging "${LIGHT_RED}error${RESET}" "$@" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PID=""
|
||||||
|
|
||||||
|
# to properly kill child process executed in background on exit
|
||||||
|
at_exit() {
|
||||||
|
status=$?
|
||||||
|
[ $status -eq 0 ] && log_info "Seem all went well" && exit 0
|
||||||
|
# Code for non-zero exit:
|
||||||
|
if ! kill -s TERM "$PID" 2>/dev/null || ! wait "$PID" ; then
|
||||||
|
log_error "Pid [$PID] died with status $status "
|
||||||
|
fi
|
||||||
|
log_error "Something went wrong. Pid [$PID] has been killed. Status code $status"
|
||||||
|
}
|
||||||
|
# to properly quit from ctrl+c (SIGINT Signal)
|
||||||
|
sigint_handler(){
|
||||||
|
kill -s TERM "$PID"
|
||||||
|
wait
|
||||||
|
log_info "Tests abort"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# look at test/main.c and run ./mlx-test to understand what this function does
|
||||||
|
test_default_main(){
|
||||||
|
make -f Makefile.gen all
|
||||||
|
./mlx-test &
|
||||||
|
PID="$!"
|
||||||
|
log_info "./mlx-test running in background, pid:" $PID
|
||||||
|
|
||||||
|
i=25 # waiting 25s mlx-test to be ready for inputs.
|
||||||
|
while [ $i -gt 0 ]; do
|
||||||
|
if ! ps -p $PID > /dev/null ; then
|
||||||
|
wait $PID
|
||||||
|
fi
|
||||||
|
log_info "countdown" $i
|
||||||
|
sleep 1
|
||||||
|
i=$((i - 1))
|
||||||
|
done
|
||||||
|
log_info "Ready to \"just play\" using xdotool"
|
||||||
|
wid1=$(xdotool search --name Title1)
|
||||||
|
wid2=$(xdotool search --name Title2)
|
||||||
|
wid3=$(xdotool search --name Title3)
|
||||||
|
|
||||||
|
xdotool windowfocus $wid3
|
||||||
|
log_info "Focus Win3: Testing move mouse 100 100"
|
||||||
|
xdotool mousemove 100 100
|
||||||
|
log_info "Focus Win3: Testing move mouse 200 200"
|
||||||
|
xdotool mousemove 200 200
|
||||||
|
log_info "Focus Win3: Pressing escape to destroy window \"Win3\""
|
||||||
|
xdotool key Escape
|
||||||
|
|
||||||
|
log_info "Focus Win2: Pressing escape to stop program"
|
||||||
|
xdotool windowfocus $wid2
|
||||||
|
xdotool key Escape
|
||||||
|
}
|
||||||
|
|
||||||
|
main(){
|
||||||
|
cd $(dirname $0)
|
||||||
|
trap at_exit EXIT
|
||||||
|
trap sigint_handler INT
|
||||||
|
|
||||||
|
test_default_main
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
139
mlx_info
Normal file
139
mlx_info
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
/*
|
||||||
|
** mlx.h for MinilibX in
|
||||||
|
**
|
||||||
|
** Made by Charlie Root
|
||||||
|
** Login <ol@epitech.net>
|
||||||
|
**
|
||||||
|
** Started on Mon Jul 31 16:37:50 2000 Charlie Root
|
||||||
|
** Last update Tue May 15 16:23:28 2007 Olivier Crouzet
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
** MinilibX - Please report bugs
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
** FR msg - FR msg - FR msg
|
||||||
|
**
|
||||||
|
** La MinilibX utilise 2 librairies supplementaires qu'il
|
||||||
|
** est necessaire de rajouter a la compilation :
|
||||||
|
** -lmlx -lXext -lX11
|
||||||
|
**
|
||||||
|
** La MinilibX permet le chargement des images de type Xpm.
|
||||||
|
** Notez que cette implementation est incomplete.
|
||||||
|
** Merci de communiquer tout probleme de chargement d'image
|
||||||
|
** de ce type.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef MLX_H
|
||||||
|
|
||||||
|
#define MLX_H
|
||||||
|
|
||||||
|
|
||||||
|
void *mlx_init();
|
||||||
|
/*
|
||||||
|
** needed before everything else.
|
||||||
|
** return (void *)0 if failed
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Basic actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
void *mlx_new_window(void *mlx_ptr, int size_x, int size_y, char *title);
|
||||||
|
/*
|
||||||
|
** return void *0 if failed
|
||||||
|
*/
|
||||||
|
int mlx_clear_window(void *mlx_ptr, void *win_ptr);
|
||||||
|
int mlx_pixel_put(void *mlx_ptr, void *win_ptr, int x, int y, int color);
|
||||||
|
/*
|
||||||
|
** origin for x & y is top left corner of the window
|
||||||
|
** y down is positive
|
||||||
|
** color is 0x00RRGGBB
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Image stuff
|
||||||
|
*/
|
||||||
|
|
||||||
|
void *mlx_new_image(void *mlx_ptr,int width,int height);
|
||||||
|
/*
|
||||||
|
** return void *0 if failed
|
||||||
|
** obsolete : image2 data is stored using bit planes
|
||||||
|
** void *mlx_new_image2(void *mlx_ptr,int width,int height);
|
||||||
|
*/
|
||||||
|
char *mlx_get_data_addr(void *img_ptr, int *bits_per_pixel,
|
||||||
|
int *size_line, int *endian);
|
||||||
|
/*
|
||||||
|
** endian : 0 = sever X is little endian, 1 = big endian
|
||||||
|
** for mlx_new_image2, 2nd arg of mlx_get_data_addr is number_of_planes
|
||||||
|
*/
|
||||||
|
int mlx_put_image_to_window(void *mlx_ptr, void *win_ptr, void *img_ptr,
|
||||||
|
int x, int y);
|
||||||
|
int mlx_get_color_value(void *mlx_ptr, int color);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
** dealing with Events
|
||||||
|
*/
|
||||||
|
|
||||||
|
int mlx_mouse_hook (void *win_ptr, int (*funct_ptr)(), void *param);
|
||||||
|
int mlx_key_hook (void *win_ptr, int (*funct_ptr)(), void *param);
|
||||||
|
int mlx_expose_hook (void *win_ptr, int (*funct_ptr)(), void *param);
|
||||||
|
|
||||||
|
int mlx_loop_hook (void *mlx_ptr, int (*funct_ptr)(), void *param);
|
||||||
|
int mlx_loop (void *mlx_ptr);
|
||||||
|
int mlx_loop_end (void *mlx_ptr);
|
||||||
|
|
||||||
|
/*
|
||||||
|
** hook funct are called as follow :
|
||||||
|
**
|
||||||
|
** expose_hook(void *param);
|
||||||
|
** key_hook(int keycode, void *param);
|
||||||
|
** mouse_hook(int button, int x,int y, void *param);
|
||||||
|
** loop_hook(void *param);
|
||||||
|
**
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Usually asked...
|
||||||
|
*/
|
||||||
|
|
||||||
|
int mlx_string_put(void *mlx_ptr, void *win_ptr, int x, int y, int color,
|
||||||
|
char *string);
|
||||||
|
void mlx_set_font(void *mlx_ptr, void *win_ptr, char *name);
|
||||||
|
void *mlx_xpm_to_image(void *mlx_ptr, char **xpm_data,
|
||||||
|
int *width, int *height);
|
||||||
|
void *mlx_xpm_file_to_image(void *mlx_ptr, char *filename,
|
||||||
|
int *width, int *height);
|
||||||
|
int mlx_destroy_window(void *mlx_ptr, void *win_ptr);
|
||||||
|
|
||||||
|
int mlx_destroy_image(void *mlx_ptr, void *img_ptr);
|
||||||
|
|
||||||
|
int mlx_destroy_display(void *mlx_ptr);
|
||||||
|
|
||||||
|
/*
|
||||||
|
** generic hook system for all events, and minilibX functions that
|
||||||
|
** can be hooked. Some macro and defines from X11/X.h are needed here.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int mlx_hook(void *win_ptr, int x_event, int x_mask,
|
||||||
|
int (*funct)(), void *param);
|
||||||
|
|
||||||
|
int mlx_do_key_autorepeatoff(void *mlx_ptr);
|
||||||
|
int mlx_do_key_autorepeaton(void *mlx_ptr);
|
||||||
|
int mlx_do_sync(void *mlx_ptr);
|
||||||
|
|
||||||
|
int mlx_mouse_get_pos(void *mlx_ptr, void *win_ptr, int *x, int *y);
|
||||||
|
int mlx_mouse_move(void *mlx_ptr, void *win_ptr, int x, int y);
|
||||||
|
int mlx_mouse_hide(void *mlx_ptr, void *win_ptr);
|
||||||
|
int mlx_mouse_show(void *mlx_ptr, void *win_ptr);
|
||||||
|
|
||||||
|
int mlx_get_screen_size(void *mlx_ptr, int *sizex, int *sizey);
|
||||||
|
|
||||||
|
#endif /* MLX_H */
|
||||||
BIN
sprites/.DS_Store
vendored
Normal file
BIN
sprites/.DS_Store
vendored
Normal file
Binary file not shown.
116
sprites/aqua.xpm
Normal file
116
sprites/aqua.xpm
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
/* XPM */
|
||||||
|
static char *c1f67d32801d43d7e1ed1a03a50a2cc5TuAZcpZWTSz177Kc[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"64 64 46 1 ",
|
||||||
|
" c #123838",
|
||||||
|
". c #123939",
|
||||||
|
"X c #133939",
|
||||||
|
"o c #133A3A",
|
||||||
|
"O c #133B3B",
|
||||||
|
"+ c #143C3C",
|
||||||
|
"@ c #143D3D",
|
||||||
|
"# c #143E3E",
|
||||||
|
"$ c #153E3E",
|
||||||
|
"% c #153F3F",
|
||||||
|
"& c #154040",
|
||||||
|
"* c #154141",
|
||||||
|
"= c #164141",
|
||||||
|
"- c #164242",
|
||||||
|
"; c #164343",
|
||||||
|
": c #164444",
|
||||||
|
"> c #174444",
|
||||||
|
", c #174545",
|
||||||
|
"< c #174646",
|
||||||
|
"1 c #174747",
|
||||||
|
"2 c #184848",
|
||||||
|
"3 c #184A4A",
|
||||||
|
"4 c #194B4B",
|
||||||
|
"5 c #194C4C",
|
||||||
|
"6 c #194D4D",
|
||||||
|
"7 c #1A4D4D",
|
||||||
|
"8 c #1A4E4E",
|
||||||
|
"9 c #1A4F4F",
|
||||||
|
"0 c #1A5050",
|
||||||
|
"q c #1B5151",
|
||||||
|
"w c #1B5252",
|
||||||
|
"e c #1B5353",
|
||||||
|
"r c #1C5353",
|
||||||
|
"t c #1C5454",
|
||||||
|
"y c #1C5555",
|
||||||
|
"u c #1D5656",
|
||||||
|
"i c #1E5A5A",
|
||||||
|
"p c #1E5B5B",
|
||||||
|
"a c #1F5C5C",
|
||||||
|
"s c #1F5E5E",
|
||||||
|
"d c #205F5F",
|
||||||
|
"f c #206060",
|
||||||
|
"g c #206161",
|
||||||
|
"h c #216161",
|
||||||
|
"j c #216262",
|
||||||
|
"k c #216363",
|
||||||
|
/* pixels */
|
||||||
|
"O%%%% %+ +++=== %%%=%+O =%%% %%%++O+=%%%OO%%%% %%%%%%O %% ",
|
||||||
|
"%sddd7 % + <djff, idff0O5fddd%%qqq0>Otffdi =ffdf=Oidsdq % % ",
|
||||||
|
"%dffj7 % + ,jdff, ifff0O5fffd%%qqqt> 0ffdi ,fffk, sdfft % ",
|
||||||
|
"%dffj8 % + ,fdff, iffftO5fddd% qqtt>Otfddd%,ffff, sffft % %",
|
||||||
|
"%fffk8 % ,jjff,%dffftO5fffd%+tt0t>Otjfjd%,kffk, ddfkd % %",
|
||||||
|
"%5588, X+=8752= 2555>O,2558%+>>>>&O18882O=5555%%2552= % ",
|
||||||
|
"O % +XX %XX XOOOOOOOOO % O.OO OOO O OOO OO O XX +",
|
||||||
|
"O % ,7877 OO %q0tt2OOO % +0t0t> O % %tttt% ,525< =dq8d+",
|
||||||
|
"+ + 2qqt0%O + ddfft O O&fffk5 % % ,fkff>O0ttt8X5ffff=",
|
||||||
|
" + %% 8tqq5OO +%ddfft %%OOOO&ffff5% % ,ffff>O000t7X5ffff=",
|
||||||
|
"+ % 8qqqq% % % ddddt O +ffff5 % O=fffk>+000t7X2fffd%",
|
||||||
|
" + % 2q8q5 % % %qdiiq % OO&iisi1OO % O=siis=O5005,X2diii%",
|
||||||
|
"+ + % % % % %%% OOOOOO++OOOO OOOO %OOOOOOOOOOOO %OO",
|
||||||
|
"%=,,,= =,,,= %,2,,% % %===&O+=>>>+O&====OO,2>>+O=>>>=O+===%O",
|
||||||
|
"+fjjk5 tfffd%,jffj, % % ,q0t0+&fffk6O6ttt0O,ffff>Osffkt 1ttq0%",
|
||||||
|
"=dddf5 tffdd ,ffjj, % ,ttt0++ffff6 1tq00 =ffff>Osfff0 >t000+",
|
||||||
|
"=dfff5 tjdjdX=ffff, %% ,tqq0%%ffff5O5tqq8%,ffff>+iffftO1t0t0+",
|
||||||
|
"+dffj8 tjjfd =kffk, % ,tqt0+%fffk2 2tqtq ,kffk>+sffftO>tt0t+",
|
||||||
|
"%,,,,= =<<,, %,,2,% % OO%%===O ,=,,=O%==== %,,>=++=>>>=OO+&&&+",
|
||||||
|
" % % % % %+ OOOOOOO% OOOOOOOO % OOOOOOOOOOOOOOOO",
|
||||||
|
"%tddd2 % >idis> 8q882O2ddtd%%iiis2O15005% OO O2500> 1sppp+",
|
||||||
|
"%ddff8 % % ,ffdf,%8qqt2 5fddd%%dfdf5O2t0t5 %OOOO0t0t5O0fffs&",
|
||||||
|
"%dfff8 % ,ffff, 0qqt5O5fddd%%ffff5O5tt00 % %OO O50tt5O6ffff+",
|
||||||
|
"%fffjq %% ,kkff, 0tqt5O5ffff%%ffff5 500t0% OOO0tt01 6kfff&",
|
||||||
|
"%tttd=X + =tttt=O77,8,+,dttt%%0ttt2 ,252, % OO1151>O>tt0t+",
|
||||||
|
" % + + OO O X % OOOO % OO OOOOOOO OO",
|
||||||
|
" % X=7787 %5555%O % X+8558 % %% 25552 %5555=O1566>O%>1>>O",
|
||||||
|
" % Xdfddd%,kfff, % % X8jfff% % tfffd%,fffk>OskfktO>ttt0+",
|
||||||
|
"% + +Xqffdd ,ffff, +7dddd%+ + %% qfffi ,fffk,%isfft.100t0+",
|
||||||
|
"% + + X8ffdt ,ffff, %% + 7jfdd% + + Xdfffd%,fdff, sffftO>tt00+",
|
||||||
|
" + + + dfddd ,ddfd>O +7jddd%+ + X8ffdi ,dddd, ifff0O>t000&",
|
||||||
|
" + + ++=%%% %%%==OO %% + ++%%% + + % %%%% %%%%% +&&++O++&++O",
|
||||||
|
"O=+++OO% %%%% % % %%==OO+=%%+O++%%% %%%%% %%+%+O% % =+++%",
|
||||||
|
"+0000>O2qqq5 Oiddf0O5fdss%+qqqq, tffdi%=q000=O % 8fjdd+",
|
||||||
|
"+00tt>O2tqqq% %OOidfftO5fddd%+qqqt, tfffiO=0t0t=O% +8ffff+",
|
||||||
|
"%0t0t1O1tqq5% OO O%ifffq 5fffs%+ttqt, tfffiO%0qt0+O % + 7dfff=",
|
||||||
|
"+tt0t>O6ttt5OO % % dffft 5ffff=%tqqt>Otffkd =qqt0=OOO %% 8kfff=",
|
||||||
|
"+>>1>+O=>11>OOOO % 28852O,5525%O,,,,=O>5555 %,7>1O O % =8822%",
|
||||||
|
"OOOOOOOO OOOOOO+XX % % O OOO XOOOO XX% OOOO %",
|
||||||
|
"Ott0t> 6ttt5O=ttqd= % =5522% OO OOO2ttqq% OOOO8ttt8 2ttqq%",
|
||||||
|
"+fffk5OtffkiO>ffdf, % % % ,qttq%O ddffd %%O OOsffkt 5ffff=",
|
||||||
|
"=ffff5OtfffsO>ffff2 % ,tqq5%O % %qdddi% OOOOsffft 5ffff=",
|
||||||
|
"+sfsk5 0fsdsO>fffd= % % ,qqqq% % XXXdfddi% OOissft 8fffd%",
|
||||||
|
"+ssis1O0siitO=sidd= % ,q005% %XXXqsidt %% OOtsiiq 5diii%",
|
||||||
|
"OOOOOOOO%OOO % O % % % % OO % % OOOO% % %OO ",
|
||||||
|
"O&&&=+O=,,=> % % OO===== =,<,, %,,,,=% OO% %,2,,% ==%=% OOOO",
|
||||||
|
"+00tt> 0ffdi% % OO5tqt2 8jjjj++fffj8X O ,kfff, 8tqq2 % ",
|
||||||
|
"+0t0t>Otffdd% % O%0tqq2X7fdjd=+jfff8X % ,ffff,%qqtt8 % % ",
|
||||||
|
"&00tt, tfffs OO % qqtt5O2fdjd+=ffff5 OOO1ffff,%000t1OOO ",
|
||||||
|
"+tt0t2 tkffi%O %0t002O5fjjd+%ffff5 O% O>fffk, 0ttt1O OOO% ",
|
||||||
|
"O&=&=+%=,,,= % OO===%%O=><<, ,,,,=OO OOO+>>,,% +=&&=OOO % ",
|
||||||
|
"OOO+ % %% % OOOO %OOOOO %% % O% %OOOOOO % OOOOOOOO % ",
|
||||||
|
"OOOO qisit ,disi>O5q8q>O % %iiid2O0distO+00q8%Otisi0O2ddii%",
|
||||||
|
"OO O tfffs ,fdff>Oqqqq2O %% %dfdf5O0ddfiO&0tqt=OsffkqO5fdfd%",
|
||||||
|
" OO% tffdi%,ffff,%5qqt2 %% =ffff5OtfffsO=tqqq=OiffftO5kffd%",
|
||||||
|
"OOO %tfffiO,ffff, 0tqq5 %% %ffff5OtfffiO=tqtt=Oiffft 5ffff%",
|
||||||
|
" OOOO O6tt00%=tqqt= 2877, % OO%0qtt2O20tt5 =2577=+qqqd5O2tttt%",
|
||||||
|
"OOOO OOOOO OO OXX % OOO OO % OOOO% OOX XX O ",
|
||||||
|
"O=>>>%O>5555O=5578=+% %% ,8852% 5555>O=>1,>O%5572= % OX=8555%",
|
||||||
|
"%0ttt>OtfffsO,ffjj, 8kffd%%fffk2O2t0t0O=fffj, % O 5fffd%",
|
||||||
|
"+0t0t>OtfffiO,ffdf, + % 8jdfd%%dfff5O5tqq0 ,ffff, % %5ffff=",
|
||||||
|
"+00tt> 0fffiO=ffdj, + % 7jddd%%dfff5O2tqq0%,ffff, % 5fffd%",
|
||||||
|
"+0qq0>O0ffsiO>ffjd< + % 7dsds%%sddf5O2qq88 ,dddf, % % 5fddd%",
|
||||||
|
"O+%%%OO+%=%%OO%==+++ +% %%%%OO%%%= % % %%% ==+= % % % %%%%O"
|
||||||
|
};
|
||||||
173
sprites/bloc.xpm
Normal file
173
sprites/bloc.xpm
Normal file
@@ -0,0 +1,173 @@
|
|||||||
|
/* XPM */
|
||||||
|
static char *_6c0d55eee6d420ac6954b8c76f1ce0b4JoSTo18vHzYcnLh[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"64 64 103 2 ",
|
||||||
|
" c #5D1E16",
|
||||||
|
". c #5E1E16",
|
||||||
|
"X c #5E1E17",
|
||||||
|
"o c #5E1F17",
|
||||||
|
"O c #5F1F17",
|
||||||
|
"+ c #612018",
|
||||||
|
"@ c #622118",
|
||||||
|
"# c #622119",
|
||||||
|
"$ c #622219",
|
||||||
|
"% c #632219",
|
||||||
|
"& c #642319",
|
||||||
|
"* c #652319",
|
||||||
|
"= c #65231A",
|
||||||
|
"- c #65241A",
|
||||||
|
"; c #66241A",
|
||||||
|
": c #69271C",
|
||||||
|
"> c #6A271C",
|
||||||
|
", c #6A271D",
|
||||||
|
"< c #6A281D",
|
||||||
|
"1 c #6C291D",
|
||||||
|
"2 c #6D291D",
|
||||||
|
"3 c #6C291E",
|
||||||
|
"4 c #6C2A1E",
|
||||||
|
"5 c #6D2A1E",
|
||||||
|
"6 c #6F2A1E",
|
||||||
|
"7 c #712C1F",
|
||||||
|
"8 c #712D20",
|
||||||
|
"9 c #742E20",
|
||||||
|
"0 c #763022",
|
||||||
|
"q c #773122",
|
||||||
|
"w c #783123",
|
||||||
|
"e c #783224",
|
||||||
|
"r c #793324",
|
||||||
|
"t c #7B3525",
|
||||||
|
"y c #7D3524",
|
||||||
|
"u c #7F3625",
|
||||||
|
"i c #7E3827",
|
||||||
|
"p c #803625",
|
||||||
|
"a c #803726",
|
||||||
|
"s c #803826",
|
||||||
|
"d c #823927",
|
||||||
|
"f c #813928",
|
||||||
|
"g c #813A28",
|
||||||
|
"h c #843A28",
|
||||||
|
"j c #853B28",
|
||||||
|
"k c #873C29",
|
||||||
|
"l c #863C2A",
|
||||||
|
"z c #883C29",
|
||||||
|
"x c #8A3E2B",
|
||||||
|
"c c #89402C",
|
||||||
|
"v c #8A402C",
|
||||||
|
"b c #8A412C",
|
||||||
|
"n c #8B412D",
|
||||||
|
"m c #8D412C",
|
||||||
|
"M c #8E422D",
|
||||||
|
"N c #8F422D",
|
||||||
|
"B c #8D432E",
|
||||||
|
"V c #8E432E",
|
||||||
|
"C c #8F432E",
|
||||||
|
"Z c #8E442E",
|
||||||
|
"A c #8E442F",
|
||||||
|
"S c #91442E",
|
||||||
|
"D c #91442F",
|
||||||
|
"F c #90452F",
|
||||||
|
"G c #91452F",
|
||||||
|
"H c #92452F",
|
||||||
|
"J c #904530",
|
||||||
|
"K c #914630",
|
||||||
|
"L c #944831",
|
||||||
|
"P c #954831",
|
||||||
|
"I c #954932",
|
||||||
|
"U c #964932",
|
||||||
|
"Y c #954A32",
|
||||||
|
"T c #964A33",
|
||||||
|
"R c #964B33",
|
||||||
|
"E c #974B33",
|
||||||
|
"W c #984B33",
|
||||||
|
"Q c #984C33",
|
||||||
|
"! c #984C34",
|
||||||
|
"~ c #994C34",
|
||||||
|
"^ c #994D34",
|
||||||
|
"/ c #9A4D34",
|
||||||
|
"( c #9A4D35",
|
||||||
|
") c #9A4E35",
|
||||||
|
"_ c #9B4E35",
|
||||||
|
"` c #9C4D34",
|
||||||
|
"' c #9E4F36",
|
||||||
|
"] c #9E5036",
|
||||||
|
"[ c #9E5037",
|
||||||
|
"{ c #9F5137",
|
||||||
|
"} c #A15237",
|
||||||
|
"| c #A05238",
|
||||||
|
" . c #A15238",
|
||||||
|
".. c #A35439",
|
||||||
|
"X. c #A45439",
|
||||||
|
"o. c #A45539",
|
||||||
|
"O. c #A4553A",
|
||||||
|
"+. c #A5553A",
|
||||||
|
"@. c #A5563A",
|
||||||
|
"#. c #A6573B",
|
||||||
|
"$. c #A7573B",
|
||||||
|
"%. c #A8573B",
|
||||||
|
"&. c #A8583B",
|
||||||
|
/* pixels */
|
||||||
|
"O O O O o O o O O O O O O O O O O O O O O O O O O O O O O O O O O o O O O o O O o O O o o ",
|
||||||
|
"O # : < 4 < < < < < < 5 < < < < 5 < < < < < < 5 < < < < 5 < < < < < < 5 < < < < 5 < < < < < 5 5 < < < > 5 5 > < < > 5 5 < > # o ",
|
||||||
|
"O : i b c c x b c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c i > O ",
|
||||||
|
"O 5 b / ! ! ! Q ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! Q ! ! ! ! ! ! ! ! ! ! ! Q ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! c < O ",
|
||||||
|
" < c ! ! / Q Q Q Q Q Q ! Q Q Q Q Q Q Q Q Q Q Q ! ! / E Q Q Q Q Q Q Q Q ! ! / E Q Q Q Q W / E / E E ! ! W E ! ! E E Q / ! c 4 o ",
|
||||||
|
"O < c ! / E E E E E E E / E E E E E E E E E E E E W E E E E E E E E E E W E E E E E E Q ! _ ! ! _ ! _ ! _ ! _ ! ! / Q / ! c 5 O ",
|
||||||
|
"O < b ! E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E ! _ .+.+...+.......+.......+.} ! ! Q b 5 O ",
|
||||||
|
" < b W Q E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E / ! ] +.+.+.&.%.$.$.&.$.$.%.&...! E ! x < ",
|
||||||
|
"O 5 c ! / E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E Q ! _ _ ] $.&.$.$.$.$.$.$.&..._ ! ! c 5 O ",
|
||||||
|
"O < g K E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E ! { O.$.&.$.$.$.$.+...! W ! c < O ",
|
||||||
|
"O # 8 i Z E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E ! { O.&.$.$.$.$.&...! ! ! c < O ",
|
||||||
|
"O @ < e M ! E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E ! { ..$.$.$.$.&..._ ! ! x < O ",
|
||||||
|
"O # : r Z ! / E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E ! ] +.&.&.$.#...! / ! c < O ",
|
||||||
|
"O # > r c E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E ! ! ] +.&.$.#.+._ ! ! c < O ",
|
||||||
|
"# # > q l H E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E ! W ! } +.&.&.+.! ! ! c < O ",
|
||||||
|
"o # < 9 d M K E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E W ! ! ] +.&. .! Q ! c < O ",
|
||||||
|
"o # < q g M K W E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E / ] +.+._ / / c < O ",
|
||||||
|
"# # : q g S P W E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E ! +...! / E c < O ",
|
||||||
|
"O # < q d S P E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E ! ! ..+.! ! ! c < O ",
|
||||||
|
"O # < q h M P E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E / ! } { ! ! ! c < O ",
|
||||||
|
"o # 5 9 h M P E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E / ! ! Q Q ! c < O ",
|
||||||
|
"O # > w h S P E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E ! E E Q ! c < O ",
|
||||||
|
"O # > 9 h M P E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E ! W E Q ! c < O ",
|
||||||
|
"o = 2 w h M P E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E Q ! c < O ",
|
||||||
|
"o = 8 y x m L / E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E Q Q c < O ",
|
||||||
|
"o = 9 u h M E ! Q E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E Q ! c < O ",
|
||||||
|
"O = 9 u x H ] } ! E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E ! c < O ",
|
||||||
|
"O = 9 u l H ...! E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E / ! c < O ",
|
||||||
|
"O # 9 u h P } +.] Q E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E Q ! c < O ",
|
||||||
|
"o = 9 u h H } +.! Q E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E Q ! c < O ",
|
||||||
|
"o = 9 u x H } +._ Q E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E Q ! c < O ",
|
||||||
|
"o = 9 u h H } +._ ! E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E Q ! c < O ",
|
||||||
|
"O ; 7 u k H } o.! E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E Q ! c < O ",
|
||||||
|
"O : 7 u k H } o._ E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E Q ! c < O ",
|
||||||
|
"O = 9 d k H } o._ / E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E Q ! c < O ",
|
||||||
|
"O = 7 u k H } o.! E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E Q ! c < O ",
|
||||||
|
"O ; 7 u k H } o._ E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E Q ! c < O ",
|
||||||
|
"O # 7 u k H } o._ / E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E Q ! c < O ",
|
||||||
|
"o ; 9 d k H } +.! E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E Q ! c < O ",
|
||||||
|
"O ; 7 u l H } +._ E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E Q ! c < O ",
|
||||||
|
"O ; 9 u l H } o._ / E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E Q ! c < O ",
|
||||||
|
"O ; 9 u x H } o.! E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E Q ! c < O ",
|
||||||
|
"O ; 8 u k H } o._ / E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E Q ! c < O ",
|
||||||
|
" # 9 p k H } o.! E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E Q ! c < O ",
|
||||||
|
"o ; 7 u k H } o._ ! / E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E Q ! c < O ",
|
||||||
|
"O ; 9 p k H } o.! Q E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E Q ! c < O ",
|
||||||
|
"O ; 7 d k H } o._ ! E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E Q ! c < O ",
|
||||||
|
"O ; 7 u k H } o.! E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E Q ! c < O ",
|
||||||
|
"O ; 8 p k H } o./ Q E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E Q ! c < O ",
|
||||||
|
" # 9 u k H } o.! Q E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E Q ! c < O ",
|
||||||
|
"O ; 9 u k H } o.] Q E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E Q ! c < O ",
|
||||||
|
"O ; 9 u k H } o.! / E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E Q ! c < O ",
|
||||||
|
"O # 9 p x H } o.! E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E Q ! c < O ",
|
||||||
|
"o ; 8 u h H } +.! E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E Q ! c < O ",
|
||||||
|
"o ; 8 u x H } +.] E Q Q Q Q E E / E E / E E / Q E / E / E / Q E E E E E E E E E E E E E E E E E E E E E E E E E E E E Q ! c < O ",
|
||||||
|
"o # q u h H } +. .! _ _ ! ] ! ! _ _ ! _ _ ! ! / ! _ ! _ ! ! Q Q E E E E E E E E E E E E E E E E E E E E E E E E E E E Q ! c < O ",
|
||||||
|
"O ; 7 p z H } #.+.+.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.+.+.+. .! E E E E E E E E E W W E E E E E E E E E E E E E E E E E Q Q c < O ",
|
||||||
|
"O : 7 p h H _ ] ] o.} } } } } } } } } } } } } } } } } } ._ / L K E E W W W W W W W W W W W E Q E E E Q E E E E E E E E ! c < O ",
|
||||||
|
"O = 7 h x m H H H H H H H H H H H H H H H H H H H H H H H H M M M H E W ! ! ! / W ! ! W ! ! / ! Q Q ! Q E E Q Q E E E / ! c < O ",
|
||||||
|
"O = 7 p h z x l l l x k k k k k k k x l k k k k k k h x l l x l l x M Z Z Z M M A M A A M Z M M Z M Z J L Q Q / Q Q Q ! ! c < O ",
|
||||||
|
"O ; 7 u u p u u p d u d u d p u p u u u p d u d u d u u u u u u p d d i t e t r e e t e t e e e e e e g L ! ! ! ! Q Q / ! c 4 o ",
|
||||||
|
"O @ 7 7 9 9 9 9 7 7 7 7 7 7 9 7 9 8 9 9 7 7 7 7 7 9 7 7 9 8 9 9 7 9 7 7 < < > > > > > > > > < > < > > 8 g c c c c c b b c d : o ",
|
||||||
|
"O @ * ; = # ; ; ; ; # ; ; ; ; ; # ; ; ; ; ; # ; ; # : ; # ; ; = ; ; # = # # # # # # # # # # # # # # # = ; < < < < < < < 5 ; # o ",
|
||||||
|
"O O O O O O O O o O O O O o O O O O o O O O O O O O O O O O O O O O O O O O O O O o o O O O O O O O O O O O o O O O O @ "
|
||||||
|
};
|
||||||
140
sprites/cursor.xpm
Normal file
140
sprites/cursor.xpm
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
/* XPM */
|
||||||
|
static char *_623287173762[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"20 20 114 2 ",
|
||||||
|
" c black",
|
||||||
|
". c #010101",
|
||||||
|
"X c #020202",
|
||||||
|
"o c gray1",
|
||||||
|
"O c gray3",
|
||||||
|
"+ c gray4",
|
||||||
|
"@ c #0B0B0B",
|
||||||
|
"# c #0E0E0E",
|
||||||
|
"$ c #101010",
|
||||||
|
"% c #111111",
|
||||||
|
"& c gray7",
|
||||||
|
"* c gray8",
|
||||||
|
"= c #161616",
|
||||||
|
"- c #191919",
|
||||||
|
"; c #1B1B1B",
|
||||||
|
": c #1E1E1E",
|
||||||
|
"> c #222222",
|
||||||
|
", c #252525",
|
||||||
|
"< c gray15",
|
||||||
|
"1 c #272727",
|
||||||
|
"2 c #2A2A2A",
|
||||||
|
"3 c gray17",
|
||||||
|
"4 c #2F2F2F",
|
||||||
|
"5 c gray20",
|
||||||
|
"6 c gray21",
|
||||||
|
"7 c #373737",
|
||||||
|
"8 c gray22",
|
||||||
|
"9 c gray24",
|
||||||
|
"0 c #3F3F3F",
|
||||||
|
"q c gray25",
|
||||||
|
"w c #414141",
|
||||||
|
"e c gray26",
|
||||||
|
"r c gray27",
|
||||||
|
"t c #464646",
|
||||||
|
"y c gray28",
|
||||||
|
"u c #484848",
|
||||||
|
"i c #494949",
|
||||||
|
"p c #4B4B4B",
|
||||||
|
"a c #515151",
|
||||||
|
"s c gray32",
|
||||||
|
"d c #535353",
|
||||||
|
"f c #555555",
|
||||||
|
"g c #565656",
|
||||||
|
"h c gray34",
|
||||||
|
"j c #585858",
|
||||||
|
"k c gray35",
|
||||||
|
"l c #5B5B5B",
|
||||||
|
"z c gray39",
|
||||||
|
"x c #656565",
|
||||||
|
"c c DimGray",
|
||||||
|
"v c gray42",
|
||||||
|
"b c gray44",
|
||||||
|
"n c #717171",
|
||||||
|
"m c #727272",
|
||||||
|
"M c gray45",
|
||||||
|
"N c #747474",
|
||||||
|
"B c gray46",
|
||||||
|
"V c #797979",
|
||||||
|
"C c #7B7B7B",
|
||||||
|
"Z c #7C7C7C",
|
||||||
|
"A c #7E7E7E",
|
||||||
|
"S c gray50",
|
||||||
|
"D c #838383",
|
||||||
|
"F c gray52",
|
||||||
|
"G c #868686",
|
||||||
|
"H c gray53",
|
||||||
|
"J c #8B8B8B",
|
||||||
|
"K c #8D8D8D",
|
||||||
|
"L c #8E8E8E",
|
||||||
|
"P c gray56",
|
||||||
|
"I c gray57",
|
||||||
|
"U c #929292",
|
||||||
|
"Y c #939393",
|
||||||
|
"T c gray59",
|
||||||
|
"R c #979797",
|
||||||
|
"E c #9F9F9F",
|
||||||
|
"W c gray63",
|
||||||
|
"Q c #A4A4A4",
|
||||||
|
"! c gray68",
|
||||||
|
"~ c #B6B6B6",
|
||||||
|
"^ c gray74",
|
||||||
|
"/ c gray77",
|
||||||
|
"( c #C5C5C5",
|
||||||
|
") c #C8C8C8",
|
||||||
|
"_ c gray79",
|
||||||
|
"` c #CDCDCD",
|
||||||
|
"' c #D0D0D0",
|
||||||
|
"] c gray82",
|
||||||
|
"[ c #D2D2D2",
|
||||||
|
"{ c gray83",
|
||||||
|
"} c #D5D5D5",
|
||||||
|
"| c gray84",
|
||||||
|
" . c gray86",
|
||||||
|
".. c #DDDDDD",
|
||||||
|
"X. c gray87",
|
||||||
|
"o. c #E2E2E2",
|
||||||
|
"O. c gray89",
|
||||||
|
"+. c #E6E6E6",
|
||||||
|
"@. c #E7E7E7",
|
||||||
|
"#. c #F1F1F1",
|
||||||
|
"$. c gray95",
|
||||||
|
"%. c #F3F3F3",
|
||||||
|
"&. c #F4F4F4",
|
||||||
|
"*. c gray96",
|
||||||
|
"=. c #F6F6F6",
|
||||||
|
"-. c #F8F8F8",
|
||||||
|
";. c #F9F9F9",
|
||||||
|
":. c gray98",
|
||||||
|
">. c #FBFBFB",
|
||||||
|
",. c gray99",
|
||||||
|
"<. c #FDFDFD",
|
||||||
|
"1. c #FEFEFE",
|
||||||
|
"2. c white",
|
||||||
|
"3. c None",
|
||||||
|
/* pixels */
|
||||||
|
"3.3.3.3.3.3.3. 3.3.3.3.3.3.3.3.3.3.3.",
|
||||||
|
"3.3.3.3.3.3.5 Z Z q 3.3.3.3.3.3.3.3.3.3.",
|
||||||
|
"3.3.3.3.3. q -.2.j 3.3.3.3.3.3.3.3.3.",
|
||||||
|
"3.3.3.3.3. q *.2.h 3.3.3.3.3.3.3.3.3.",
|
||||||
|
"3.3.3.3.3. q *.2.j 3.3.3.3.3.3.3.3.3.",
|
||||||
|
"3.3.3.3.3. q *.2.j 3.3.3.3.",
|
||||||
|
"3.3.3.3.3. q *.-.j 2 U U 2 6 Z % 3.3.",
|
||||||
|
"3.3.3.3.3. q *.-.h y 2.2.u j ` % 0 y 3.",
|
||||||
|
"3.3 8 6 3. q *.2.V b -.2.v Z | y ^ G ",
|
||||||
|
" b %.X.0 @ q *.2.*.%.2.2.%.*.2.%.-.D ",
|
||||||
|
" B -.-. .s q *.2.-.-.2.*.2.-.*.2.2.D ",
|
||||||
|
"3.5 v *.2.) ^ -.-.Z V X.s ~ ! j @.2.D ",
|
||||||
|
"3.3.< B X.2.2.2.-.s u [ = E U - X.2.G ",
|
||||||
|
"3.3.3.@ ( 2.2.2.2.h p [ - W U : .^ z ",
|
||||||
|
"3.3.3.# W @.2.2.2.s u [ - W Y : | y 3.",
|
||||||
|
"3.3.3.3.% G %.2.2.j s | < Q Y < ) y 3.",
|
||||||
|
"3.3.3.3.3.< x *.2.[ ` %./ o.@.E 6 3.3.3.",
|
||||||
|
"3.3.3.3.3.3.< v o.2.2.2.2.L Y [ % 3.3.3.",
|
||||||
|
"3.3.3.3.3.3.3.@ b U L L J 6 0 b @ 3.3.3.",
|
||||||
|
"3.3.3.3.3.3.3. 3.3. 3.3.3."
|
||||||
|
};
|
||||||
191
sprites/dolphin.xpm
Normal file
191
sprites/dolphin.xpm
Normal file
@@ -0,0 +1,191 @@
|
|||||||
|
/* XPM */
|
||||||
|
static char *dfd3966d5d4d4d5bffe9e85b95d9f4b4B95T9PN1uFZux602[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"64 64 121 2 ",
|
||||||
|
" c None",
|
||||||
|
". c black",
|
||||||
|
"X c gray6",
|
||||||
|
"o c #161616",
|
||||||
|
"O c gray11",
|
||||||
|
"+ c gray32",
|
||||||
|
"@ c #646464",
|
||||||
|
"# c #0277BD",
|
||||||
|
"$ c #0579BE",
|
||||||
|
"% c #087BBF",
|
||||||
|
"& c #077BC0",
|
||||||
|
"* c #0B7DC1",
|
||||||
|
"= c #0F80C3",
|
||||||
|
"- c #1383C5",
|
||||||
|
"; c #1A87C6",
|
||||||
|
": c #1F89C7",
|
||||||
|
"> c #1887C8",
|
||||||
|
", c #1C8AC9",
|
||||||
|
"< c #228ECC",
|
||||||
|
"1 c #2591CE",
|
||||||
|
"2 c #2A92CE",
|
||||||
|
"3 c #3295CE",
|
||||||
|
"4 c #2B95D1",
|
||||||
|
"5 c #2F98D3",
|
||||||
|
"6 c #349CD5",
|
||||||
|
"7 c #399ED6",
|
||||||
|
"8 c #399FD8",
|
||||||
|
"9 c #3CA2D9",
|
||||||
|
"0 c #419ED3",
|
||||||
|
"q c #44A1D6",
|
||||||
|
"w c #42A6DC",
|
||||||
|
"e c #4CA6D9",
|
||||||
|
"r c #46A9DE",
|
||||||
|
"t c #49ABDF",
|
||||||
|
"y c #53ABDC",
|
||||||
|
"u c #58ADDD",
|
||||||
|
"i c #4CADE1",
|
||||||
|
"p c #4FB0E2",
|
||||||
|
"a c #54B3E4",
|
||||||
|
"s c #59B7E7",
|
||||||
|
"d c #5AB8E7",
|
||||||
|
"f c #5DBAE9",
|
||||||
|
"g c #62B5E1",
|
||||||
|
"h c #60B9E7",
|
||||||
|
"j c #6EBBE5",
|
||||||
|
"k c #62BEEB",
|
||||||
|
"l c #76BFE6",
|
||||||
|
"z c #66C0ED",
|
||||||
|
"x c #69C3EE",
|
||||||
|
"c c #77C0E7",
|
||||||
|
"v c #73C3EB",
|
||||||
|
"b c #7AC4EA",
|
||||||
|
"n c #7DC9EF",
|
||||||
|
"m c #6DC6F1",
|
||||||
|
"M c #6FC8F2",
|
||||||
|
"N c #71C7F2",
|
||||||
|
"B c #73CAF4",
|
||||||
|
"V c #74CAF4",
|
||||||
|
"C c #74CBF4",
|
||||||
|
"Z c #75CBF4",
|
||||||
|
"A c #75CCF5",
|
||||||
|
"S c #76CCF5",
|
||||||
|
"D c #77CDF5",
|
||||||
|
"F c #77CCF5",
|
||||||
|
"G c #72C9F3",
|
||||||
|
"H c #7ACBF3",
|
||||||
|
"J c #78CDF6",
|
||||||
|
"K c #78CEF6",
|
||||||
|
"L c #79CEF6",
|
||||||
|
"P c #7ACFF7",
|
||||||
|
"I c #7BCFF7",
|
||||||
|
"U c #7CCAF0",
|
||||||
|
"Y c #7BD0F7",
|
||||||
|
"T c #7CD0F7",
|
||||||
|
"R c #7CD0F8",
|
||||||
|
"E c #7CD1F8",
|
||||||
|
"W c #7DD1F8",
|
||||||
|
"Q c #959595",
|
||||||
|
"! c gray62",
|
||||||
|
"~ c #A5A5A4",
|
||||||
|
"^ c #AEADAD",
|
||||||
|
"/ c #82C6EA",
|
||||||
|
"( c #85CAEC",
|
||||||
|
") c #89CBED",
|
||||||
|
"_ c #81CCF1",
|
||||||
|
"` c #80CCF1",
|
||||||
|
"' c #89D0F2",
|
||||||
|
"] c #8ED1F2",
|
||||||
|
"[ c #8ED3F4",
|
||||||
|
"{ c #8ED3F4",
|
||||||
|
"} c #95D3F2",
|
||||||
|
"| c #9AD6F4",
|
||||||
|
" . c #9DD8F5",
|
||||||
|
".. c #A3DBF6",
|
||||||
|
"X. c #ABDEF7",
|
||||||
|
"o. c #A4DDF8",
|
||||||
|
"O. c #A8DFF8",
|
||||||
|
"+. c #B1DEF5",
|
||||||
|
"@. c #ACE1FA",
|
||||||
|
"#. c #B2E1F8",
|
||||||
|
"$. c #B3E5FC",
|
||||||
|
"%. c #BBE4F8",
|
||||||
|
"&. c #BCE4F8",
|
||||||
|
"*. c #B7E8FD",
|
||||||
|
"=. c #CBCAC9",
|
||||||
|
"-. c #CFCECD",
|
||||||
|
";. c #D7D5D4",
|
||||||
|
":. c #DAD8D8",
|
||||||
|
">. c #C6E9FA",
|
||||||
|
",. c #CEECFB",
|
||||||
|
"<. c #D9F2FE",
|
||||||
|
"1. c #DBF3FE",
|
||||||
|
"2. c #F1FBFF",
|
||||||
|
"3. c #F3FCFF",
|
||||||
|
"4. c #F6FCFF",
|
||||||
|
"5. c #F8F8F8",
|
||||||
|
"6. c #F9FAFA",
|
||||||
|
"7. c #FAFBFB",
|
||||||
|
"8. c #F9FBFC",
|
||||||
|
"9. c #F8FDFF",
|
||||||
|
"0. c #FBFDFF",
|
||||||
|
/* pixels */
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" $ # # # $ # # # # ",
|
||||||
|
" # $ $ = , 6 9 r r 9 4 > * $ # ",
|
||||||
|
" # # = , 6 9 i a f f x m N N t * # # ",
|
||||||
|
" # $ > 1 5 7 9 w i p s d x x w = $ ",
|
||||||
|
" # # $ # # # # # $ $ = , 1 1 5 7 9 w i p s s 2 $ # ",
|
||||||
|
" # # # & - > , < < 1 < , > = $ # $ * = , 1 5 7 9 w i t 1 $ ",
|
||||||
|
" # # & > 6 i f m M G C G C N m m f s i 5 , - & & - < 6 9 w < # ",
|
||||||
|
" $ # - 7 f C R J J S S S Z C C N C N N M M m x f i 5 - & = 1 < $ ",
|
||||||
|
" # = 9 m J W R J J J Z Z C C C M M N M m m m x x x x x f i , & & # ",
|
||||||
|
" $ $ 5 m W W R J D D Z Z C C G G M M M m m m x x x x x z x k x f i 1 * # ",
|
||||||
|
" # * i J W J R J Z Z Z Z C G G M M M m m m m x x x x z k k z k k f k f r , $ # ",
|
||||||
|
" # = a P J J J J S Z Z V C C G M M m m m m x x x x z z z x k k z k f f f f s 7 * # ",
|
||||||
|
" $ * a Y P J S S S Z Z G G G G m m M m x x x x x x k z z z f k f f f f f f f f a w - # ",
|
||||||
|
" $ t P P D S S Z Z G C G M M m m m m x x x x x k k k k f k k f k f f f f f s a f a r > # ",
|
||||||
|
" $ 5 Z P Z Z Z Z C N m C m m m m m x x x z z x x k k k k k f f f f f f s s s a f a a a i = & ",
|
||||||
|
" # - k D Z C C C C C M N m m m m x x x x z z z k k k k k k f f f f f s s s s s a a a a p p 9 = $ ",
|
||||||
|
" # 9 D Z Z C C m C m m m m m m x x z x z x z z k k k f f f f s f s s s s a a a a a a i p p p 5 $ ",
|
||||||
|
" # - x D C N C m m N m m m m x x x z z z z f f z k f k f f f f f s s s s a a a a p a p i i i i i 1 $ ",
|
||||||
|
" # 6 N N N N V N m m m x x m x k x z k x z k k f f f f f f s s f s s a a a a p p p i i i i i i i 9 = # ",
|
||||||
|
" $ a C N H #.1.1.O.m x x x k z x z z k f f k f f f f f f s f s a a a a a a p p i i i i i i w r i r 4 $ ",
|
||||||
|
" # > k N V >.5.=.-.5.%.m x x x k k z f k z f f f f f s s s f a a a a a p a i p i i i i r r w i w w r 9 - # ",
|
||||||
|
" # 4 m m [ 9.Q X o ~ 3.U z k z k k z f f f f f f s f f a s a a a a a p p p i i i i i i w i r w w w w w 1 # ",
|
||||||
|
" # 9 N m .7.+ . . @ 9.] k k k k k f k f f f f s s a a a a a a a i p p i i i i i w i i 9 i 9 i 9 9 9 w 6 & ",
|
||||||
|
" $ i m x ' 9.! o O ^ 2.n k k k f f f f f f s s s s s a a a a a i a i i i i i i i i 9 9 i w 9 w 9 9 9 9 9 - $ ",
|
||||||
|
" & a x x x &.7.;.:.9.+.k k k f f f f f f a s s a s a a a a p a i i i i i i w w i w i 9 i 9 i 9 9 9 9 9 8 , $ ",
|
||||||
|
" = f x x z x ..,.,.| k k f h f f d s f a d a s a a a a i p i i i i i i w r i w w w i 9 9 9 9 9 9 9 9 8 7 < $ ",
|
||||||
|
" $ - f x x k k k k k h h f f f d s s s a a a s a a p a i i i i i i r i w w i i w w 9 9 9 9 9 9 8 8 7 7 7 7 4 & ",
|
||||||
|
" # , k k k k k k k f f f f f f d s s s a a a a p p p i i i i i i i r i r w w 9 w 9 9 9 9 9 9 9 8 7 7 6 6 7 4 & ",
|
||||||
|
" # = t x x k k f f f f f f s a a s s a a a a p p p p i i i i r i r w r i 9 w w 9 w 9 9 9 9 9 9 8 8 7 6 6 6 6 4 * # ",
|
||||||
|
" # > a k f f f k x v H U _ U n x k s a a a a p p p i i i i i i r r r r w w w w 9 9 9 9 9 9 8 8 6 6 6 6 6 6 5 6 4 = # ",
|
||||||
|
" # - a k h x n ] ..@.#.$.$.$.$.$.#.O. .n h p i a i i r i r r r i w 8 5 9 9 w 9 9 9 9 9 8 8 7 9 6 6 6 6 6 5 5 5 5 4 = # ",
|
||||||
|
" $ w k x ] o.O.X.X.@.$.*.$.$.$.$.$.$.$.$.@.U i 5 9 i i i i i w r 9 = # & - < 6 9 9 9 9 8 8 6 6 6 6 6 5 5 5 5 5 4 4 * $ ",
|
||||||
|
" # < k _ } b y 3 < < 2 0 g ) ..@.#.$.$.O.| c 0 - $ * 9 i i w w w w 1 # # # * , 6 8 8 6 6 6 6 5 5 5 5 5 4 4 4 4 1 * # ",
|
||||||
|
" # 2 y 7 : * % ; : < : * % * : 3 0 0 7 2 - % & : $ 1 w r r w w w > # # # * < 7 6 6 6 6 5 5 5 5 4 4 4 1 1 1 & ",
|
||||||
|
" $ & * - < # # # # # # - w w w w 9 9 = # # $ 2 q 6 5 5 5 4 4 4 4 4 1 4 1 , $ ",
|
||||||
|
" & 7 w 9 w 9 8 * # # & e g 5 5 4 4 4 4 1 1 1 1 1 , $ ",
|
||||||
|
" # , 9 9 9 9 7 * # # % c v 5 1 4 1 1 1 1 1 < 1 - # ",
|
||||||
|
" # * 7 9 9 9 8 - # # 2 o.j 4 1 1 1 1 1 1 < < * # ",
|
||||||
|
" $ , 9 8 8 7 - # $ c @.e 1 1 1 , 1 , , , & # ",
|
||||||
|
" # $ 4 7 6 6 , # # 9 $.( 1 1 , 1 1 , < > $ ",
|
||||||
|
" # = 5 6 6 1 $ # : ..@.6 , , , , , , = # ",
|
||||||
|
" # # # = 4 6 1 $ - | *.e , , , , , , & # ",
|
||||||
|
" # # # $ = < 1 * $ % } #.u , > , > , = $ ",
|
||||||
|
" $ - $ # $ * $ # - | $.u > > > > > * # ",
|
||||||
|
" # , , # # # > ..#.q > > > > * $ ",
|
||||||
|
" # , 4 & # # 2 #.o.4 - > - - & # ",
|
||||||
|
" # - 6 > # # u *.( : - - - * $ ",
|
||||||
|
" # = 6 1 $ * ) *.u - - - = & $ ",
|
||||||
|
" # = 4 4 * # # 3 @.| < - - = * # ",
|
||||||
|
" # * 4 5 > # % / $.e = = = * # ",
|
||||||
|
" # = 4 4 , # # e X.j > = = * $ $ ",
|
||||||
|
" # > 4 4 < $ # # 2 | l > * = % $ # ",
|
||||||
|
" # $ < 4 1 1 > # # # : j e > % = % $ # ",
|
||||||
|
" # $ , 1 1 1 1 < > & # # % < : * * = % $ $ ",
|
||||||
|
" $ $ > 1 1 1 < , , , , * # # # $ $ = * * * * $ $ # ",
|
||||||
|
" # & > 1 1 < , - $ $ * - , > * $ # # # # # # # $ * * * = * * & $ # # ",
|
||||||
|
" # $ - , 1 < , = $ # $ # $ $ * - - - * * & $ % * * = * * * * $ # # ",
|
||||||
|
" # # * - - * & $ # $ # $ $ $ * * - = - - = = * * % $ $ # ",
|
||||||
|
" # # # # # $ # # # $ $ $ $ & $ $ # # # ",
|
||||||
|
" # # # # # # ",
|
||||||
|
" ",
|
||||||
|
" "
|
||||||
|
};
|
||||||
321
sprites/portal.xpm
Normal file
321
sprites/portal.xpm
Normal file
@@ -0,0 +1,321 @@
|
|||||||
|
/* XPM */
|
||||||
|
static char *_24165d269504ce0da038d7338d69c3aC25n2CrINeTAQhjh[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"64 64 251 2 ",
|
||||||
|
" c None",
|
||||||
|
". c #148E27",
|
||||||
|
"X c #158E28",
|
||||||
|
"o c #1A9527",
|
||||||
|
"O c #1E9A27",
|
||||||
|
"+ c #169128",
|
||||||
|
"@ c #1B9429",
|
||||||
|
"# c #1D9B28",
|
||||||
|
"$ c #169B29",
|
||||||
|
"% c #1D9D30",
|
||||||
|
"& c #239C27",
|
||||||
|
"* c #239D29",
|
||||||
|
"= c #26992B",
|
||||||
|
"- c #289C33",
|
||||||
|
"; c #2A8F24",
|
||||||
|
": c #1CA328",
|
||||||
|
"> c #1CAB29",
|
||||||
|
", c #18A628",
|
||||||
|
"< c #15BC2B",
|
||||||
|
"1 c #1BB92A",
|
||||||
|
"2 c #1AB32A",
|
||||||
|
"3 c #25A227",
|
||||||
|
"4 c #2BA527",
|
||||||
|
"5 c #2DAB26",
|
||||||
|
"6 c #24A228",
|
||||||
|
"7 c #2BA529",
|
||||||
|
"8 c #24AC28",
|
||||||
|
"9 c #2DAA29",
|
||||||
|
"0 c #25A827",
|
||||||
|
"q c #33AD26",
|
||||||
|
"w c #33AC29",
|
||||||
|
"e c #37AC29",
|
||||||
|
"r c #2DB227",
|
||||||
|
"t c #23BB29",
|
||||||
|
"y c #29B82A",
|
||||||
|
"u c #35B227",
|
||||||
|
"i c #3BB426",
|
||||||
|
"p c #3CBA26",
|
||||||
|
"a c #35B12A",
|
||||||
|
"s c #39B829",
|
||||||
|
"d c #36A534",
|
||||||
|
"f c #38AF35",
|
||||||
|
"g c #42B525",
|
||||||
|
"h c #43BB25",
|
||||||
|
"j c #4ABE25",
|
||||||
|
"k c #4BBD2C",
|
||||||
|
"l c #43B82B",
|
||||||
|
"z c #42AE35",
|
||||||
|
"x c #40AA3A",
|
||||||
|
"c c #4DBB34",
|
||||||
|
"v c #48B638",
|
||||||
|
"b c #56BA3A",
|
||||||
|
"n c #52BF26",
|
||||||
|
"m c #1CCD2A",
|
||||||
|
"M c #16C52B",
|
||||||
|
"N c #14CF2C",
|
||||||
|
"B c #26C929",
|
||||||
|
"V c #35C226",
|
||||||
|
"C c #39C829",
|
||||||
|
"Z c #29D229",
|
||||||
|
"A c #3AD428",
|
||||||
|
"S c #28C832",
|
||||||
|
"D c #38C634",
|
||||||
|
"F c #3ED339",
|
||||||
|
"G c #74DB1E",
|
||||||
|
"H c #7BDC1E",
|
||||||
|
"J c #76D71C",
|
||||||
|
"K c #6AD71F",
|
||||||
|
"L c #7BE11E",
|
||||||
|
"P c #43C225",
|
||||||
|
"I c #4CC324",
|
||||||
|
"U c #49C827",
|
||||||
|
"Y c #53C524",
|
||||||
|
"T c #54CB24",
|
||||||
|
"R c #5CCC23",
|
||||||
|
"E c #54C32C",
|
||||||
|
"W c #5BC929",
|
||||||
|
"Q c #4BD425",
|
||||||
|
"! c #46D427",
|
||||||
|
"~ c #55D224",
|
||||||
|
"^ c #5BD223",
|
||||||
|
"/ c #5ADA24",
|
||||||
|
"( c #55D62B",
|
||||||
|
") c #49C638",
|
||||||
|
"_ c #57C536",
|
||||||
|
"` c #53D232",
|
||||||
|
"' c #62CE24",
|
||||||
|
"] c #63CE2C",
|
||||||
|
"[ c #6ACD2B",
|
||||||
|
"{ c #63C827",
|
||||||
|
"} c #64D322",
|
||||||
|
"| c #6BD522",
|
||||||
|
" . c #65DA23",
|
||||||
|
".. c #6CDC22",
|
||||||
|
"X. c #6CD429",
|
||||||
|
"o. c #69D92B",
|
||||||
|
"O. c #71D621",
|
||||||
|
"+. c #74DC21",
|
||||||
|
"@. c #7ADC23",
|
||||||
|
"#. c #73D22B",
|
||||||
|
"$. c #74DC2B",
|
||||||
|
"%. c #7CDB2B",
|
||||||
|
"&. c #7AD62B",
|
||||||
|
"*. c #68CB38",
|
||||||
|
"=. c #6BD333",
|
||||||
|
"-. c #66D534",
|
||||||
|
";. c #72D532",
|
||||||
|
":. c #7CDB33",
|
||||||
|
">. c #77D839",
|
||||||
|
",. c #70C633",
|
||||||
|
"<. c #74E122",
|
||||||
|
"1. c #7BE221",
|
||||||
|
"2. c #7CE12A",
|
||||||
|
"3. c #74E12C",
|
||||||
|
"4. c #7BE132",
|
||||||
|
"5. c #6FE02B",
|
||||||
|
"6. c #3DA34A",
|
||||||
|
"7. c #44AC4A",
|
||||||
|
"8. c #4EB449",
|
||||||
|
"9. c #64BE56",
|
||||||
|
"0. c #64BA62",
|
||||||
|
"q. c #58CE4A",
|
||||||
|
"w. c #68C743",
|
||||||
|
"e. c #75CB46",
|
||||||
|
"r. c #76D348",
|
||||||
|
"t. c #70D250",
|
||||||
|
"y. c #72CD6C",
|
||||||
|
"u. c #77E246",
|
||||||
|
"i. c #84DE1D",
|
||||||
|
"p. c #89DF1C",
|
||||||
|
"a. c #83E21D",
|
||||||
|
"s. c #8BE31C",
|
||||||
|
"d. c #93E51B",
|
||||||
|
"f. c #9BE61C",
|
||||||
|
"g. c #9CE81B",
|
||||||
|
"h. c #A3E91C",
|
||||||
|
"j. c #AAEB1A",
|
||||||
|
"k. c #A8EA16",
|
||||||
|
"l. c #B4ED1C",
|
||||||
|
"z. c #B7ED15",
|
||||||
|
"x. c #85DD29",
|
||||||
|
"c. c #83DE32",
|
||||||
|
"v. c #86DC3A",
|
||||||
|
"b. c #92DF3B",
|
||||||
|
"n. c #84E223",
|
||||||
|
"m. c #8BE323",
|
||||||
|
"M. c #85E22B",
|
||||||
|
"N. c #8BE42C",
|
||||||
|
"B. c #94E624",
|
||||||
|
"V. c #9BE824",
|
||||||
|
"C. c #94E52B",
|
||||||
|
"Z. c #99E62B",
|
||||||
|
"A. c #9DE82B",
|
||||||
|
"S. c #9AE723",
|
||||||
|
"D. c #85E234",
|
||||||
|
"F. c #8BE234",
|
||||||
|
"G. c #8CE33D",
|
||||||
|
"H. c #85E13C",
|
||||||
|
"J. c #93E534",
|
||||||
|
"K. c #9AE633",
|
||||||
|
"L. c #93E53C",
|
||||||
|
"P. c #9BE63C",
|
||||||
|
"I. c #9FE83A",
|
||||||
|
"U. c #9CE833",
|
||||||
|
"Y. c #A3E924",
|
||||||
|
"T. c #A8EA28",
|
||||||
|
"R. c #B5ED27",
|
||||||
|
"E. c #AAEB34",
|
||||||
|
"W. c #ACEB3A",
|
||||||
|
"Q. c #A3E936",
|
||||||
|
"!. c #B3EC32",
|
||||||
|
"~. c #B2EC3B",
|
||||||
|
"^. c #BBEE3B",
|
||||||
|
"/. c #BBEE36",
|
||||||
|
"(. c #BEF03D",
|
||||||
|
"). c #C6F119",
|
||||||
|
"_. c #C1EF1A",
|
||||||
|
"`. c #C7F127",
|
||||||
|
"'. c #C3EF3A",
|
||||||
|
"]. c #C2EF35",
|
||||||
|
"[. c #C8F13D",
|
||||||
|
"{. c #CDF228",
|
||||||
|
"}. c #8BDD45",
|
||||||
|
"|. c #8ED952",
|
||||||
|
" X c #8DE443",
|
||||||
|
".X c #89E244",
|
||||||
|
"XX c #91E445",
|
||||||
|
"oX c #9AE543",
|
||||||
|
"OX c #92E54A",
|
||||||
|
"+X c #9BE849",
|
||||||
|
"@X c #95E453",
|
||||||
|
"#X c #9AE654",
|
||||||
|
"$X c #9EE854",
|
||||||
|
"%X c #8FE55B",
|
||||||
|
"&X c #ABEB42",
|
||||||
|
"*X c #ACEB4C",
|
||||||
|
"=X c #A2E848",
|
||||||
|
"-X c #B4EC43",
|
||||||
|
";X c #BAEE45",
|
||||||
|
":X c #B5ED4A",
|
||||||
|
">X c #BAEE4A",
|
||||||
|
",X c #A7E957",
|
||||||
|
"<X c #BDEE55",
|
||||||
|
"1X c #B5EC57",
|
||||||
|
"2X c #96DB65",
|
||||||
|
"3X c #83D472",
|
||||||
|
"4X c #9DE667",
|
||||||
|
"5X c #9FE876",
|
||||||
|
"6X c #A8E966",
|
||||||
|
"7X c #BDEE64",
|
||||||
|
"8X c #BCEE6B",
|
||||||
|
"9X c #B3EC67",
|
||||||
|
"0X c #A9E77A",
|
||||||
|
"qX c #B5EC78",
|
||||||
|
"wX c #BCF07B",
|
||||||
|
"eX c #CAF143",
|
||||||
|
"rX c #C9F14F",
|
||||||
|
"tX c #C7F158",
|
||||||
|
"yX c #CCF257",
|
||||||
|
"uX c #C7F167",
|
||||||
|
"iX c #D3F468",
|
||||||
|
"pX c #CCF276",
|
||||||
|
"aX c #D4F477",
|
||||||
|
"sX c #C4EF70",
|
||||||
|
"dX c #E2F879",
|
||||||
|
"fX c #88DC81",
|
||||||
|
"gX c #95D48D",
|
||||||
|
"hX c #B7ED83",
|
||||||
|
"jX c #B2E994",
|
||||||
|
"kX c #A9E597",
|
||||||
|
"lX c #C7F188",
|
||||||
|
"zX c #D3F486",
|
||||||
|
"xX c #C7F294",
|
||||||
|
"cX c #D7F59B",
|
||||||
|
"vX c #E2F797",
|
||||||
|
"bX c #E3F885",
|
||||||
|
"nX c #C8EEA7",
|
||||||
|
"mX c #D7F5A9",
|
||||||
|
"MX c #D9F6B8",
|
||||||
|
"NX c #CCF3A4",
|
||||||
|
"BX c #E1F8A7",
|
||||||
|
"VX c #E7F9B8",
|
||||||
|
"CX c #E7F9C4",
|
||||||
|
"ZX c #F0FBCC",
|
||||||
|
"AX c #F4FDD8",
|
||||||
|
"SX c #E9F9DB",
|
||||||
|
"DX c #F7FDE9",
|
||||||
|
"FX c #FFFFFD",
|
||||||
|
"GX c #FFFFF1",
|
||||||
|
"HX c #E9F8E5",
|
||||||
|
"JX c #DEF5CD",
|
||||||
|
/* pixels */
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" XOX@X ",
|
||||||
|
" XX X X XL.L.J.J.L..X X ",
|
||||||
|
" XXXL.J.L.J.U.1X<Xz.z.j.j.V.J.G. ",
|
||||||
|
" .XG.K.Z.Y.f.f.B.K.x.P.(.z.{.).).z.E.qX X X ",
|
||||||
|
" X#X9X/.l.s.....} ;.jX*.$.T.aXiXaX[.z.l.tX*X#X X ",
|
||||||
|
" XI.8XSXFXaXuXL.......4.6X.XN.g.(./.mXaX!.Y.k.R.!.Z.}.}. ",
|
||||||
|
" XL.!.bXAXDXxX,XMX$XL n.m.m.2.n.L s.g.l.`.zXVX7X~.E.j.j.j.P.,X X X ",
|
||||||
|
" XOXwXvXdX^.~.F.G L N.U.=Xf.d.m.a.a.m.B.d.j.yX[.8XzXaXaXtX/.j.R.pXE.Q.OX X ",
|
||||||
|
" G.G.~.tXoXx.+.} ^ +.n.a.9XJXD.O.| X.+.G n.V.g.;XaXp.:.9XCXpXpXtXl.z.z.].>XU. X ",
|
||||||
|
" XL.m.XX2X_ ^ ^ | <.$.| K o.t.E I j h h I Y ' @.f.(.R.6X6X@XsX,X,X8Xb.h.j.j.z.T. X X ",
|
||||||
|
" XL.Y.h.Z.,X.X..| | W *.R R I i q a w a 5 a w u u Y @.g.BXVXx.M.1X9XCXqXc.d.d.!.pXT.G. X ",
|
||||||
|
" XL.~.mXmX9X1.| } W I h g T I u & 3 4 5 w 9 6 7 3 # 0 V T M.1XtX&XC.=XuX*X7XoXp.x.~.j.A. X ",
|
||||||
|
" X6Xc.MXhXX.} R W h 5 i j g 9 * 6 6 7 9 4 7 6 6 6 6 5 R } / 1.*X*X-X:X:X:X-X<XK.i.d.;Xj.J. X ",
|
||||||
|
" XH.:...$.] R R Y R R R Y a 4 3 3 4 7 3 # # & # # & 5 R j R ^ R L $.#.1XtX>X-X;X>XS.f.j.j.j.G. X ",
|
||||||
|
" D.n.H +.K ;.>.h w j Y p 7 6 9 I ^ ^ .} j 5 # 7 h e & 5 } Y 5 4 h } j 8.oX:X>XsX<XC.f.j.j.^.8XXX ",
|
||||||
|
" .XC.s.G +.i.=XkXl i a 9 & 0 y A ! ! U T +.m.m.} W ^ O.| g 5 R I 6 E n R e e }.>XE.^.oXx.j.z.yXBXI. X ",
|
||||||
|
" XoXcX+XJ f.k.X.k i 6 * : t C Z Z / 2.n.B.m.} I n W } @.m.m.H Y h 3 g x.| T 3 j +.b.!.rXc.Z.aX{.R.j.G. X ",
|
||||||
|
" XQ.9XJ.g.f.@.j a 3 # $ 2 B N < : +.B.M.X.j q e 3 o O i @.n.+.n.H ^ s i x.x.w u T { W.!.-Xx.!.`.).l.K. X ",
|
||||||
|
" +X;Xs.K ' R I i 7 # o $ < N 2 + q L 1... .} ^ j g 5 X X @ i 5 q H s.1.P i &.#.y ! p #.~.!.~.T.).{.`.T. X ",
|
||||||
|
" X9XpXp.| P n z e 7 w r M N M 3 4 3 I +..... .} ^ T h w o X . + + h :XzX-.V l C.Y u ! U L.~.R.R.l.).{.l. X ",
|
||||||
|
" XQ.T.i.E w.v 7 7 b q.S N < , & o 5 ......$.1.+...T g k ] l = + # I =XGX0XP P #.x.4 p ~ o.~.T.R.`.iX{.R. X ",
|
||||||
|
" XXQ.Y.v.y.! 2 - v f & > 2 $ @ & Y H F.+X=X=XN.n.L <.} =. X>.>.*.w.}.J.AXMXj T h C.k 4 ! ..L.].R.yXeX{.[.OX ",
|
||||||
|
" L.T.g.lXHXq.y w.k 3 @ o - v g H s.n.C.D.L L L 1.<.L 1.@.<.E d ] v.N.K.cXVX-.R P &.[ 5 u .$.~.iXZXyXeXBX6X ",
|
||||||
|
" J.Q.&X2XHXfX*.4.I : O ; e.>.a.} T <.1.1.J.N.@.H +.G 1.1.1.<.h X z c.n.P.zX>.T T { #.u 4 ~ ..U.iXVXiXvXvX6X ",
|
||||||
|
" XN.Q.OX) fX5XN.T p 9 o 9.,X@.g : P 1.D.>._ i 5 4 3 q T .G 1.G 4 . d G.2.~.:.P .( x.p 3 i T oXBXvXiXvXbX1X ",
|
||||||
|
" OXxX8X] V D D.I 3 Y 5 f 8Xw.& e } 1.F.G.d . X + X X & u P / L L Y + + X.o.J.1.P Q .Z.W 6 w h @XDXuXg.8XZX6X X ",
|
||||||
|
" $XMX6X#.< D v . h R & r.|.d i L L 2.$.b . X X O ; ; ; ; & A Q ..} # + ' / 5.M.T C <.B.X.g 5 h J.cXE.f.XXcX=X X ",
|
||||||
|
" XJ.m.6Xe.S f d $ ! 5 d w.) a +.L 1.( c X $ + & e 7 j W g & P Q ....: + W 3.4.n.L I L B.Z.[ 4 I K.7Xh.p.}.zXL. X ",
|
||||||
|
" XXZ.s.}.v D y % > t o w y v } 1.1.3.D & $ : X @ o @ b n & 4 ! .L R + X X.Q.A.1.| I m.Z.B.k 5 +.&XZ.d.c.hX7XJ. ",
|
||||||
|
" XY.S.J w D 9 @ > : # # 1 h L H 1.4.a @ 1 : @ X X 3 }.OXz , Q L 1.i $ o }.*XA.Z.Y ^ m.V.[ e Y 7X&XO.i.+XmX*XJ. ",
|
||||||
|
" XQ.zX}.y.s 8.@ # 6 6 6 B R .1.N.:.= $ m o = X X : ~ c.r.A ..L ^ , $ q M.W.U.OXu ..B.@.5 i =XuX&.| d.h.v.Q.K. ",
|
||||||
|
" K.Q.G.jXq.v @ @ 6 0 # V ..P F.D.#.& , > + & X X $ A +X+X2.@.R 8 , o ^ n.A.U.k 5 ../ B 8 | !.Z.' @.g.d.x.C.F. ",
|
||||||
|
" J.g.L ..( P # # 6 8 $ D $.q G.G.=.i s 2 g o X X + = e.OX] q > 8 + 8 1.U.V.} 5 ~ A Z B j d.d.M.;.d.S.v.&.@.H. ",
|
||||||
|
" K.g.m.2.u.q.# @ 6 8 + y W 3 v.@X[ Y I 1 K h & 5 = X @ $ , u T 4 + T J.9X1XQ } A m B s H f.Z.G.0XP.,XNX$.L.oX ",
|
||||||
|
" J.T.cXxX6Xt.: # : y # r ( # *.6XX.#.} y ^ G g g ' n i P Q I & o Y L ,XmX X../ m m V J s.Z.C.J.lXH.:.:.+.hX@X ",
|
||||||
|
" J.zXDXMXHXt.1 - $ 8 : 9 -.* c 8X] x...^ T Y +.R } L 1.@.T 8 p .<.+XcX$XN.3.Z m Z ./ } K.C.n.5X0X$.G B.uXOX ",
|
||||||
|
" L.7XvXCXDXkXy.y.: > y y >.z 6 qX*.c.M.L G i e T ..<.L ..} ..<.<.m.8XXX,X6XA m N Z ! V &.T.a.~ / F.:XsXcX8X X ",
|
||||||
|
" L./.rXrX=X( F v f > 2 1 -.e.O 2X}.c Q.n.L ..3 + i ..1.L 1.T ~ <.1.a.*X4X! m m S Z V ] W.uXuXH.4XZXGXFXDX4X X ",
|
||||||
|
" X<XvXeXE.5.C : ) y 2 1 s t.z 8.qX4 ,.Q.@.L } # X & i j u : P ^ G | T B m Z D ! Q >.1XsXMXjX0XSXFXFXFXmX X ",
|
||||||
|
" XW.yX[.'.lXq.8 gXfX2 < y s w.4 0Xw.= v.=X} L Y # . . + + o o : 8 t M B S ) l $.,X9XlXNX%X@XmXVXvXdXiX+X X ",
|
||||||
|
" XI.'.[.eXpX}.V y.3Xy < 1 r b b 9.qX& = 8.7 R 1.T q u T } } } U B M m Z ) W n.7X*XtXVX#X4.qXQ.1X;Xz.T. X ",
|
||||||
|
" XL.T.T.[.'.U.Q V s V < < M 0 e.b 2X2X= . X y .<.<.L 1.L 1.<.Q B B ` _ z W +.o.a.B.1.( ^ X.@.=X~.uX+X.X ",
|
||||||
|
" .XF.B.'.[.[.#.w.E ) S < M , z |.b 6Xe.= X + , r j i i j I P P ( -.c *.] $.o.P ~ ! r s ^ J s.k._.7XXX ",
|
||||||
|
" XXXwXaXiXeXE.r.E f ) ) M < @ 8.2X,.c.E = X . . . . . . # U 4.4.>.u.4.2.] I T V 6 7.*.J C.8Xl.).K. X ",
|
||||||
|
" X+XwXVXyX/.s.' P a r.) < y.6.x e.*.%.-.k z - - 7.0.& f e._ -.4.3.3.W i s r # 6 kX0Xs.h.zX].l. X ",
|
||||||
|
" F.m.~.[.'.Y.L.&.-.l F S S % X X - b v.M.X.z 7 7.0.w.v 6 & P 5.$.E 5 a a * 6 E JX8Xd.g.l.`.*X X ",
|
||||||
|
" X2.n.rX[.!.cX9XNX:.E c ) % X X X X - { N.v.,._ v z 7 p o.5.] i 7.d 6 7 7 g X.qXlXT.j._.).+X X ",
|
||||||
|
" H.L.ZXaX/.E.B.I.K.}.*.2X8.- - - 7.X @ q ' a.@.} I W W k i 5 7 8.- # 6 j K L s.d.1XpXz.l.L. ",
|
||||||
|
" X XqXtX'.!.S.s.pXVX0X,.w.0.8.a 6 4 & # 6 g K M.3Xs i q 6 & & @ fX8.3 X.9XC.s.d.T.E.g.J. X ",
|
||||||
|
" XD.J.^.^.^./.tX<XL.p.{ d - w Y _ w.a 3 3 3 c 0X1.L H Q O + # 9.v Y x.qXC.oXB.d.s.F. X ",
|
||||||
|
" G.L.Q.~.aXtX/.Z.@.v.nX3X7 E hXlXn.Y d f 6 5 g I .3.] R } @.g.j.g.i.N.mXoXa.M. X ",
|
||||||
|
" X XL.x.C.m.J P.>Xc.I h +.W.=X+XnXy.O O o o : gXhXG a.f./.uXs.@.@.U.j.Z.G. ",
|
||||||
|
" Xc.$.O.O.@.k.f.R i Y *XuX=X,XF.Y u 4 o $ r. X.XN.C.1XzXf.d.a.g.A.L. ",
|
||||||
|
" .X:.o.| +.N.2Xv h a.s.a.J.zX*XL .XE r 2.lXvXZXAXAXAXVXbXtXJ. X ",
|
||||||
|
" XXG.:.X.W t.U h +.s.L ,XwXN.2.jXb g $.wX-XcXVXZXZXVXhX#X ",
|
||||||
|
" XXG.>.*.W *.W H } W ;.T P _ | J @.#X%.L x.J.I.OX ",
|
||||||
|
" X X@X>.=.-.=.=.;.:.c.H.D.D.:.F.F.H..X ",
|
||||||
|
" OXXXXXXX XXXXXOX XXX X XOX XXX ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" "
|
||||||
|
};
|
||||||
243
sprites/soda.xpm
Normal file
243
sprites/soda.xpm
Normal file
@@ -0,0 +1,243 @@
|
|||||||
|
/* XPM */
|
||||||
|
static char *dac9a31a2dd54be7a57df326e0947a7bZI2wErTBGuQ5EBpn[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"64 64 173 2 ",
|
||||||
|
" c None",
|
||||||
|
". c #020101",
|
||||||
|
"X c #0B0202",
|
||||||
|
"o c #0C0C0C",
|
||||||
|
"O c #130202",
|
||||||
|
"+ c #1B0202",
|
||||||
|
"@ c #1C0C0C",
|
||||||
|
"# c gray8",
|
||||||
|
"$ c #1C1C1C",
|
||||||
|
"% c #1C1212",
|
||||||
|
"& c #240404",
|
||||||
|
"* c #2B0505",
|
||||||
|
"= c #250C0C",
|
||||||
|
"- c #320505",
|
||||||
|
"; c #3C0707",
|
||||||
|
": c #330C0C",
|
||||||
|
"> c #2F1010",
|
||||||
|
", c #211A1A",
|
||||||
|
"< c #371818",
|
||||||
|
"1 c #232323",
|
||||||
|
"2 c #2B2222",
|
||||||
|
"3 c #2B2B2B",
|
||||||
|
"4 c #302727",
|
||||||
|
"5 c #302B2B",
|
||||||
|
"6 c #3F2C2C",
|
||||||
|
"7 c #2C3131",
|
||||||
|
"8 c #333333",
|
||||||
|
"9 c #393232",
|
||||||
|
"0 c #363A3A",
|
||||||
|
"q c #3B3B3B",
|
||||||
|
"w c #430707",
|
||||||
|
"e c #4E0707",
|
||||||
|
"r c #430808",
|
||||||
|
"t c #4D0A0A",
|
||||||
|
"y c #510606",
|
||||||
|
"u c #550B0B",
|
||||||
|
"i c #5B0B0B",
|
||||||
|
"p c #4B1111",
|
||||||
|
"a c #551212",
|
||||||
|
"s c #5C1010",
|
||||||
|
"d c #561F1F",
|
||||||
|
"f c #640C0C",
|
||||||
|
"g c #6C0D0D",
|
||||||
|
"h c #730E0E",
|
||||||
|
"j c #7B0E0E",
|
||||||
|
"k c #6B1212",
|
||||||
|
"l c #601B1B",
|
||||||
|
"z c #621414",
|
||||||
|
"x c #751212",
|
||||||
|
"c c #7B1616",
|
||||||
|
"v c #7F1A1A",
|
||||||
|
"b c #751B1B",
|
||||||
|
"n c #4B2626",
|
||||||
|
"m c #442A2A",
|
||||||
|
"M c #483434",
|
||||||
|
"N c #513838",
|
||||||
|
"B c #553232",
|
||||||
|
"V c #672323",
|
||||||
|
"C c #6F2727",
|
||||||
|
"Z c #6D2828",
|
||||||
|
"A c #712222",
|
||||||
|
"S c #7B2B2B",
|
||||||
|
"D c #444444",
|
||||||
|
"F c #4A4545",
|
||||||
|
"G c #4C4C4C",
|
||||||
|
"H c #5B4646",
|
||||||
|
"J c #544A4A",
|
||||||
|
"K c #5F4848",
|
||||||
|
"L c #4D5050",
|
||||||
|
"P c #535353",
|
||||||
|
"I c #595757",
|
||||||
|
"U c #5B5C5C",
|
||||||
|
"Y c #6B4B4B",
|
||||||
|
"T c #6F5151",
|
||||||
|
"R c #715E5E",
|
||||||
|
"E c #646464",
|
||||||
|
"W c #6B6B6B",
|
||||||
|
"Q c #726262",
|
||||||
|
"! c #747474",
|
||||||
|
"~ c #7C7C7C",
|
||||||
|
"^ c #840F0F",
|
||||||
|
"/ c #8B0F0F",
|
||||||
|
"( c #851212",
|
||||||
|
") c #8C1111",
|
||||||
|
"_ c #811919",
|
||||||
|
"` c #8F1818",
|
||||||
|
"' c #951212",
|
||||||
|
"] c #9B1212",
|
||||||
|
"[ c #931A1A",
|
||||||
|
"{ c #9E1A1A",
|
||||||
|
"} c #A41414",
|
||||||
|
"| c #AC1515",
|
||||||
|
" . c #A91818",
|
||||||
|
".. c #B41616",
|
||||||
|
"X. c #BB1616",
|
||||||
|
"o. c #B31A1A",
|
||||||
|
"O. c #BC1919",
|
||||||
|
"+. c #862525",
|
||||||
|
"@. c #832C2C",
|
||||||
|
"#. c #902828",
|
||||||
|
"$. c #8D3535",
|
||||||
|
"%. c #963737",
|
||||||
|
"&. c #9B3A3A",
|
||||||
|
"*. c #AC2323",
|
||||||
|
"=. c #C11717",
|
||||||
|
"-. c #CC1717",
|
||||||
|
";. c #C51919",
|
||||||
|
":. c #CC1A1A",
|
||||||
|
">. c #D11A1A",
|
||||||
|
",. c #CF2020",
|
||||||
|
"<. c #C32D2D",
|
||||||
|
"1. c #CD2C2C",
|
||||||
|
"2. c #D22323",
|
||||||
|
"3. c #D52B2B",
|
||||||
|
"4. c #D92C2E",
|
||||||
|
"5. c #D92A33",
|
||||||
|
"6. c #C53030",
|
||||||
|
"7. c #CA3333",
|
||||||
|
"8. c #D63131",
|
||||||
|
"9. c #DA3434",
|
||||||
|
"0. c #DC303B",
|
||||||
|
"q. c #DE3D3D",
|
||||||
|
"w. c #E23D3D",
|
||||||
|
"e. c #DF3341",
|
||||||
|
"r. c #B14141",
|
||||||
|
"t. c #BB4646",
|
||||||
|
"y. c #CE4B4B",
|
||||||
|
"u. c #DE4343",
|
||||||
|
"i. c #D54A4A",
|
||||||
|
"p. c #DE4E4E",
|
||||||
|
"a. c #DD5252",
|
||||||
|
"s. c #E24444",
|
||||||
|
"d. c #E64C4C",
|
||||||
|
"f. c #E84D4D",
|
||||||
|
"g. c #E65353",
|
||||||
|
"h. c #EA5454",
|
||||||
|
"j. c #EC5858",
|
||||||
|
"k. c #7E8080",
|
||||||
|
"l. c #838383",
|
||||||
|
"z. c #8C8C8C",
|
||||||
|
"x. c #908E8E",
|
||||||
|
"c. c #929292",
|
||||||
|
"v. c #9D9D9D",
|
||||||
|
"b. c #9B9B9B",
|
||||||
|
"n. c #A1A1A1",
|
||||||
|
"m. c #A2A2A2",
|
||||||
|
"M. c #A5A5A5",
|
||||||
|
"N. c #A6A6A6",
|
||||||
|
"B. c #ABABAB",
|
||||||
|
"V. c #A8A8A8",
|
||||||
|
"C. c #AEAEAE",
|
||||||
|
"Z. c #ACACAC",
|
||||||
|
"A. c #B1B1B1",
|
||||||
|
"S. c #B3B3B3",
|
||||||
|
"D. c #B5B5B5",
|
||||||
|
"F. c #B6B6B6",
|
||||||
|
"G. c #B5B5B5",
|
||||||
|
"H. c #B9B9B9",
|
||||||
|
"J. c #BDBDBD",
|
||||||
|
"K. c gray",
|
||||||
|
"L. c #BDBDBD",
|
||||||
|
"P. c #C1C1C1",
|
||||||
|
"I. c gray76",
|
||||||
|
"U. c #C6C6C6",
|
||||||
|
"Y. c #C4C4C4",
|
||||||
|
"T. c gray79",
|
||||||
|
"R. c #C8C8C8",
|
||||||
|
"E. c #CACACA",
|
||||||
|
"W. c #CBCBCB",
|
||||||
|
"Q. c #CDCDCD",
|
||||||
|
"!. c #CFCFCF",
|
||||||
|
"~. c #C9C9C9",
|
||||||
|
"^. c #D0D0D0",
|
||||||
|
/* pixels */
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" . . . . . o o . ",
|
||||||
|
" . 0 z.c.c.c.c.x.x.x.D ",
|
||||||
|
" P E W ! ! ! ! ! ! ! ! W F ",
|
||||||
|
" 0 ~ n.~ 1 7 1 $ 1 $ $ o k.k.. ",
|
||||||
|
" 1 v.P # q l.H.x.~ ~ ~ ! $ ~ ~ X O # # # # # # ",
|
||||||
|
" 8 v.q P l.A.K.T.P.L.K.A.~ $ ~ ~ * ] & $ b.B.B.V.B.M.7 . . . . ",
|
||||||
|
" D ~ G L x.P.W.W.R.W.W.W.Y.B.3 ~ k.- ..& 8 ~ L F D D F F ~ z.l.z.k.1 . . . ",
|
||||||
|
" F W W M x.P.W.T.T.T.R.R.W.P.~ E W Y j X.& . . q A.$ 1 0 8 8 0 W ! ! ! ! E U F D U P ",
|
||||||
|
" 8 ! W 0 x.P.R.T.T.T.T.T.T.W.B.1 M.L y >.X.& . O B x.D P ! ~ ~ ! 8 $ $ $ 3 z.M.! 7 8 8 x.^.n.o ",
|
||||||
|
" o v.I 7 z.Y.T.R.T.T.T.T.T.T.T.N.$ M.P y :.X.& X g ' 2 V.q D ~ l.l.~ ~ ~ l.! 3 # E x.$ # # 8 V.H.P.Q.n.o ",
|
||||||
|
" o n.P 3 z.Y.T.T.T.T.T.T.T.T.F.! $ n.L y -.=.* h ;.] , C.q D c.K.K.H.K.K.K.F.! E G L c.$ . W C.b.8 1 z.^.n.o ",
|
||||||
|
" 1 ~ R L ! D.T.T.T.T.T.T.T.W.Q.b.D k.U Z *.w.=.* ) :.X.( J ~ I E Q.Q.W.T.T.A.L 8 3 U ~ I ~ l.W G I ~ 1 ! ^.n.o ",
|
||||||
|
" 1 F.7 D v.T.T.T.T.T.T.T.T.A.B.! 1 v.3 j 4.i.( f } >.2.<.= U W W ! ~ H.W.T.A.U I I W W D H.c.I 8 D ! $ ~ ^.n.o ",
|
||||||
|
" 1 D.7 D v.T.T.T.T.T.T.T.T.x.W G 1 I < ` w.t.@ ..:.-.3.y.@ + R ~ 3 8 z.L.T.T.T.T.Q.! 1 l.K.q 8 E I 8 3 z.K.l.o ",
|
||||||
|
" 7 V.0 G n.T.T.T.T.T.T.T.P.x.0 3 E % ] q.g.r.: ..:.-.3.y.= ' g J S.F.D ~ Y.T.T.K.K.W $ ! C.D o o 0 C.H.K.! o ",
|
||||||
|
" D c.0 I b.P.T.T.T.T.T.T.P.x.k.q 3 W % } w.&.p } ;.-.-.3.y.= ' X._ F K.C.I E W.P.D 1 # o $ 3 z.l.~ n.z.z.G 1 ",
|
||||||
|
" . G B.$ E B.W.T.T.T.T.Q.L.b.k.D D D 6 ( 7.h.$.- ;.:.9.4.3.p.[ i ' X.c J G ! W G P k.l.l.l.l.l.U W b.F.q 3 E U . ",
|
||||||
|
" . F V.$ E B.T.T.T.T.A.V.v.! L q D N g :.d.d.+.- ;.:.s.q.3.d.:.; h >.X.f y T ! I U ~ n.A.C.C.V.I q I ! q 8 E ! G ",
|
||||||
|
" . G B.$ U B.Q.T.T.H.b.z.l.I 1 I M f :.:.d.6.f - ;.:.s.q.3.f.3.l x O.2.2.>.g H V.v.F P E E E l.z.U 3 q l.l.q P z.1 ",
|
||||||
|
" . D M.$ E B.T.Y.P.z.A.P.c.3 E 3 x -.:.,.s.V X ; X.-.u.q.3.h.g.g.S d a.h.3.-.( % 2 v.L o # 3 V.H.F.F.F.F.l.! G 0 W # ",
|
||||||
|
" . 8 ! # E B.A.z.z.A.R.l.G c.5 ( O.:.2.s.4.u ; ) r ..s.h.d.h.h.j.7.( d a.d.4.O.} ] m P E ! b.q 3 3 3 7 3 $ $ P B.C.1 ",
|
||||||
|
" . 3 E # E x.z.~ ~ b.W E ! J c <.w.w.s.g.b g } } & | 3.s.j.h.9.9.2.) > a.j.8.-.>.-.) n 7 0 L G G F G F G G G G J L $ ",
|
||||||
|
" . 0 l.# q F G F G G L W Q i 1.g.j.j.j.q.> j >.} + ..:.9.g.w.8.8.2./ @ $.a.s.2.:.-.:.c e e p F G G G G G G G L M o ",
|
||||||
|
" F c.q $ $ $ $ $ $ ~ Q i 3.g.h.g.f.u. .e ` 2.| r ' =.q.s.,.f.j.w.{ * X %.a.s.2.2.:.:.-.:.O.w * * * * * * * J z.o ",
|
||||||
|
" 7 M.k.W W W W W 9 k 1.h.h.h.9.,.| * ] q.q.-.X.- / w.s.2.d.j.h.q.} + @ %.h.h.g.2.:.:.:.-.;.=.;.X.=.=.=.O.c o ",
|
||||||
|
" o 3 $ $ $ $ $ , c 6.d.h.h.h.9.-...@ } w.w.-.X.* / 9.h.f.h.j.q.2.| + &.C S j.h.d.d.9.:.:.-.:.:.:.:.:.:.g & ",
|
||||||
|
" . X f ^ j j j ^ <.d.j.h.w.9.2. .f j X.w.f.9.;.` f [ w.j.j.j.9.-.=.( A = a q.h.j.j.d.q.s.w.u.w.9.-.-.:.u . ",
|
||||||
|
" X } >.:.>.:.4.f.d.s.q.:.-.:.} f ;.:.w.j.f.:.:.j ( 2.s.h.j.s.8.4.;.- < #.q.h.h.j.j.j.j.j.s.g.u.:.:.] r ",
|
||||||
|
" X ) X.:.:.>.f.h.9.:.-.:.-.-.:.:.:.:.w.h.s.:.:.-.>.:.,.s.h.j.h.s.;.t @.i.d.d.d.d.d.f.d.d.3.9.q.;.} - ",
|
||||||
|
" O ( :.:.:.d.7.;.;.-.:.:.:.:.:.:.:.w.w.:.:.:.;.;.-.:.,.s.j.s.2.:.=.s s 2.:.,.,.:.:.;.;.;.;.;.} & ",
|
||||||
|
" . j >.:.:.2.g & u -.:.-.:.-.,.s.f.g.w.:.:.-.f h >.:.:.2.w.h.d.s.2.e t :.-.:.:.:.} - * * * * & X ",
|
||||||
|
" r i u i u h j ' -.:.-.3.q.u.j.w.s.f.e.q.,.' g j -.:.:.2.9.8.9.,.] ] -.:.-.-.-...j j j ; . ",
|
||||||
|
" . . X r } >.>.:.:.3.s.g.u.w.,.9.s.s.w.,.>.' i ( ( X.:.-.:.8.8.8.8.9.8.8.8.8.9.9.>.>.f . ",
|
||||||
|
" . O ' | X.:.:.:.w.g.w.:.:.:.-.-.:.:.:.X.| ) * * ) ;.:.,.d.d.d.f.d.d.h.h.h.d.u.o.| i . ",
|
||||||
|
" + O g -.:.:.>.,.:.:.:.:.:.-.:.;.;.i + t X.X.t j :.:.,.:.,.:.2.2.f.h.q.:.o.* O O ",
|
||||||
|
" & i :.:.:.:.-.:.-.-.:.-...; - ( } } :.:.| f f :.-.i ) 3.d.d.h.9.` - - ",
|
||||||
|
" * i i i ] >.>.>.:.:.>.X.j j ..3.0.O.g ..} h i i h | 2.9.9.@.z r ",
|
||||||
|
" . . . i / ^ ( ( ( ( ( ( ) ..5.e.;.i h ) j r t ..} ( / c & . ",
|
||||||
|
" . . . . . . . . X j ..| | } * . ; | | | t . . X ",
|
||||||
|
" O O O O + X . X O O O ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" "
|
||||||
|
};
|
||||||
9
srcs/error.c
Normal file
9
srcs/error.c
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#include "so_long.h"
|
||||||
|
#include "unistd.h"
|
||||||
|
|
||||||
|
int
|
||||||
|
ft_put_error(void)
|
||||||
|
{
|
||||||
|
write(2, "Error\n", 6);
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
124
srcs/game_loop.c
Normal file
124
srcs/game_loop.c
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* game_loop.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: lejulien <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2021/06/09 18:20:48 by lejulien #+# #+# */
|
||||||
|
/* Updated: 2021/06/12 04:03:37 by lejulien ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "so_long.h"
|
||||||
|
|
||||||
|
void
|
||||||
|
handle_moves(t_game *game)
|
||||||
|
{
|
||||||
|
if (game->key_w && game->player_pos.y != 0 &&
|
||||||
|
game->map[(game->player_pos.y - 1) * game->mapX + game->player_pos.x] != '1')
|
||||||
|
{
|
||||||
|
game->player_pos.y--;
|
||||||
|
game->key_w = 0;
|
||||||
|
game->moves++;
|
||||||
|
if (game->moves > 0)
|
||||||
|
printf("%d moves\n", game->moves);
|
||||||
|
}
|
||||||
|
if (game->key_a && game->player_pos.x != 0 &&
|
||||||
|
game->map[game->player_pos.y * game->mapX + (game->player_pos.x - 1)] != '1')
|
||||||
|
{
|
||||||
|
game->player_pos.x--;
|
||||||
|
game->key_a = 0;
|
||||||
|
game->moves++;
|
||||||
|
if (game->moves > 0)
|
||||||
|
printf("%d moves\n", game->moves);
|
||||||
|
}
|
||||||
|
if (game->key_s && game->player_pos.y != game->mapY &&
|
||||||
|
game->map[(game->player_pos.y + 1) * game->mapX + game->player_pos.x] != '1')
|
||||||
|
{
|
||||||
|
game->player_pos.y++;
|
||||||
|
game->key_s = 0;
|
||||||
|
game->moves++;
|
||||||
|
if (game->moves > 0)
|
||||||
|
printf("%d moves\n", game->moves);
|
||||||
|
}
|
||||||
|
if (game->key_d && game->player_pos.x != game->mapX &&
|
||||||
|
game->map[game->player_pos.y * game->mapX + (game->player_pos.x + 1)] != '1')
|
||||||
|
{
|
||||||
|
game->player_pos.x++;
|
||||||
|
game->key_d= 0;
|
||||||
|
game->moves++;
|
||||||
|
if (game->moves > 0)
|
||||||
|
printf("%d moves\n", game->moves);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
get_can(t_game *game)
|
||||||
|
{
|
||||||
|
if (game->map[game->player_pos.y * game->mapX + game->player_pos.x] == 'C')
|
||||||
|
{
|
||||||
|
game->coll++;
|
||||||
|
game->map[game->player_pos.y * game->mapX + game->player_pos.x] = '0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
draw_map(t_game *game)
|
||||||
|
{
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
|
||||||
|
y = -1;
|
||||||
|
while (y++ < game->mapY - 1)
|
||||||
|
{
|
||||||
|
x = -1;
|
||||||
|
while (x++ < game->mapX - 1)
|
||||||
|
{
|
||||||
|
put_image(game, game->img->bg_img, set_pos(x * 64, y * 64));
|
||||||
|
if (game->map[y * game->mapX + x] == '1')
|
||||||
|
put_image(game, game->img->bloc_img, set_pos(x * 64, y * 64));
|
||||||
|
else if (game->map[y * game->mapX + x] == 'C')
|
||||||
|
put_image(game, game->img->coll_img, set_pos(x * 64, y * 64));
|
||||||
|
else if (game->map[y * game->mapX + x] == 'E')
|
||||||
|
put_image(game, game->img->portal_img, set_pos(x * 64, y * 64));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
put_image(game, game->img->player_img, set_pos(game->player_pos.x * 64,
|
||||||
|
game->player_pos.y * 64));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
render_mouse(t_game *game)
|
||||||
|
{
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
|
||||||
|
mlx_mouse_get_pos(game->mlx->mlx_ptr, game->mlx->win_ptr, &x, &y);
|
||||||
|
if (x < game->winX - game->img->mouse_img->width && x > 0 &&
|
||||||
|
y < game->winY - game->img->mouse_img->height && y > 0)
|
||||||
|
put_image(game, game->img->mouse_img, set_pos(x, y));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ft_exit(t_game *game)
|
||||||
|
{
|
||||||
|
if (game->map[game->player_pos.y * game->mapX + game->player_pos.x] == 'E')
|
||||||
|
{
|
||||||
|
if (game->coll == game->t_coll)
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
game_loop(t_game *game)
|
||||||
|
{
|
||||||
|
handle_moves(game);
|
||||||
|
get_can(game);
|
||||||
|
ft_exit(game);
|
||||||
|
draw_map(game);
|
||||||
|
render_mouse(game);
|
||||||
|
mlx_put_image_to_window(game->mlx->mlx_ptr, game->mlx->win_ptr,
|
||||||
|
game->img->canvas->img_ptr, 0, 0);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
96
srcs/get_next_line.c
Normal file
96
srcs/get_next_line.c
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* get_next_line.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: lejulien <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2019/11/29 01:57:21 by lejulien #+# #+# */
|
||||||
|
/* Updated: 2021/06/10 15:29:34 by user42 ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "get_next_line.h"
|
||||||
|
|
||||||
|
int ft_hasnl(char *str)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
if (!str || str[i] == '\0')
|
||||||
|
return (-1);
|
||||||
|
while (str[i] != '\0')
|
||||||
|
{
|
||||||
|
if (str[i] == '\n')
|
||||||
|
return (i);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *ft_read(int fd, char **buffer)
|
||||||
|
{
|
||||||
|
int len;
|
||||||
|
char *whatiread;
|
||||||
|
char *tmp;
|
||||||
|
|
||||||
|
len = BUFFER_SIZE;
|
||||||
|
if (!(whatiread = malloc((BUFFER_SIZE + 1) * sizeof(char))))
|
||||||
|
return (NULL);
|
||||||
|
while (ft_hasnl(*buffer) == -1 && len == BUFFER_SIZE)
|
||||||
|
{
|
||||||
|
len = read(fd, whatiread, BUFFER_SIZE);
|
||||||
|
whatiread[len] = 0;
|
||||||
|
if (!(tmp = ft_strjoin(*buffer, whatiread)))
|
||||||
|
return (NULL);
|
||||||
|
if (*buffer != 0)
|
||||||
|
free(*buffer);
|
||||||
|
if (!(*buffer = ft_strdup(tmp)))
|
||||||
|
return (NULL);
|
||||||
|
free(tmp);
|
||||||
|
}
|
||||||
|
free(whatiread);
|
||||||
|
return (*buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
t_char *ft_cut(char *buffer)
|
||||||
|
{
|
||||||
|
t_char *cut;
|
||||||
|
int nlpos;
|
||||||
|
|
||||||
|
if (!(cut = malloc(sizeof(t_char))))
|
||||||
|
return (NULL);
|
||||||
|
nlpos = ft_hasnl(buffer);
|
||||||
|
buffer[nlpos] = '\0';
|
||||||
|
if (!(cut->toline = ft_strdup(buffer)))
|
||||||
|
return (NULL);
|
||||||
|
if (!(cut->tobuff = ft_strdup(&buffer[nlpos + 1])))
|
||||||
|
return (NULL);
|
||||||
|
free(buffer);
|
||||||
|
return (cut);
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_next_line(int fd, char **line)
|
||||||
|
{
|
||||||
|
static char *buffer = NULL;
|
||||||
|
t_char *res;
|
||||||
|
|
||||||
|
if (line)
|
||||||
|
*line = NULL;
|
||||||
|
if (fd < 0 || BUFFER_SIZE < 1 || read(fd, NULL, 0) == -1
|
||||||
|
|| !(buffer = ft_read(fd, &buffer)) || !line)
|
||||||
|
return (-1);
|
||||||
|
if (ft_hasnl(buffer) == -1)
|
||||||
|
{
|
||||||
|
*line = buffer;
|
||||||
|
buffer = NULL;
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
if (!(res = ft_cut(buffer)))
|
||||||
|
return (-1);
|
||||||
|
*line = res->toline;
|
||||||
|
buffer = res->tobuff;
|
||||||
|
free(res);
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
|
||||||
32
srcs/get_next_line.h
Normal file
32
srcs/get_next_line.h
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* get_next_line.h :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: lejulien <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2019/11/29 00:35:55 by lejulien #+# #+# */
|
||||||
|
/* Updated: 2021/06/10 15:30:19 by user42 ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#ifndef GET_NEXT_LINE_H
|
||||||
|
# define GET_NEXT_LINE_H
|
||||||
|
# include <unistd.h>
|
||||||
|
# include <stdlib.h>
|
||||||
|
|
||||||
|
typedef struct s_char
|
||||||
|
{
|
||||||
|
char *tobuff;
|
||||||
|
char *toline;
|
||||||
|
} t_char;
|
||||||
|
|
||||||
|
size_t ft_strlen(const char *s);
|
||||||
|
char *ft_strjoin(char const *s1, char const *s2);
|
||||||
|
char *ft_strdup(const char *src);
|
||||||
|
int get_next_line(int fd, char **line);
|
||||||
|
t_char *ft_cut(char *buffer);
|
||||||
|
char *ft_read(int fd, char **buffer);
|
||||||
|
int ft_hasnl(char *str);
|
||||||
|
#endif
|
||||||
|
|
||||||
69
srcs/get_next_line_utils.c
Normal file
69
srcs/get_next_line_utils.c
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* get_next_line_utils.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: lejulien <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2019/11/29 00:35:11 by lejulien #+# #+# */
|
||||||
|
/* Updated: 2021/06/10 15:30:56 by user42 ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "get_next_line.h"
|
||||||
|
|
||||||
|
char *ft_strjoin(char const *s1, char const *s2)
|
||||||
|
{
|
||||||
|
char *s3;
|
||||||
|
int allocplace;
|
||||||
|
char *writeptr;
|
||||||
|
|
||||||
|
if (!s1 && !s2)
|
||||||
|
return (0);
|
||||||
|
if (!s1)
|
||||||
|
return (ft_strdup((char *)s2));
|
||||||
|
if (!s2)
|
||||||
|
return (ft_strdup((char *)s1));
|
||||||
|
allocplace = ft_strlen(s1) + ft_strlen(s2) + 1;
|
||||||
|
if (!(s3 = malloc(allocplace * sizeof(char))))
|
||||||
|
return (0);
|
||||||
|
writeptr = s3;
|
||||||
|
while (*s1 != '\0')
|
||||||
|
*writeptr++ = *s1++;
|
||||||
|
while (*s2 != '\0')
|
||||||
|
*writeptr++ = *s2++;
|
||||||
|
*writeptr++ = '\0';
|
||||||
|
return (s3);
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t ft_strlen(const char *s)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
if (!s)
|
||||||
|
return (0);
|
||||||
|
while (s[i] != '\0')
|
||||||
|
i++;
|
||||||
|
return (i);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *ft_strdup(const char *src)
|
||||||
|
{
|
||||||
|
char *dest;
|
||||||
|
int size;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
size = ft_strlen(src) + 1;
|
||||||
|
if (!(dest = (char *)malloc(size * sizeof(char))))
|
||||||
|
return (NULL);
|
||||||
|
while (src[i] != '\0')
|
||||||
|
{
|
||||||
|
dest[i] = src[i];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
dest[i] = '\0';
|
||||||
|
return (dest);
|
||||||
|
}
|
||||||
|
|
||||||
51
srcs/getmap.c
Normal file
51
srcs/getmap.c
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
|
||||||
|
#include "so_long.h"
|
||||||
|
#include "get_next_line.h"
|
||||||
|
#include "fcntl.h"
|
||||||
|
|
||||||
|
void
|
||||||
|
ft_getmap(t_game *game, char *path)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
char *line;
|
||||||
|
char *longmap;
|
||||||
|
char *tmp;
|
||||||
|
int length;
|
||||||
|
int old_length;
|
||||||
|
|
||||||
|
old_length = 0;
|
||||||
|
fd = open(path, O_RDONLY);
|
||||||
|
longmap = NULL;
|
||||||
|
if (fd == -1)
|
||||||
|
{
|
||||||
|
game->map = NULL;
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
while (get_next_line(fd, &line))
|
||||||
|
{
|
||||||
|
length = ft_strlen(line);
|
||||||
|
if (length)
|
||||||
|
{
|
||||||
|
tmp = ft_strjoin(longmap, line);
|
||||||
|
free(longmap);
|
||||||
|
longmap = ft_strdup(tmp);
|
||||||
|
free(tmp);
|
||||||
|
}
|
||||||
|
if (length != 0)
|
||||||
|
{
|
||||||
|
if (old_length == 0 || length == old_length)
|
||||||
|
old_length = length;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
free(line);
|
||||||
|
game->map = NULL;
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(line);
|
||||||
|
}
|
||||||
|
free(line);
|
||||||
|
game->mapX = old_length;
|
||||||
|
game->mapY = ft_strlen(longmap) / old_length;
|
||||||
|
game->map = longmap;
|
||||||
|
}
|
||||||
43
srcs/keys.c
Normal file
43
srcs/keys.c
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* keys.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: lejulien <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2021/06/11 18:36:19 by lejulien #+# #+# */
|
||||||
|
/* Updated: 2021/06/12 02:57:12 by lejulien ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "so_long.h"
|
||||||
|
|
||||||
|
int
|
||||||
|
key_pressed(int keycode, t_game *game)
|
||||||
|
{
|
||||||
|
if (keycode == 119)
|
||||||
|
game->key_w = 1;
|
||||||
|
if (keycode == 97)
|
||||||
|
game->key_a = 1;
|
||||||
|
if (keycode == 115)
|
||||||
|
game->key_s = 1;
|
||||||
|
if (keycode == 100)
|
||||||
|
game->key_d = 1;
|
||||||
|
if (keycode == 65307)
|
||||||
|
exit(0);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
key_released(int keycode, t_game *game)
|
||||||
|
{
|
||||||
|
if (keycode == 119)
|
||||||
|
game->key_w = 0;
|
||||||
|
if (keycode == 97)
|
||||||
|
game->key_a = 0;
|
||||||
|
if (keycode == 115)
|
||||||
|
game->key_s = 0;
|
||||||
|
if (keycode == 100)
|
||||||
|
game->key_d = 0;
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
133
srcs/main.c
Normal file
133
srcs/main.c
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* main.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: lejulien <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2021/06/08 17:06:28 by lejulien #+# #+# */
|
||||||
|
/* Updated: 2021/06/12 04:02:57 by lejulien ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "so_long.h"
|
||||||
|
|
||||||
|
int
|
||||||
|
load_mlx(t_mlx *mlx, int width, int height)
|
||||||
|
{
|
||||||
|
|
||||||
|
mlx->mlx_ptr = mlx_init();
|
||||||
|
if (!mlx->mlx_ptr)
|
||||||
|
return (1);
|
||||||
|
mlx->win_ptr = mlx_new_window(mlx->mlx_ptr, width*64, height*64, "so_long");
|
||||||
|
if (!mlx->win_ptr)
|
||||||
|
return (1);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
init_game(t_game *game, t_mlx *mlx, int tileX, int tileY)
|
||||||
|
{
|
||||||
|
game->mlx = mlx;
|
||||||
|
game->winX = tileX * 64;
|
||||||
|
game->winY = tileY * 64;
|
||||||
|
game->coll = 0;
|
||||||
|
game->moves = -4;
|
||||||
|
}
|
||||||
|
|
||||||
|
t_img_d
|
||||||
|
*create_and_get_date(t_game *g, t_img *img, char *path)
|
||||||
|
{
|
||||||
|
t_img_d *ret;
|
||||||
|
|
||||||
|
ret = malloc(sizeof(t_img_d));
|
||||||
|
if (!ret)
|
||||||
|
return (NULL);
|
||||||
|
if (!path)
|
||||||
|
ret->img_ptr = mlx_new_image(g->mlx->mlx_ptr, g->winX, g->winY);
|
||||||
|
else
|
||||||
|
ret->img_ptr = mlx_xpm_file_to_image(g->mlx->mlx_ptr, path, &ret->width,
|
||||||
|
&ret->height);
|
||||||
|
if (!ret->img_ptr)
|
||||||
|
return (NULL);
|
||||||
|
ret->data = (int *)mlx_get_data_addr(ret->img_ptr, &ret->bpp, &ret->size_l,
|
||||||
|
&ret->endian);
|
||||||
|
return (ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
load_img(t_game *g, t_img *img)
|
||||||
|
{
|
||||||
|
img->canvas = create_and_get_date(g, img, NULL);
|
||||||
|
img->bg_img = create_and_get_date(g, img, "./sprites/aqua.xpm");
|
||||||
|
img->player_img = create_and_get_date(g, img, "./sprites/dolphin.xpm");
|
||||||
|
img->bloc_img = create_and_get_date(g, img, "./sprites/bloc.xpm");
|
||||||
|
img->coll_img = create_and_get_date(g, img, "./sprites/soda.xpm");
|
||||||
|
img->mouse_img = create_and_get_date(g, img, "./sprites/cursor.xpm");
|
||||||
|
img->portal_img = create_and_get_date(g, img, "./sprites/portal.xpm");
|
||||||
|
if (!img->bg_img || !img->player_img || !img->bloc_img || !img->coll_img ||
|
||||||
|
!img->mouse_img || !img->canvas || !img->portal_img)
|
||||||
|
return (1);
|
||||||
|
g->img = img;
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
load_coll(t_game *game)
|
||||||
|
{
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
int count;
|
||||||
|
|
||||||
|
y = -1;
|
||||||
|
count = 0;
|
||||||
|
while (y++ < game->mapY - 1)
|
||||||
|
{
|
||||||
|
x = -1;
|
||||||
|
while (x++ < game->mapX - 1)
|
||||||
|
{
|
||||||
|
if (game->map[y * game->mapX + x] == 'C')
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
game->t_coll = count;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
close(int keycode, t_game *game)
|
||||||
|
{
|
||||||
|
if (keycode > 10 || keycode < 0) //free data later
|
||||||
|
exit(0);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int ac, char **av)
|
||||||
|
{
|
||||||
|
t_mlx mlx;
|
||||||
|
t_game game;
|
||||||
|
t_img img;
|
||||||
|
t_vec2 mapSize;
|
||||||
|
|
||||||
|
if (ac == 2)
|
||||||
|
{
|
||||||
|
ft_getmap(&game, av[1]);
|
||||||
|
if (game.map == NULL)
|
||||||
|
return (ft_put_error());
|
||||||
|
if (mapSize.x == -1)
|
||||||
|
return (ft_put_error());
|
||||||
|
get_player_pos(&game);
|
||||||
|
load_coll(&game);
|
||||||
|
init_game(&game, &mlx, game.mapX, game.mapY);
|
||||||
|
if (load_mlx(&mlx, game.mapX, game.mapY) || load_img(&game, &img))
|
||||||
|
return (ft_put_error());
|
||||||
|
mlx_mouse_hide(mlx.mlx_ptr, mlx.win_ptr);
|
||||||
|
mlx_hook(mlx.win_ptr, 17, 0L, close, &game);
|
||||||
|
mlx_loop_hook(mlx.mlx_ptr, game_loop, &game);
|
||||||
|
mlx_hook(mlx.win_ptr, 02, (1L<<0), key_pressed, &game);
|
||||||
|
mlx_hook(mlx.win_ptr, 03, (1L<<1), key_released, &game);
|
||||||
|
mlx_loop(mlx.mlx_ptr);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
return (ft_put_error());
|
||||||
|
}
|
||||||
35
srcs/player_info.c
Normal file
35
srcs/player_info.c
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* player_info.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: lejulien <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2021/06/10 20:58:48 by lejulien #+# #+# */
|
||||||
|
/* Updated: 2021/06/10 21:07:27 by lejulien ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "so_long.h"
|
||||||
|
|
||||||
|
void
|
||||||
|
get_player_pos(t_game *game)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int j;
|
||||||
|
|
||||||
|
j = -1;
|
||||||
|
while (j++ < game->mapY - 1)
|
||||||
|
{
|
||||||
|
i = -1;
|
||||||
|
while (i++ < game->mapX - 1)
|
||||||
|
{
|
||||||
|
if (game->map[j * game->mapX + i] == 'P')
|
||||||
|
{
|
||||||
|
game->player_pos = set_pos(i, j);
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
game->player_pos = set_pos(-1, -1);
|
||||||
|
}
|
||||||
30
srcs/put_image.c
Normal file
30
srcs/put_image.c
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* put_image.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: lejulien <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2021/06/09 19:26:10 by lejulien #+# #+# */
|
||||||
|
/* Updated: 2021/06/11 20:42:27 by user42 ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "so_long.h"
|
||||||
|
|
||||||
|
void
|
||||||
|
put_image(t_game *g, t_img_d *to_place, t_vec2 pos)
|
||||||
|
{
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
|
||||||
|
y = -1;
|
||||||
|
while (y++ < to_place->height - 1)
|
||||||
|
{
|
||||||
|
x = -1;
|
||||||
|
while (x++ < to_place->width - 1)
|
||||||
|
if (to_place->data[y * to_place->width + x] != -16777216)
|
||||||
|
g->img->canvas->data[(pos.y + y) * g->winX + (pos.x + x)] =
|
||||||
|
to_place->data[y * to_place->width + x];
|
||||||
|
}
|
||||||
|
}
|
||||||
80
srcs/so_long.h
Normal file
80
srcs/so_long.h
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* so_long.h :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: lejulien <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2021/06/09 16:28:51 by lejulien #+# #+# */
|
||||||
|
/* Updated: 2021/06/12 02:47:03 by lejulien ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#ifndef SO_LONG_H
|
||||||
|
# define SO_LONG_H
|
||||||
|
# include <stdlib.h>
|
||||||
|
# include <stdio.h>
|
||||||
|
# include "../mlx/mlx.h"
|
||||||
|
|
||||||
|
typedef struct s_mlx
|
||||||
|
{
|
||||||
|
void *mlx_ptr;
|
||||||
|
void *win_ptr;
|
||||||
|
} t_mlx;
|
||||||
|
|
||||||
|
typedef struct s_vec2
|
||||||
|
{
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
} t_vec2;
|
||||||
|
|
||||||
|
typedef struct s_img_d
|
||||||
|
{
|
||||||
|
void *img_ptr;
|
||||||
|
int *data;
|
||||||
|
int size_l;
|
||||||
|
int bpp;
|
||||||
|
int endian;
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
} t_img_d;
|
||||||
|
|
||||||
|
typedef struct s_img
|
||||||
|
{
|
||||||
|
t_img_d *bg_img;
|
||||||
|
t_img_d *player_img;
|
||||||
|
t_img_d *bloc_img;
|
||||||
|
t_img_d *coll_img;
|
||||||
|
t_img_d *canvas;
|
||||||
|
t_img_d *portal_img;
|
||||||
|
t_img_d *mouse_img;
|
||||||
|
} t_img;
|
||||||
|
|
||||||
|
typedef struct s_game
|
||||||
|
{
|
||||||
|
t_mlx *mlx;
|
||||||
|
t_img *img;
|
||||||
|
char *map;
|
||||||
|
t_vec2 player_pos;
|
||||||
|
int coll;
|
||||||
|
int moves;
|
||||||
|
int t_coll;
|
||||||
|
int mapX;
|
||||||
|
int mapY;
|
||||||
|
int winX;
|
||||||
|
int winY;
|
||||||
|
int key_w;
|
||||||
|
int key_a;
|
||||||
|
int key_s;
|
||||||
|
int key_d;
|
||||||
|
} t_game;
|
||||||
|
|
||||||
|
int game_loop(t_game *game);
|
||||||
|
t_vec2 set_pos(int x, int y);
|
||||||
|
void put_image(t_game *g, t_img_d *to_place, t_vec2 pos);
|
||||||
|
int ft_put_error(void);
|
||||||
|
void ft_getmap(t_game *game, char *path);
|
||||||
|
void get_player_pos(t_game *game);
|
||||||
|
int key_pressed(int keycode, t_game *game);
|
||||||
|
int key_released(int keycode, t_game *game);
|
||||||
|
#endif
|
||||||
23
srcs/vector2.c
Normal file
23
srcs/vector2.c
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* vector2.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: lejulien <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2021/06/10 02:25:59 by lejulien #+# #+# */
|
||||||
|
/* Updated: 2021/06/10 02:28:09 by lejulien ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "so_long.h"
|
||||||
|
|
||||||
|
t_vec2
|
||||||
|
set_pos(int x, int y)
|
||||||
|
{
|
||||||
|
t_vec2 ret;
|
||||||
|
|
||||||
|
ret.x = x;
|
||||||
|
ret.y = y;
|
||||||
|
return (ret);
|
||||||
|
}
|
||||||
3
test.sh
Executable file
3
test.sh
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
gcc -framework OpenGL -framework AppKit ./srcs/main.c ./mlx/libmlx.a
|
||||||
|
./a.out
|
||||||
|
rm a.out
|
||||||
1
test_linux.sh
Executable file
1
test_linux.sh
Executable file
@@ -0,0 +1 @@
|
|||||||
|
clang ./srcs/*.c ./mlx/libmlx.a -D BUFFER_SIZE=8 -lXext -lX11 -fsanitize=address -g3
|
||||||
Reference in New Issue
Block a user