/* Copyright 1996 Acorn Computers Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Title: -> c.pointer */ /* * Purpose: Setting of the pointer shape * Status: Experimental * Copyright: (C) 1988, Acorn Computers Ltd., Cambridge, England. * Revision: 0.01 * Author: A.P. Thompson * History: * 0.01 14-Jul-88 APT created * 13-May-91 ECN turned off stack checking */ #include <stddef.h> #include "h.os" #include "h.sprite" #include "h.pointer" #define OS_SpriteOp 0x2E #define Wimp_SpriteOp 0x400E9 static char pointer__ttab[] = "\0\1\2\3\0\1\2\3\0\1\2\3\0\1\2\3" ; #pragma -s1 /* set pointer shape 2 by scaling the sprite appropriately. Sprites with colours greater than 3 may come out looking dumb. */ os_error *pointer_set_shape(sprite_area *area, sprite_id *spr, int apx, int apy) { os_error *result ; os_regset r ; if (area == sprite_mainarea || area == wimp_spritearea) { r.r[0] = 36; r.r[2] = (int) (spr->s.name); } else { r.r[1] = (int) area; if (spr->tag == sprite_id_addr) { r.r[0] = 512 + 36; r.r[2] = (int) (spr->s.addr); } else { r.r[0] = 256 + 36; r.r[2] = (int) (spr->s.name); } } r.r[3] = 2 ; /* shape number */ r.r[4] = apx ; /* active point */ r.r[5] = apy ; r.r[6] = 0 ; /* scale appropriately */ r.r[7] = (int) pointer__ttab ; result = os_swix(area == wimp_spritearea ? Wimp_SpriteOp : OS_SpriteOp, &r) ; if (result == NULL) { int x = 2 ; os_byte(106, &x, &x) ; } return result ; } /* restore pointer to shape 1 */ void pointer_reset_shape(void) { int x = 1 ; os_byte(106, &x, &x) ; } #pragma -s0 /* end */