Оберон-клуб «ВЄДАsoft»

Твердыня модульных языков
Текущее время: 18 июн 2025, 17:00

Часовой пояс: UTC + 2 часа




Начать новую тему Ответить на тему  [ Сообщений: 14 ]  На страницу Пред.  1, 2
Автор Сообщение
 Заголовок сообщения: Re: Drawing some bytes to the screen
СообщениеДобавлено: 28 июн 2013, 21:40 
Не в сети

Сообщения: 104
I think DrawTile sounds good

I understand why you have drawtile and drawtile8x8 so it can be changed easily per platform

but what is the difference between drawtile and drawtilemono?
and what does DEFDATAREL do?


Вернуться к началу
 Профиль  
Ответить с цитатой  
 Заголовок сообщения: Re: Drawing some bytes to the screen
СообщениеДобавлено: 29 июн 2013, 01:03 
Не в сети
Аватара пользователя

Сообщения: 1019
Откуда: Днепропетровская обл.
slenkar писал(а):
what is the difference between drawtile and drawtilemono?
DrawTile gets color attributes from a specified tile data, and needs 8 + 1 bytes of data for tile 8x8 (8 bytes for pixels and 1 for color attribute). For non-ZX platform the such tiles may be colored (has many colors, greater than 2) and be able to has non-Spectrum formats (BMP, PNG, etc, even vector formats). That's why for portable code is better not to place the tiles data directly into the user-level code (by DATA), and make a separate module Rsrc that will defines different graphic (and other) resources for different platforms.

DrawMonoTile gets color attributes from internal variable that specified by procedure SetColors. For non-ZX platform such tiles are always monochrome (two-colored), as for ZX. And a color is specified by the same constants named identically, i.e. YellowOnBlue tile looks the same as on ZX, as under DOS, etc.

slenkar писал(а):
and what does DEFDATAREL do?
DEFDATAREL defines a block of data (relative, relocatable). First parameter after running the procedure has the data address. Second parameter must be = data size, and it is needed for correct jump over the data to next machine code placed after the data.

I must optimize this procedure, and I have to write the non-relocatable variant that will be named DEFDATA.

READ just reads bytes. Perhaps we need procedures READINT, READSET, READSINT, READLINT, READCHAR, READBOOL, etc. Just like we need DATAINT*, DATASET*, DATACHAR*, DATABOOL*, etc. I intend to add these features as they become necessary.


Вернуться к началу
 Профиль  
Ответить с цитатой  
 Заголовок сообщения: Re: Drawing some bytes to the screen
СообщениеДобавлено: 29 июн 2013, 07:27 
Не в сети

Сообщения: 104
thanks

the tile variable like 'square' has to be declared a global to work

so it cant be declared in a procedure


Вернуться к началу
 Профиль  
Ответить с цитатой  
 Заголовок сообщения: Re: Drawing some bytes to the screen
СообщениеДобавлено: 29 июн 2013, 12:31 
Не в сети
Аватара пользователя

Сообщения: 1019
Откуда: Днепропетровская обл.
slenkar писал(а):
the tile variable like 'square' has to be declared a global to work

so it cant be declared in a procedure
Yeap. A resource variable is like a constant - for example, it may be assigned when module Rsrc initialized. As:

Код: "OBERON"
  1. MODULE Rsrc; (** Resource module - ver. 1.0 for ZX Spectrum *)
  2. IMPORT B := Basic, GrTiles;
  3. CONST
  4. TileSize = 8 + 1; (* bytes *)
  5. VAR
  6. Square-, Flower-, Man-, Stone-, Wall-, Grass-, ... : GrTiles.Tile; (* Exported as r/o. *)
  7. BEGIN (* Init tiles: *)
  8. B.DEFDATA(Square, TileSize); B.DATA(...);
  9. B.DEFDATA(Flower, TileSize); B.DATA(...);
  10. ...
  11. B.DEFDATA(Grass, TileSize); B.DATA(...);
  12. END Rsrc.
Here we have a good incapsulation - after initializing the module all the exported variables are assigned to appropriate tiles.

Код: "OBERON"
  1. (* It's cross-platform code: *)
  2. IMPORT GrTiles, Rsrc;
  3. BEGIN
  4. GrTiles.DrawTile(10, 10, Rsrc.Square);
  5. ...

P.S. I think, except tiles (that are small squares with fixed size) we also need sprites (squares or rectangles with different sizes, specified directly in a sprite's data). For it, we'll start a new module GrSprite (or GrSprt?).


Вернуться к началу
 Профиль  
Ответить с цитатой  
Показать сообщения за:  Поле сортировки  
Начать новую тему Ответить на тему  [ Сообщений: 14 ]  На страницу Пред.  1, 2

Часовой пояс: UTC + 2 часа


Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 1


Вы не можете начинать темы
Вы не можете отвечать на сообщения
Вы не можете редактировать свои сообщения
Вы не можете удалять свои сообщения
Вы не можете добавлять вложения

Найти:
Перейти:  
Создано на основе phpBB® Forum Software © phpBB Group
© VEDAsoft Oberon Club