mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2025-12-31 06:30:52 +00:00
basic stuff
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@11 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -8,6 +8,7 @@ LDFLAGS =
|
||||
LIBS =
|
||||
|
||||
L_OBJS = src/ds.o src/core.o
|
||||
L_OBJS += src/window.o
|
||||
|
||||
ifeq ($(TARGET),NetBSD)
|
||||
CFLAGS += -I/usr/X11R7/include -I/usr/pkg/include
|
||||
|
||||
@@ -3,28 +3,12 @@
|
||||
#define __MILSKO_CORE_H__
|
||||
|
||||
#include <Milsko/MachDep.h>
|
||||
|
||||
typedef struct _MilskoClass* MilskoClass;
|
||||
|
||||
#ifdef _MILSKO
|
||||
#include <Milsko/LowLevel.h>
|
||||
|
||||
typedef struct _Milsko* HMILSKO;
|
||||
|
||||
typedef struct _Milsko {
|
||||
HMILSKOLL lowlevel;
|
||||
HMILSKO parent;
|
||||
HMILSKO* children;
|
||||
MilskoClass class;
|
||||
}* HMILSKO;
|
||||
#else
|
||||
typedef void* HMILSKO;
|
||||
#endif
|
||||
|
||||
typedef struct _MilskoClass {
|
||||
}* MilskoClass;
|
||||
#include <Milsko/TypeDef.h>
|
||||
|
||||
MILSKODECL HMILSKO MilskoCreateWidget(MilskoClass class, HMILSKO parent, int x, int y, unsigned int width, unsigned int height);
|
||||
MILSKODECL void MilskoDestroyWidget(HMILSKO handle);
|
||||
MILSKODECL void MilskoLoop(HMILSKO handle);
|
||||
MILSKODECL void MilskoStep(HMILSKO handle);
|
||||
MILSKODECL int MilskoPending(HMILSKO handle);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
#ifndef __MILSKO_LL_H__
|
||||
#define __MILSKO_LL_H__
|
||||
|
||||
#include <Milsko/MachDep.h>
|
||||
#include <Milsko/TypeDef.h>
|
||||
|
||||
#ifdef _MILSKO
|
||||
#ifdef USE_X11
|
||||
#include <Milsko/X11.h>
|
||||
@@ -17,6 +14,9 @@ typedef void* HMILSKOLL;
|
||||
typedef void* HMILSKOCOLOR;
|
||||
#endif
|
||||
|
||||
#include <Milsko/MachDep.h>
|
||||
#include <Milsko/TypeDef.h>
|
||||
|
||||
MILSKODECL HMILSKOLL MilskoLLCreate(HMILSKOLL parent, int x, int y, int width, int height);
|
||||
MILSKODECL void MilskoLLDestroy(HMILSKOLL handle);
|
||||
MILSKODECL void MilskoLLPolygon(HMILSKOLL handle, MilskoPoint* points, int points_count, HMILSKOCOLOR color);
|
||||
@@ -24,5 +24,6 @@ MILSKODECL HMILSKOCOLOR MilskoLLAllocColor(HMILSKOLL handle, int r, int g, int b
|
||||
MILSKODECL void MilskoLLGetXYWH(HMILSKOLL handle, int* x, int* y, unsigned int* w, unsigned int* h);
|
||||
MILSKODECL int MilskoLLPending(HMILSKOLL handle);
|
||||
MILSKODECL void MilskoLLNextEvent(HMILSKOLL handle);
|
||||
MILSKODECL void MilskoLLSleep(int ms);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#ifdef _WIN32
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined(_MILSKO) && defined(_WIN32)
|
||||
#define MILSKODECL extern __declsped(dllexport)
|
||||
|
||||
@@ -6,4 +6,6 @@
|
||||
#include <Milsko/LowLevel.h>
|
||||
#include <Milsko/Core.h>
|
||||
|
||||
#include <Milsko/Window.h>
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,4 +9,24 @@ typedef struct _MilskoPoint {
|
||||
int y;
|
||||
} MilskoPoint;
|
||||
|
||||
typedef struct _MilskoClass* MilskoClass;
|
||||
|
||||
#ifdef _MILSKO
|
||||
#include <Milsko/LowLevel.h>
|
||||
|
||||
typedef struct _Milsko* HMILSKO;
|
||||
|
||||
typedef struct _Milsko {
|
||||
HMILSKOLL lowlevel;
|
||||
HMILSKO parent;
|
||||
HMILSKO* children;
|
||||
MilskoClass class;
|
||||
}* HMILSKO;
|
||||
#else
|
||||
typedef void* HMILSKO;
|
||||
#endif
|
||||
|
||||
typedef struct _MilskoClass {
|
||||
}* MilskoClass, MilskoClassRec;
|
||||
|
||||
#endif
|
||||
|
||||
23
src/core.c
23
src/core.c
@@ -8,10 +8,10 @@ HMILSKO MilskoCreateWidget(MilskoClass class, HMILSKO parent, int x, int y, unsi
|
||||
|
||||
h->parent = parent;
|
||||
h->children = NULL;
|
||||
h->lowlevel = MilskoLLCreate(parent->lowlevel, x, y, width, height);
|
||||
h->lowlevel = MilskoLLCreate(parent == NULL ? NULL : parent->lowlevel, x, y, width, height);
|
||||
h->class = class;
|
||||
|
||||
arrput(parent->children, h);
|
||||
if(parent != NULL) arrput(parent->children, h);
|
||||
|
||||
return h;
|
||||
}
|
||||
@@ -40,3 +40,22 @@ void MilskoDestroyWidget(HMILSKO handle) {
|
||||
MilskoLLDestroy(handle->lowlevel);
|
||||
free(handle);
|
||||
}
|
||||
|
||||
MILSKODECL void MilskoStep(HMILSKO handle){
|
||||
MilskoLLNextEvent(handle->lowlevel);
|
||||
}
|
||||
|
||||
MILSKODECL int MilskoPending(HMILSKO handle){
|
||||
int i;
|
||||
for(i = 0; i < arrlen(handle->children); i++){
|
||||
if(MilskoPending(handle->children[i])) return 1;
|
||||
}
|
||||
return MilskoLLPending(handle->lowlevel);
|
||||
}
|
||||
|
||||
MILSKODECL void MilskoLoop(HMILSKO handle){
|
||||
while(1){
|
||||
MilskoStep(handle);
|
||||
MilskoLLSleep(10);
|
||||
}
|
||||
}
|
||||
|
||||
6
src/window.c
Normal file
6
src/window.c
Normal file
@@ -0,0 +1,6 @@
|
||||
/* $Id$ */
|
||||
#include <Milsko/Milsko.h>
|
||||
|
||||
MilskoClassRec MilskoWindowClassRec = {
|
||||
};
|
||||
MilskoClass MilskoWindowClass = &MilskoWindowClassRec;
|
||||
Reference in New Issue
Block a user