mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 22:31:05 +00:00
Do not use PS* functions.
This commit is contained in:
parent
4dd0bf5804
commit
73b89ba0b8
4 changed files with 109 additions and 71 deletions
|
@ -1,7 +1,3 @@
|
|||
|
||||
#include <AppKit/NSGraphics.h>
|
||||
#include <AppKit/DPSOperators.h>
|
||||
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "Clipper.h"
|
||||
|
@ -12,6 +8,7 @@
|
|||
#include "QuakeEd.h"
|
||||
|
||||
id clipper_i;
|
||||
extern NSBezierPath *path;
|
||||
|
||||
@implementation Clipper
|
||||
|
||||
|
@ -185,41 +182,52 @@ XYDrag
|
|||
-XYDrawSelf
|
||||
{
|
||||
int i;
|
||||
char text[8];
|
||||
NSMutableDictionary *attribs = [NSMutableDictionary dictionary];
|
||||
|
||||
PSsetrgbcolor (1, 0.5, 0);
|
||||
[[NSColor colorWithCalibratedRed: 1.0 green: 0.5 blue: 0.0 alpha: 1.0]
|
||||
set];
|
||||
|
||||
[[NSFont systemFontOfSize: 10 / [xyview_i currentScale]] set];
|
||||
PSrotate (0);
|
||||
|
||||
[path removeAllPoints];
|
||||
for (i = 0; i < num; i++) {
|
||||
PSmoveto (pos[i][0] - 4, pos[i][1] - 4);
|
||||
sprintf (text, "%i", i);
|
||||
PSshow (text);
|
||||
PSstroke ();
|
||||
PSarc (pos[i][0], pos[i][1], 10, 0, 360);
|
||||
PSstroke ();
|
||||
NSString *s = [NSString stringWithFormat: @"%i", i];
|
||||
[s drawAtPoint: NSMakePoint (pos[i][0] - 4, pos[i][1] - 4)
|
||||
withAttributes: attribs];
|
||||
//[path moveToPoint: NSMakePoint (pos[i][0] - 4, pos[i][1] - 4)];
|
||||
[path appendBezierPathWithArcWithCenter: NSMakePoint (pos[i][0],
|
||||
pos[i][1])
|
||||
radius: 10
|
||||
startAngle: 0
|
||||
endAngle: 360];
|
||||
}
|
||||
[path stroke];
|
||||
return self;
|
||||
}
|
||||
|
||||
-ZDrawSelf
|
||||
{
|
||||
int i;
|
||||
char text[8];
|
||||
NSMutableDictionary *attribs = [NSMutableDictionary dictionary];
|
||||
|
||||
PSsetrgbcolor (1, 0.5, 0);
|
||||
[[NSFont systemFontOfSize: 10 / [zview_i currentScale]] set];
|
||||
PSrotate (0);
|
||||
[[NSColor colorWithCalibratedRed: 1.0 green: 0.5 blue: 0.0 alpha: 1.0]
|
||||
set];
|
||||
|
||||
[[NSFont systemFontOfSize: 10 / [xyview_i currentScale]] set];
|
||||
|
||||
[path removeAllPoints];
|
||||
for (i = 0; i < num; i++) {
|
||||
PSmoveto (-28 + i * 8 - 4, pos[i][2] - 4);
|
||||
sprintf (text, "%i", i);
|
||||
PSshow (text);
|
||||
PSstroke ();
|
||||
PSarc (-28 + i * 8, pos[i][2], 10, 0, 360);
|
||||
PSstroke ();
|
||||
NSString *s = [NSString stringWithFormat: @"%i", i];
|
||||
[s drawAtPoint: NSMakePoint (-28 + i * 8 - 4, pos[i][2] - 4)
|
||||
withAttributes: attribs];
|
||||
//[path moveToPoint: NSMakePoint (pos[i][0] - 4, pos[i][1] - 4)];
|
||||
[path appendBezierPathWithArcWithCenter: NSMakePoint (-28 + i * 8,
|
||||
pos[i][2])
|
||||
radius: 10
|
||||
startAngle: 0
|
||||
endAngle: 360];
|
||||
}
|
||||
[path stroke];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
@ -486,7 +486,10 @@ lineflush (void)
|
|||
if ([path isEmpty])
|
||||
return;
|
||||
// endUserPath (upath, dps_ustroke);
|
||||
PSsetrgbcolor (cur_linecolor[0], cur_linecolor[1], cur_linecolor[2]);
|
||||
[[NSColor colorWithCalibratedRed: cur_linecolor[0]
|
||||
green: cur_linecolor[1]
|
||||
blue: cur_linecolor[2]
|
||||
alpha: 1.0] set];
|
||||
[path stroke];
|
||||
[path removeAllPoints];
|
||||
}
|
||||
|
@ -531,7 +534,7 @@ Rect is in global world (unscaled) coordinates
|
|||
{
|
||||
int x, y, stopx, stopy;
|
||||
float top, bottom, right, left;
|
||||
char text[10];
|
||||
NSMutableDictionary *attribs = [NSMutableDictionary dictionary];
|
||||
BOOL showcoords;
|
||||
NSPoint point;
|
||||
|
||||
|
@ -542,7 +545,8 @@ Rect is in global world (unscaled) coordinates
|
|||
right = rect.origin.x + rect.size.width + 2;
|
||||
top = rect.origin.y + rect.size.height + 2;
|
||||
|
||||
PSsetlinewidth (0.15);
|
||||
[path removeAllPoints];
|
||||
[path setLineWidth: 0.15];
|
||||
|
||||
//
|
||||
// grid
|
||||
|
@ -589,14 +593,18 @@ Rect is in global world (unscaled) coordinates
|
|||
[path lineToPoint:point];
|
||||
}
|
||||
// endUserPath (upath, dps_ustroke);
|
||||
PSsetrgbcolor (0.8, 0.8, 1.0); // thin grid color
|
||||
[[NSColor colorWithCalibratedRed: 0.8
|
||||
green: 0.8
|
||||
blue: 1.0
|
||||
alpha: 1.0] set]; // thin grid color
|
||||
[path stroke];
|
||||
|
||||
}
|
||||
//
|
||||
// tiles
|
||||
//
|
||||
PSsetgray (0); // for text
|
||||
[[NSColor colorWithCalibratedWhite: 0.0 / 16.0 alpha: 1.0]
|
||||
set]; // for text
|
||||
|
||||
if (scale > 4.0 / 64) {
|
||||
y = floor (bottom / 64);
|
||||
|
@ -621,9 +629,8 @@ Rect is in global world (unscaled) coordinates
|
|||
|
||||
for (; y <= stopy; y += 64) {
|
||||
if (showcoords) {
|
||||
sprintf (text, "%i", y);
|
||||
PSmoveto (left, y);
|
||||
PSshow (text);
|
||||
NSString *s = [NSString stringWithFormat: @"%i", y];
|
||||
[s drawAtPoint: NSMakePoint (left, y) withAttributes: attribs];
|
||||
}
|
||||
[path moveToPoint:point];
|
||||
point.x = right;
|
||||
|
@ -632,9 +639,9 @@ Rect is in global world (unscaled) coordinates
|
|||
|
||||
for (; x <= stopx; x += 64) {
|
||||
if (showcoords) {
|
||||
sprintf (text, "%i", x);
|
||||
PSmoveto (x, bottom + 2);
|
||||
PSshow (text);
|
||||
NSString *s = [NSString stringWithFormat: @"%i", x];
|
||||
[s drawAtPoint: NSMakePoint (x, bottom + 2)
|
||||
withAttributes: attribs];
|
||||
}
|
||||
point.x = x;
|
||||
point.y = top;
|
||||
|
@ -644,9 +651,11 @@ Rect is in global world (unscaled) coordinates
|
|||
}
|
||||
|
||||
// endUserPath (upath, dps_ustroke);
|
||||
PSsetgray (12.0 / 16);
|
||||
[[NSColor colorWithCalibratedWhite: 12.0 / 16.0 alpha: 1.0]
|
||||
set];
|
||||
[path stroke];
|
||||
}
|
||||
[path setLineWidth: 1];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -663,6 +672,7 @@ drawWire
|
|||
id ent, brush;
|
||||
vec3_t mins, maxs;
|
||||
BOOL drawnames;
|
||||
NSMutableDictionary *attribs = [NSMutableDictionary dictionary];
|
||||
|
||||
drawnames =[quakeed_i showNames];
|
||||
|
||||
|
@ -701,10 +711,13 @@ drawWire
|
|||
if (i > 0 && drawnames) { // draw entity names
|
||||
brush =[ent objectAtIndex:0];
|
||||
if (![brush regioned]) {
|
||||
const char *classname = [ent valueForQKey:"classname"];
|
||||
NSString *s = [NSString stringWithCString: classname];
|
||||
[[NSColor colorWithCalibratedWhite: 0.0 / 16.0 alpha: 1.0]
|
||||
set];
|
||||
[brush getMins: mins maxs:maxs];
|
||||
PSmoveto (mins[0], mins[1]);
|
||||
PSsetrgbcolor (0, 0, 0);
|
||||
PSshow ([ent valueForQKey:"classname"]);
|
||||
[s drawAtPoint: NSMakePoint (mins[0], mins[1])
|
||||
withAttributes: attribs];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -810,9 +823,7 @@ NSRect xy_draw_rect;
|
|||
newrect.size.width = newrect.size.height = -2 * 99999;
|
||||
|
||||
// setup for text
|
||||
// PSselectfont("Helvetica-Medium",10/scale);
|
||||
[[NSFont systemFontOfSize: 10] set];
|
||||
PSrotate (0);
|
||||
|
||||
if (drawmode == dr_texture || drawmode == dr_flat)
|
||||
[self drawSolid];
|
||||
|
|
|
@ -22,6 +22,8 @@ extern float zplanedir;
|
|||
float scale;
|
||||
|
||||
vec3_t origin;
|
||||
|
||||
NSBezierPath *checker;
|
||||
}
|
||||
|
||||
-clearBounds;
|
||||
|
|
|
@ -25,6 +25,14 @@ initWithFrame:
|
|||
- (id) initWithFrame:(NSRect) frameRect
|
||||
{
|
||||
NSPoint pt;
|
||||
NSBezierPath *path;
|
||||
|
||||
path = checker = [NSBezierPath new];
|
||||
[path setLineWidth: 0.3];
|
||||
[path moveToPoint: NSMakePoint (-16, -16)];
|
||||
[path relativeLineToPoint: NSMakePoint (32, 32)];
|
||||
[path moveToPoint: NSMakePoint (-16, 16)];
|
||||
[path relativeLineToPoint: NSMakePoint (32, -32)];
|
||||
|
||||
origin[0] = 0.333;
|
||||
origin[1] = 0.333;
|
||||
|
@ -283,21 +291,17 @@ Rect is in global world (unscaled) coordinates
|
|||
float top, bottom;
|
||||
int left, right;
|
||||
int gridsize;
|
||||
char text[10];
|
||||
BOOL showcoords;
|
||||
NSMutableDictionary *attribs = [NSMutableDictionary dictionary];
|
||||
|
||||
showcoords =[quakeed_i showCoordinates];
|
||||
|
||||
PSsetlinewidth (0);
|
||||
|
||||
gridsize =[xyview_i gridsize];
|
||||
|
||||
left = _bounds.origin.x;
|
||||
right = 24;
|
||||
//Sys_Printf ("gridsize: %d left: %d right: %d\n", gridsize, left, right);
|
||||
bottom = rect.origin.y - 1;
|
||||
top = rect.origin.y + rect.size.height + 2;
|
||||
|
||||
//
|
||||
// grid
|
||||
//
|
||||
|
@ -321,7 +325,8 @@ Rect is in global world (unscaled) coordinates
|
|||
[path lineToPoint:NSMakePoint (right, y)];
|
||||
}
|
||||
// endUserPath (upath, dps_ustroke);
|
||||
PSsetrgbcolor (0.8, 0.8, 1.0); // thin grid color
|
||||
[[NSColor colorWithCalibratedRed: 0.8 green: 0.8 blue: 1.0 alpha: 1.0]
|
||||
set]; // thin grid color
|
||||
[path stroke];
|
||||
}
|
||||
//
|
||||
|
@ -345,7 +350,8 @@ Rect is in global world (unscaled) coordinates
|
|||
}
|
||||
|
||||
// endUserPath (upath, dps_ustroke);
|
||||
PSsetgray (12.0 / 16.0);
|
||||
[[NSColor colorWithCalibratedWhite: 12.0 / 16.0 alpha: 1.0]
|
||||
set];
|
||||
[path stroke];
|
||||
|
||||
//
|
||||
|
@ -362,15 +368,14 @@ Rect is in global world (unscaled) coordinates
|
|||
stopy -= 64;
|
||||
|
||||
[path removeAllPoints];
|
||||
PSsetgray (0); // for text
|
||||
PSrotate (0);
|
||||
[[NSColor colorWithCalibratedWhite: 0.0 / 16.0 alpha: 1.0]
|
||||
set]; // for text
|
||||
[[NSFont systemFontOfSize: 10] set];
|
||||
|
||||
for (; y <= stopy; y += 64) {
|
||||
if (showcoords) {
|
||||
sprintf (text, "%i", y);
|
||||
PSmoveto (left, y);
|
||||
PSshow (text);
|
||||
NSString *s = [NSString stringWithFormat: @"%i", y];
|
||||
[s drawAtPoint: NSMakePoint (left, y) withAttributes: attribs];
|
||||
}
|
||||
[path moveToPoint:NSMakePoint (left + 24, y)];
|
||||
[path lineToPoint:NSMakePoint (right, y)];
|
||||
|
@ -382,18 +387,21 @@ Rect is in global world (unscaled) coordinates
|
|||
_bounds.origin.y + _bounds.size.height)];
|
||||
|
||||
// endUserPath (upath, dps_ustroke);
|
||||
PSsetgray (10.0 / 16.0);
|
||||
[[NSColor colorWithCalibratedWhite: 10.0 / 16.0 alpha: 1.0]
|
||||
set];
|
||||
[path stroke];
|
||||
|
||||
//
|
||||
// origin
|
||||
//
|
||||
PSsetlinewidth (5);
|
||||
PSsetgray (4.0 / 16.0);
|
||||
PSmoveto (right, 0);
|
||||
PSlineto (left, 0);
|
||||
PSstroke ();
|
||||
PSsetlinewidth (0.15);
|
||||
[[NSColor colorWithCalibratedWhite: 4.0 / 16.0 alpha: 1.0]
|
||||
set];
|
||||
[path removeAllPoints];
|
||||
[path setLineWidth: 5];
|
||||
[path moveToPoint: NSMakePoint (right, 0)];
|
||||
[path lineToPoint: NSMakePoint (left, 0)];
|
||||
[path stroke];
|
||||
[path setLineWidth: 1];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -401,9 +409,13 @@ Rect is in global world (unscaled) coordinates
|
|||
|
||||
-drawZplane
|
||||
{
|
||||
PSsetrgbcolor (0.2, 0.2, 0);
|
||||
PSarc (0, zplane, 4, 0, M_PI * 2);
|
||||
PSfill ();
|
||||
[[NSColor colorWithCalibratedRed: 0.2 green: 0.2 blue: 0.0 alpha: 1.0]
|
||||
set];
|
||||
[path appendBezierPathWithArcWithCenter: NSMakePoint (0, zplane)
|
||||
radius: 4
|
||||
startAngle: 0
|
||||
endAngle: 180];
|
||||
[path fill];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -422,7 +434,7 @@ drawSelf
|
|||
|
||||
// allways draw the entire bar
|
||||
//visRect =[self visibleRect];
|
||||
rects = [self bounds];
|
||||
rects = [self visibleRect];
|
||||
|
||||
// erase window
|
||||
NSEraseRect (rects);
|
||||
|
@ -431,7 +443,7 @@ drawSelf
|
|||
[self drawGrid:rects];
|
||||
|
||||
// draw zplane
|
||||
// [self drawZplane];
|
||||
// [self drawZplane]; FIXME zplane doesn't do anything yet
|
||||
|
||||
// draw all entities
|
||||
[map_i makeUnselectedPerform:@selector (ZDrawSelf)];
|
||||
|
@ -449,13 +461,18 @@ XYDrawSelf
|
|||
*/
|
||||
-XYDrawSelf
|
||||
{
|
||||
PSsetrgbcolor (0, 0.5, 1.0);
|
||||
PSsetlinewidth (0.15);
|
||||
PSmoveto (origin[0] - 16, origin[1] - 16);
|
||||
PSrlineto (32, 32);
|
||||
PSmoveto (origin[0] - 16, origin[1] + 16);
|
||||
PSrlineto (32, -32);
|
||||
PSstroke ();
|
||||
NSBezierPath *path;
|
||||
NSAffineTransform *trans;
|
||||
|
||||
[[NSColor colorWithCalibratedRed: 0 green: 0.5 blue: 1.0 alpha: 1.0] set];
|
||||
|
||||
trans = [NSAffineTransform transform];
|
||||
[trans translateXBy: origin[0] yBy: origin[1]];
|
||||
|
||||
path = [checker copy];
|
||||
[path transformUsingAffineTransform: trans];
|
||||
[path stroke];
|
||||
[path release];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue