forked from PocketSprite/8bkc-gnuboy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Long overdue update to new gint/fxsdk
It seems to work fine, it even handles high overclocks Signed-off-by: djpadbit <[email protected]>
- Loading branch information
Showing
32 changed files
with
210 additions
and
301 deletions.
There are no files selected for viewing
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,98 +1,9 @@ | ||
#include <stdlib.h> | ||
#include <string.h> | ||
#include <stdarg.h> | ||
#include "defs.h" | ||
#include <keyboard.h> | ||
#include <display.h> | ||
#include <gray.h> | ||
#include "lcd.h" | ||
#include <gint/display.h> | ||
#include "disp.h" | ||
|
||
void mprint(int x,int y, const char* fmt, ...) | ||
int text_length(const char *str) | ||
{ | ||
if(x < 1 || x > 21 || y < 1 || y > 8) return; | ||
char k[50]; | ||
va_list args; | ||
va_start(args, fmt); | ||
vsprintf(k,fmt,args); | ||
va_end(args); | ||
if (lcd_gray_enabled) gtext(x * 6 - 5, y * 8 - 8, k); | ||
else dtext(x * 6 - 5, y * 8 - 8, k); | ||
} | ||
|
||
void mprintp(int x,int y, const char* fmt, ...) | ||
{ | ||
if(x < 0 || x > 128 || y < 0 || y > 64) return; | ||
char k[50]; | ||
va_list args; | ||
va_start(args, fmt); | ||
vsprintf(k,fmt,args); | ||
va_end(args); | ||
if (lcd_gray_enabled) gtext(x, y, k); | ||
else dtext(x, y, k); | ||
} | ||
|
||
void mtext(int x, int y, const char *str) | ||
{ | ||
if (lcd_gray_enabled) gtext(x, y, str); | ||
else dtext(x, y, str); | ||
} | ||
|
||
void mclear() | ||
{ | ||
if (lcd_gray_enabled) gclear(); | ||
else dclear(); | ||
} | ||
|
||
void mupdate() | ||
{ | ||
if (lcd_gray_enabled) gupdate(); | ||
else dupdate(); | ||
} | ||
|
||
//Gint's gline and dline don't behave like they should so in the meantime i'll just use that | ||
//https://rosettacode.org/wiki/Bitmap/Bresenham%27s_line_algorithm#C | ||
void dline_oth(int x0, int y0, int x1, int y1,color_t op) | ||
{ | ||
int dx = abs(x1-x0), sx = x0<x1 ? 1 : -1; | ||
int dy = abs(y1-y0), sy = y0<y1 ? 1 : -1; | ||
int err = (dx>dy ? dx : -dy)/2, e2; | ||
for(;;){ | ||
dpixel(x0,y0,op); | ||
if (x0==x1 && y0==y1) break; | ||
e2 = err; | ||
if (e2 >-dx) { err -= dy; x0 += sx; } | ||
if (e2 < dy) { err += dx; y0 += sy; } | ||
} | ||
} | ||
|
||
void gline_oth(int x0, int y0, int x1, int y1,color_t op) | ||
{ | ||
int dx = abs(x1-x0), sx = x0<x1 ? 1 : -1; | ||
int dy = abs(y1-y0), sy = y0<y1 ? 1 : -1; | ||
int err = (dx>dy ? dx : -dy)/2, e2; | ||
for(;;){ | ||
gpixel(x0,y0,op); | ||
if (x0==x1 && y0==y1) break; | ||
e2 = err; | ||
if (e2 >-dx) { err -= dy; x0 += sx; } | ||
if (e2 < dy) { err += dx; y0 += sy; } | ||
} | ||
} | ||
|
||
void mline_oth(int x0, int y0, int x1, int y1,color_t op) | ||
{ | ||
if (lcd_gray_enabled) gline_oth(x0,y0,x1,y1,op); | ||
else dline_oth(x0,y0,x1,y1,op); | ||
} | ||
|
||
void mline(int x1, int y1, int x2, int y2, color_t _operator) | ||
{ | ||
if (lcd_gray_enabled) gline(x1,y1,x2,y2,_operator); | ||
else dline(x1,y1,x2,y2,_operator); | ||
} | ||
|
||
void mrect(int x1, int y1, int x2, int y2, color_t _operator) | ||
{ | ||
if (lcd_gray_enabled) grect(x1,y1,x2,y2,_operator); | ||
else drect(x1,y1,x2,y2,_operator); | ||
int l; | ||
dsize(str,NULL,&l,NULL); | ||
return l; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
#ifndef __DISP_H__ | ||
#define __DISP_H__ | ||
|
||
#include <display.h> | ||
#include <gint/display.h> | ||
|
||
void mprint(int x,int y, const char* fmt, ...); | ||
void mprintp(int x,int y, const char* fmt, ...); | ||
void mtext(int x, int y, const char *str); | ||
void mclear(); | ||
void mupdate(); | ||
void dline_oth(int x0, int y0, int x1, int y1,color_t op); | ||
void gline_oth(int x0, int y0, int x1, int y1,color_t op); | ||
void mline_oth(int x0, int y0, int x1, int y1,color_t op); | ||
void mline(int x1, int y1, int x2, int y2, color_t _operator); | ||
void mrect(int x1, int y1, int x2, int y2, color_t _operator); | ||
#define mprint(x,y,fmt, ...) dprint((x)*6-5, (y)*8-8, C_BLACK, fmt, ##__VA_ARGS__) | ||
#define mprintp(x,y,fmt, ...) dprint(x, y, C_BLACK, fmt, ##__VA_ARGS__) | ||
#define mclear() dclear(C_WHITE) | ||
#define mupdate() dupdate() | ||
#define mline(x0,y0,x1,y1,op) dline(x0,y0,x1,y1,op); | ||
#define mrect(x0,y0,x1,y1,op) drect(x0,y0,x1,y1,op); | ||
|
||
int text_length(const char *str); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
#ifndef __FXSYS_H__ | ||
#define __FXSYS_H__ | ||
|
||
#include <ctype.h> | ||
//#include <ctype.h> | ||
|
||
#define TIMER_FREQ 2000 | ||
#define TIMER_DELAY_US ((1.0/(double)TIMER_FREQ)*1000000.0) | ||
|
||
extern unsigned long timertime; | ||
|
||
void timer_setup(); | ||
void timer_startup(); | ||
void timer_cleanup(); | ||
|
||
#endif |
Oops, something went wrong.