Fixed the color problem of the editor
This commit is contained in:
parent
3a5cadc116
commit
1abca0d4c7
18
Makefile
18
Makefile
|
@ -4,7 +4,7 @@
|
||||||
#
|
#
|
||||||
# Project: lite
|
# Project: lite
|
||||||
#
|
#
|
||||||
# Created on: 14-12-2021 20:40:46
|
# Created on: 15-12-2021 22:58:23
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
|
@ -28,9 +28,9 @@ lite_OBJ := \
|
||||||
|
|
||||||
CC := gcc:bin/gcc
|
CC := gcc:bin/gcc
|
||||||
|
|
||||||
INCPATH := -I.
|
INCPATH := -I. -Isrc
|
||||||
|
|
||||||
CFLAGS := $(INCPATH) -D__USE_INLINE__ -Wall -Werror -Wwrite-strings -Isrc
|
CFLAGS := $(INCPATH) -D__USE_INLINE__ -Wall -Werror -Wwrite-strings
|
||||||
|
|
||||||
|
|
||||||
###################################################################
|
###################################################################
|
||||||
|
@ -66,7 +66,7 @@ realclean:
|
||||||
|
|
||||||
lite: $(lite_OBJ)
|
lite: $(lite_OBJ)
|
||||||
@echo "Linking lite"
|
@echo "Linking lite"
|
||||||
@gcc:bin/gcc -o lite $(lite_OBJ) -llua -lSDL2 -lfreetype -lpthread -lauto
|
@gcc:bin/gcc -o lite $(lite_OBJ) -llua -lSDL2 -lpthread -lauto
|
||||||
@echo "Removing stale debug target: lite"
|
@echo "Removing stale debug target: lite"
|
||||||
@rm -f lite.debug
|
@rm -f lite.debug
|
||||||
|
|
||||||
|
@ -86,16 +86,18 @@ lite: $(lite_OBJ)
|
||||||
|
|
||||||
src/api/api.o: src/api/api.c
|
src/api/api.o: src/api/api.c
|
||||||
|
|
||||||
src/api/renderer.o: src/api/renderer.c
|
src/api/renderer.o: src/api/renderer.c src/api/api.h src/renderer.h \
|
||||||
|
|
||||||
src/api/renderer_font.o: src/api/renderer_font.c
|
|
||||||
|
|
||||||
src/api/system.o: src/api/system.c
|
src/api/renderer_font.o: src/api/renderer_font.c src/api/api.h src/renderer.h \
|
||||||
|
|
||||||
|
|
||||||
|
src/api/system.o: src/api/system.c src/api/api.h
|
||||||
|
|
||||||
src/main.o: src/main.c src/api/api.h src/renderer.h \
|
src/main.o: src/main.c src/api/api.h src/renderer.h \
|
||||||
|
|
||||||
|
|
||||||
src/rencache.o: src/rencache.c src/rencache.h
|
src/rencache.o: src/rencache.c
|
||||||
|
|
||||||
src/renderer.o: src/renderer.c src/lib/stb/stb_truetype.h
|
src/renderer.o: src/renderer.c src/lib/stb/stb_truetype.h
|
||||||
|
|
||||||
|
|
15
lite.cbp
15
lite.cbp
|
@ -1,10 +1,10 @@
|
||||||
<?xml version="1.0" ?>
|
<?xml version="1.0" ?>
|
||||||
<CodeBench_Project name="lite" path="Applications:Programming/workspace/OtherProjects/lite/lite.cbp" created="1387049720" lastmodified="1387055061">
|
<CodeBench_Project name="lite" path="SDH3:Programming/workspace/MyProjects/lite/lite.cbp" created="1387049720" lastmodified="1387152257">
|
||||||
<plugin name="PROGDIR:Plugins/AmigaOS4SDK.CCPlugin" flags="0"/>
|
<plugin name="PROGDIR:Plugins/AmigaOS4SDK.CCPlugin" flags="0"/>
|
||||||
<target/>
|
<target/>
|
||||||
<homedir name="Applications:Programming/workspace/OtherProjects/lite"/>
|
<homedir name="SDH3:Programming/workspace/MyProjects/lite"/>
|
||||||
<includedir name="Applications:Programming/workspace/OtherProjects/lite/src"/>
|
<includedir name="Applications:Programming/workspace/OtherProjects/lite/src"/>
|
||||||
<compiler name="gcc:bin/gcc" switches="-D__USE_INLINE__ -Wall -Werror -Wwrite-strings -Isrc" stack="131072"/>
|
<compiler name="gcc:bin/gcc" switches="-D__USE_INLINE__ -Wall -Werror -Wwrite-strings" stack="131072"/>
|
||||||
<linker switches="-lauto"/>
|
<linker switches="-lauto"/>
|
||||||
<debugger name="SDK:c/gdb"/>
|
<debugger name="SDK:c/gdb"/>
|
||||||
<builder name="SDK:c/make -f"/>
|
<builder name="SDK:c/make -f"/>
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
<file name="src/api/renderer.c" open="0"/>
|
<file name="src/api/renderer.c" open="0"/>
|
||||||
<file name="src/api/renderer_font.c" open="0"/>
|
<file name="src/api/renderer_font.c" open="0"/>
|
||||||
<file name="src/api/system.c" open="0"/>
|
<file name="src/api/system.c" open="0"/>
|
||||||
<file name="src/main.c" open="1" current="1" top="0" left="0" line="119" row="25"/>
|
<file name="src/main.c" open="1" current="1" top="75" left="0" line="97" row="16"/>
|
||||||
<file name="src/rencache.c" open="0"/>
|
<file name="src/rencache.c" open="0"/>
|
||||||
<file name="src/renderer.c" open="0"/>
|
<file name="src/renderer.c" open="0"/>
|
||||||
<file name="src/lib/stb/stb_truetype.c" open="0"/>
|
<file name="src/lib/stb/stb_truetype.c" open="0"/>
|
||||||
|
@ -28,9 +28,9 @@
|
||||||
<flags value="0x0000000000078005"/>
|
<flags value="0x0000000000078005"/>
|
||||||
<buildscript name="Makefile" depth="3" open="0"/>
|
<buildscript name="Makefile" depth="3" open="0"/>
|
||||||
<projectnotes open="0"/>
|
<projectnotes open="0"/>
|
||||||
<buildwindow open="1"/>
|
<buildwindow open="0"/>
|
||||||
<targets>
|
<targets>
|
||||||
<target name="lite" linker="gcc:bin/gcc" switches="-llua -lSDL2 -lfreetype -lpthread -lauto" flags="0x00000002">
|
<target name="lite" linker="gcc:bin/gcc" switches="-llua -lSDL2 -lpthread -lauto" flags="0x00000002">
|
||||||
<file name="src/lib/stb/stb_truetype.c"/>
|
<file name="src/lib/stb/stb_truetype.c"/>
|
||||||
<file name="src/api/renderer.c"/>
|
<file name="src/api/renderer.c"/>
|
||||||
<file name="src/api/renderer_font.c"/>
|
<file name="src/api/renderer_font.c"/>
|
||||||
|
@ -41,6 +41,9 @@
|
||||||
<file name="src/renderer.c"/>
|
<file name="src/renderer.c"/>
|
||||||
</target>
|
</target>
|
||||||
</targets>
|
</targets>
|
||||||
|
<includepath>
|
||||||
|
<include path="src"/>
|
||||||
|
</includepath>
|
||||||
<logfile name="RAM Disk:Build.log"/>
|
<logfile name="RAM Disk:Build.log"/>
|
||||||
<search lastsearch="stbtt_Scale" sensecase="1" replace_state="0"/>
|
<search lastsearch="stbtt_Scale" sensecase="1" replace_state="0"/>
|
||||||
</CodeBench_Project>
|
</CodeBench_Project>
|
||||||
|
|
|
@ -1,15 +1,9 @@
|
||||||
#ifndef API_H
|
#ifndef API_H
|
||||||
#define API_H
|
#define API_H
|
||||||
|
|
||||||
#if __amigaos4__
|
|
||||||
#include "lua.h"
|
|
||||||
#include "lauxlib.h"
|
|
||||||
#include "lualib.h"
|
|
||||||
#else
|
|
||||||
#include "lib/lua52/lua.h"
|
#include "lib/lua52/lua.h"
|
||||||
#include "lib/lua52/lauxlib.h"
|
#include "lib/lua52/lauxlib.h"
|
||||||
#include "lib/lua52/lualib.h"
|
#include "lib/lua52/lualib.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#define API_TYPE_FONT "Font"
|
#define API_TYPE_FONT "Font"
|
||||||
|
|
||||||
|
|
|
@ -270,7 +270,7 @@ static inline RenColor blend_pixel2(RenColor dst, RenColor src, RenColor color)
|
||||||
for (int j = y1; j < y2; j++) { \
|
for (int j = y1; j < y2; j++) { \
|
||||||
for (int i = x1; i < x2; i++) { \
|
for (int i = x1; i < x2; i++) { \
|
||||||
*d = expr; \
|
*d = expr; \
|
||||||
d++; \
|
d++; \
|
||||||
} \
|
} \
|
||||||
d += dr; \
|
d += dr; \
|
||||||
}
|
}
|
||||||
|
@ -284,17 +284,22 @@ void ren_draw_rect(RenRect rect, RenColor color) {
|
||||||
int y2 = rect.y + rect.height;
|
int y2 = rect.y + rect.height;
|
||||||
x2 = x2 > clip.right ? clip.right : x2;
|
x2 = x2 > clip.right ? clip.right : x2;
|
||||||
y2 = y2 > clip.bottom ? clip.bottom : y2;
|
y2 = y2 > clip.bottom ? clip.bottom : y2;
|
||||||
|
printf("DBG: rect\tx1: %d\ty1: %d\tx2:%d\ty2:%d\n", x1, y1, x2, y2);
|
||||||
SDL_Surface *surf = SDL_GetWindowSurface(window);
|
SDL_Surface *surf = SDL_GetWindowSurface(window);
|
||||||
RenColor *d = (RenColor*) surf->pixels;
|
RenColor *d = (RenColor*) surf->pixels;
|
||||||
d += x1 + y1 * surf->w;
|
printf("DBG: surf\tr: %d\tg: %d\tb:%d\ta:%d\tw: %d\n", d->r, d->g, d->b, d->a, surf->w);
|
||||||
int dr = surf->w - (x2 - x1);
|
d += x1 + y1 * (surf->pitch / 4);
|
||||||
|
//printf("DBG: surf\tr: %d\tg: %d\tb:%d\ta:%d\n", d->r, d->g, d->b, d->a);
|
||||||
|
int dr = (surf->pitch / 4) - (x2 - x1);
|
||||||
|
printf("DBG: r: %d\tg: %d\tb:%d\ta:%d\n", color.r, color.g, color.b, color.a);
|
||||||
if (color.a == 0xff) {
|
if (color.a == 0xff) {
|
||||||
rect_draw_loop(color);
|
//rect_draw_loop(color);
|
||||||
|
SDL_Rect rect = { x1, y1, x2 - x1, y2 - y1 };
|
||||||
|
SDL_FillRect(surf, &rect, SDL_MapRGBA(surf->format, color.r, color.g, color.b, color.a));
|
||||||
} else {
|
} else {
|
||||||
rect_draw_loop(blend_pixel(*d, color));
|
rect_draw_loop(blend_pixel(*d, color));
|
||||||
}
|
}
|
||||||
|
printf("======================\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue