From 02fad28c821fc246bddfdeeb41f6e825676bdc89 Mon Sep 17 00:00:00 2001 From: otya128 Date: Wed, 7 Dec 2016 22:31:51 +0900 Subject: [PATCH] Implement BACKCOLOR --- SMILEBASIC/builtinfunctions.d | 8 ++++++++ SMILEBASIC/petitcomputer.d | 14 ++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/SMILEBASIC/builtinfunctions.d b/SMILEBASIC/builtinfunctions.d index 7fde168..d367753 100644 --- a/SMILEBASIC/builtinfunctions.d +++ b/SMILEBASIC/builtinfunctions.d @@ -315,6 +315,14 @@ class BuiltinFunction p.BGvisible = cast(bool)BG; p.sprite.visible = cast(bool)sprite; } + static void BACKCOLOR(PetitComputer p, int color) + { + p.backcolor = color; + } + static int BACKCOLOR(PetitComputer p) + { + return p.backcolor; + } static void XON(PetitComputer p, Value mode/*!?!???!?*/) { } diff --git a/SMILEBASIC/petitcomputer.d b/SMILEBASIC/petitcomputer.d index 1ebebf6..5f6ac47 100644 --- a/SMILEBASIC/petitcomputer.d +++ b/SMILEBASIC/petitcomputer.d @@ -487,6 +487,15 @@ class PetitComputer m_touch = to; } } + int petitcomBackcolor; + void backcolor(int color) + { + petitcomBackcolor = color; + } + int backcolor() + { + return petitcomBackcolor; + } void render() { try @@ -621,6 +630,11 @@ class PetitComputer { chScreen(0, 0, 320, 480); } + { + ubyte r, g, b, a; + RGBRead(petitcomBackcolor, r, g, b, a); + glClearColor(r / 255f, g / 255f, b / 255f, 1); + } //描画の順位 //sprite>GRP>console>BG glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);