TinyGL: newlib

Gears: newlib

git-svn-id: svn://kolibrios.org@8528 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
maxcodehack 2021-01-09 09:20:28 +00:00
parent 3117bdc927
commit 7481a0ec95
7 changed files with 36 additions and 69 deletions

View File

@ -1,7 +0,0 @@
if tup.getconfig("NO_GCC") ~= "" then return end
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR")
tup.include(HELPERDIR .. "/use_gcc.lua")
tup.include(HELPERDIR .. "/use_menuetlibc.lua")
tup.include(HELPERDIR .. "/use_tinygl.lua")
compile_gcc{"main.cpp", "fps.cpp"}
link_gcc("cubeline")

View File

@ -1,7 +0,0 @@
if tup.getconfig("NO_GCC") ~= "" then return end
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR")
tup.include(HELPERDIR .. "/use_gcc.lua")
tup.include(HELPERDIR .. "/use_menuetlibc.lua")
tup.include(HELPERDIR .. "/use_tinygl.lua")
compile_gcc{"*.cpp"}
link_gcc("cubetext")

View File

@ -1,15 +0,0 @@
OUTFILE = gears
SRCS = main.cpp fps.cpp
OBJS = $(SRCS:.cpp=.o)
CPPFLAGS = -I$(TINYGL)\include -O2
LIBR = TinyGL m
LIBS = $(addprefix -l,$(LIBR)) -L$(TINYGL)\lib
all: $(OUTFILE)
objcopy $(OUTFILE) -O binary
include $(MENUETDEV)/makefiles/Makefile_for_cpp_program

View File

@ -1,26 +1,2 @@
#pragma pack(push, 1)
struct process_table_entry_
{
__u32 cpu_usage;
__u16 pos_in_windowing_stack;
__u16 win_stack_val_at_ecx;
__u16 rez1;
char name[11];
__u8 rez2;
__u32 memstart;
__u32 memused;
__u32 pid;
__u32 winx_start,winy_start;
__u32 winx_size,winy_size;
__u8 slot;
__u8 rez3;
__u32 clarx_start,clary_start;
__u32 clarx_size,clary_size;
__u8 win_condition;
__u8 buf[955];
};
#pragma pack(pop)
#define TYPEWIN(D,C,B,A,Y,RR,GG,BB) (D<<31)|(C<<30)|(B<<29)|(A<<28)|(Y<<24)|\ #define TYPEWIN(D,C,B,A,Y,RR,GG,BB) (D<<31)|(C<<30)|(B<<29)|(A<<28)|(Y<<24)|\
(RR<<16)|(GG<<8)|BB (RR<<16)|(GG<<8)|BB

View File

@ -1,7 +1,11 @@
if tup.getconfig("NO_GCC") ~= "" then return end if tup.getconfig("NO_GCC") ~= "" then return end
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR") HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR")
tup.include(HELPERDIR .. "/use_gcc.lua") tup.include(HELPERDIR .. "/use_gcc.lua")
tup.include(HELPERDIR .. "/use_menuetlibc.lua") tup.include(HELPERDIR .. "/use_newlib.lua")
tup.include(HELPERDIR .. "/use_tinygl.lua") tup.include(HELPERDIR .. "/use_tinygl.lua")
LIBS = "-lstdc++ -lsupc++ " .. LIBS
LDFLAGS = LDFLAGS .. " --subsystem native"
compile_gcc{"fps.cpp", "main.cpp"} compile_gcc{"fps.cpp", "main.cpp"}
link_gcc("gears") link_gcc("gears")

View File

@ -12,7 +12,7 @@ iadn@bk.ru
* Brian Paul * Brian Paul
*/ */
#include<menuet/os.h> #include <kos32sys.h>
#include <kosgl.h> //TinyGL #include <kosgl.h> //TinyGL
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
@ -41,7 +41,7 @@ char *fps = "FPS:";
unsigned char FullScreen = 0; unsigned char FullScreen = 0;
unsigned char skin = 3; unsigned char skin = 3;
process_table_entry_* pri; proc_info* pri;
KOSGLContext cgl; KOSGLContext cgl;
static GLfloat view_rotx=20.0, view_roty=30.0, view_rotz=0.0; static GLfloat view_rotx=20.0, view_roty=30.0, view_rotz=0.0;
@ -219,11 +219,11 @@ void init( void )
void reshape() void reshape()
{ {
__menuet__get_process_table((process_table_entry*)pri,-1); get_proc_info((char*)pri);
glViewport(0, 0, pri->winx_size, pri->winy_size-20); glViewport(0, 0, pri->width, pri->height-20);
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glLoadIdentity(); glLoadIdentity();
gluPerspective(45.0, (GLfloat)pri->winx_size/pri->winy_size, 1.0, 60.0); gluPerspective(45.0, (GLfloat)pri->width/pri->height, 1.0, 60.0);
glTranslatef( 0.0, 0.0, 20.0 ); glTranslatef( 0.0, 0.0, 20.0 );
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
@ -235,26 +235,42 @@ void disabletgl()
delete pri; delete pri;
} }
void kos_text(int x, int y, int color, const char* text, int len)
{
asm volatile ("int $0x40"::"a"(4),"b"((x<<16) | y),"c"(color),"d"((unsigned long)text),"S"(len));
};
void Title() void Title()
{ {
__menuet__write_text(300,8,0x10ffffff,fps,strlen(fps)); kos_text(300,8,0x10ffffff,fps,strlen(fps));
__menuet__write_text(8,8,0x10ffffff,title1,strlen(title1)); kos_text(180,8,0x00ffffff,title2,strlen(title2));
__menuet__write_text(180,8,0x00ffffff,title2,strlen(title2)); kos_text(600,8,0x00ffffff,title3,strlen(title3));
__menuet__write_text(600,8,0x00ffffff,title3,strlen(title3)); }
void kol_wnd_define(unsigned x, unsigned y, unsigned w, unsigned h, unsigned cs, unsigned b, char *t)
{
asm volatile ("int $0x40"::"a"(0), "b"(x*65536+w), "c"(y*65536+h), "d"(cs), "D"(t), "S"(b) );
} }
void draw_window(void) void draw_window(void)
{ {
// start redraw // start redraw
__menuet__window_redraw(1); begin_draw();
// define&draw window // define&draw window
__menuet__define_window(win.x,win.y,win.dx,win.dy,TYPEWIN(0,0,0,1,skin,0,0,0),0,0); kol_wnd_define(win.x,win.y,win.dx,win.dy,TYPEWIN(0,0,0,1,skin,0,0,0),0,title1);
// end redraw // end redraw
__menuet__window_redraw(2); end_draw();
// display string // display string
Title(); Title();
} }
int kos_get_key()
{
unsigned short __ret;
asm volatile("int $0x40":"=a"(__ret):"0"(2));
if(!(__ret & 0xFF)) return (__ret>>8)&0xFF; else return 0;
}
int main(void) int main(void)
{ {
@ -270,7 +286,7 @@ int main(void)
init(); init();
pri=new process_table_entry_; pri = new proc_info;
SysCall(66,1,1); SysCall(66,1,1);
reshape(); reshape();
@ -315,7 +331,7 @@ do{
break; break;
case 2: case 2:
switch(__menuet__getkey()){ switch(kos_get_key()){
case KEY_F: case KEY_F:
if(!FullScreen){ if(!FullScreen){

View File

@ -1,7 +1,7 @@
if tup.getconfig("NO_GCC") ~= "" then return end if tup.getconfig("NO_GCC") ~= "" then return end
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../../.." or tup.getconfig("HELPERDIR") HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../../.." or tup.getconfig("HELPERDIR")
tup.include(HELPERDIR .. "/use_gcc.lua") tup.include(HELPERDIR .. "/use_gcc.lua")
tup.include(HELPERDIR .. "/use_menuetlibc.lua") tup.include(HELPERDIR .. "/use_newlib.lua")
INCLUDES = INCLUDES .. " -I../include" INCLUDES = INCLUDES .. " -I../include"
compile_gcc("*.c") compile_gcc("*.c")
tup.rule(OBJS, "kos32-ar rcs %o %f", {"../lib/libTinyGL.a", "../<>"}) tup.rule(OBJS, "kos32-ar rcs %o %f", {"../lib/libTinyGL.a", "../<>"})