Subversion Repositories Kolibri OS

Rev

Rev 8495 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8495 Rev 9202
Line 1... Line 1...
1
#include 
1
#include 
2
#include 
2
#include 
3
#include 
3
#include 
4
#include 
-
 
5
#include "SDL.h"
4
#include "SDL.h"
6
#include "SDL_error.h"
5
#include "SDL_error.h"
7
#include "SDL_video.h"
6
#include "SDL_video.h"
8
#include "SDL_mouse.h"
7
#include "SDL_mouse.h"
9
#include "SDL_sysvideo.h"
8
#include "SDL_sysvideo.h"
Line 29... Line 28...
29
 
28
 
30
#ifdef KEEP_OBSOLETE_STYLE3
29
#ifdef KEEP_OBSOLETE_STYLE3
31
static int IsStyle4Available=0;
30
static int IsStyle4Available=0;
Line 32... Line -...
32
#endif
-
 
33
 
-
 
34
void kol_define_window(unsigned short x1,unsigned short y1,unsigned short xsize,unsigned short ysize,
-
 
35
     unsigned long body_color,unsigned long grab_color,unsigned long frame_color)
-
 
36
{
-
 
37
 unsigned long a,b;
-
 
38
 a=(x1<<16)|xsize;
-
 
39
 b=(y1<<16)|ysize;
-
 
40
 __asm__ __volatile__("int $0x40"::"a"(0),"b"(a),"c"(b),"d"(body_color),"S"(grab_color),
-
 
41
                      "D"(frame_color));
-
 
42
}
31
#endif
43
 
32
 
44
void MenuetOS_SDL_RepaintWnd(void)
33
void MenuetOS_SDL_RepaintWnd(void)
45
{
34
{
46
 begin_draw();
35
 __kos__window_redraw(1);
47
 kol_define_window(1,1,vm_suf->hidden->win_size_x+9,vm_suf->hidden->win_size_y+get_skinh()+4,
36
 __kos__define_window(1,1,vm_suf->hidden->win_size_x+9,vm_suf->hidden->win_size_y+get_skinh()+4,
48
#ifdef KEEP_OBSOLETE_STYLE3
37
#ifdef KEEP_OBSOLETE_STYLE3
49
 	IsStyle4Available?0x34000000:0x33000000
38
 	IsStyle4Available?0x34000000:0x33000000
50
#else
39
#else
51
	0x34000000
40
	0x34000000
Line 52... Line 41...
52
#endif
41
#endif
Line 53... Line 42...
53
 	,0,(int)vm_suf->hidden->__title);
42
 	,0,(int)vm_suf->hidden->__title);
54
 
43
 
55
 // __asm__ __volatile__("int3");
44
 // __asm__ __volatile__("int3");
56
 
45
 
57
 if(vm_suf && vm_suf->hidden->__video_buffer)
46
 if(vm_suf && vm_suf->hidden->__video_buffer)
Line 58... Line 47...
58
  draw_bitmap(vm_suf->hidden->__video_buffer, 0,0,
47
   __kos__draw_bitmap(vm_suf->hidden->__video_buffer, 0,0,
59
   vm_suf->hidden->win_size_x,vm_suf->hidden->win_size_y);
48
   vm_suf->hidden->win_size_x,vm_suf->hidden->win_size_y);
60
 end_draw();
49
   __kos__window_redraw(2);
Line 80... Line 69...
80
 
69
 
81
static void MenuetOS_DirectUpdate(_THIS,int numrects,SDL_Rect * rects)
70
static void MenuetOS_DirectUpdate(_THIS,int numrects,SDL_Rect * rects)
82
{
71
{
83
 if(numrects)
72
 if(numrects)
84
 {
73
 {
85
  draw_bitmap(this->hidden->__video_buffer, 0,0,
74
   __kos__draw_bitmap(this->hidden->__video_buffer, 0,0,
86
   vm_suf->hidden->win_size_x,vm_suf->hidden->win_size_y);
75
   vm_suf->hidden->win_size_x,vm_suf->hidden->win_size_y);
87
 }
76
 }
Line 88... Line 77...
88
}
77
}
Line 109... Line 98...
109
{
98
{
110
 this->hidden->__title=(char *)title;
99
 this->hidden->__title=(char *)title;
111
 if(was_initialized) __asm__("int $0x40"::"a"(71),"b"(1),"c"(title));
100
 if(was_initialized) __asm__("int $0x40"::"a"(71),"b"(1),"c"(title));
112
}
101
}
Line -... Line 102...
-
 
102
 
-
 
103
void debug_board_write_byte(const char ch){
-
 
104
    __asm__ __volatile__(
-
 
105
        "int $0x40"
-
 
106
        ::"a"(63), "b"(1), "c"(ch));
-
 
107
}
-
 
108
 
-
 
109
void debug_board_write_str(const char* str){
-
 
110
    while(*str)
-
 
111
        debug_board_write_byte(*str++);
-
 
112
}
113
 
113
 
114
SDL_Surface * MenuetOS_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags)
114
SDL_Surface * MenuetOS_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags)
115
{
115
{
116
 int ly;
116
 int ly;
117
 char * lx;
117
 char * lx;
Line 121... Line 121...
121
 current->h=height;
121
 current->h=height;
122
 current->pitch=width*(bpp>>3);
122
 current->pitch=width*(bpp>>3);
Line 123... Line 123...
123
 
123
 
124
 char info[100];
124
 char info[100];
125
 sprintf(info, "width = %d, height = %d, pitch = %d, bpp = %d\n", current->w, current->h, current->pitch, bpp);
-
 
126
 
-
 
127
 void debug_board_write_byte(const char ch){
-
 
128
   __asm__ __volatile__(
-
 
129
			"int $0x40"
-
 
130
			:
-
 
131
			:"a"(63), "b"(1), "c"(ch));
-
 
132
 }
-
 
133
 
-
 
134
 void debug_board_write_str(const char* str){
-
 
135
   while(*str)
-
 
136
     debug_board_write_byte(*str++);
-
 
137
 }
-
 
138
 
125
 sprintf(info, "width = %d, height = %d, pitch = %d, bpp = %d\n", current->w, current->h, current->pitch, bpp);
139
 debug_board_write_str(info);
126
 debug_board_write_str(info);
Line 140... Line 127...
140
 // __asm__ __volatile__("int3");
127
 // __asm__ __volatile__("int3");
141
 
128
 
Line 157... Line 144...
157
  unsigned newwidth = width+9;
144
  unsigned newwidth = width+9;
158
  __asm__("int $0x40"::"a"(67),"b"(-1),"c"(-1),"d"(newwidth),"S"(newheight));
145
  __asm__("int $0x40"::"a"(67),"b"(-1),"c"(-1),"d"(newwidth),"S"(newheight));
159
 }
146
 }
160
 else
147
 else
161
 {
148
 {
162
  set_wanted_events_mask(0x27);
149
   __kos__set_events_mask(0x27);
163
  was_initialized=1;
150
  was_initialized=1;
164
  MenuetOS_SDL_RepaintWnd();
151
  MenuetOS_SDL_RepaintWnd();
165
 }
152
 }
166
 return current;
153
 return current;
167
}
154
}
Line 225... Line 212...
225
 return 0;
212
 return 0;
226
}
213
}
Line 227... Line 214...
227
 
214
 
228
static int MenuetOS_FlipHWSurface(_THIS,SDL_Surface * surface)
215
static int MenuetOS_FlipHWSurface(_THIS,SDL_Surface * surface)
229
{
216
{
230
 draw_bitmap(surface->pixels, 0,0,surface->w,surface->h);
217
 __kos__draw_bitmap(surface->pixels, 0,0,surface->w,surface->h);
231
 return 0;
218
 return 0;
Line 232... Line 219...
232
}
219
}
233
 
220