Monday, June 14, 2021

Edward Lance Lorilla

Edward Lance Lorilla


【Visual Studio Visual Csharp】Threading

Posted: 13 Jun 2021 08:10 AM PDT

 using System;

using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;using System.Threading;namespace threadC{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Thread first_thread = new Thread(new ThreadStart(first_thread_procedure)); Thread second_thread = new Thread(new ThreadStart(second_thread_procedure)); first_thread.Start(); second_thread.Start(); first_thread.Join(); } public void first_thread_procedure() { Thread.Sleep(500); MessageBox.Show("Hello from first thread :) ... "); } public void second_thread_procedure() { Thread.Sleep(1000); MessageBox.Show("Hello from second thread :) ... "); } }}

【PYTHON】Bitcoin data analysis

Posted: 13 Jun 2021 08:09 AM PDT

 itunes_df['Seconds'] = itunes_df['Milliseconds'] / 1000


itunes_df['len_byte_ratio'] = itunes_df['Milliseconds'] / itunes_df['Bytes']


genre_dict = {'metal': 'Metal', 'met': 'Metal'}

itunes_df['Genre'].replace(genre_dict)


itunes_df['Genre'].apply(lambda x: x.lower())


# the above is the same as this

def lowercase(x):

  return x.lower()


itunes_df['Genre'].apply(lowercase)


# but using built-in functions is almost always faster

itunes_df['Genre'].str.lower()


# this is a common sentiment analysis library; polarity is positive/negative sentiment,

# subjectivety is subjective/objective rating.

from textblob import TextBlob

test = TextBlob("Textblob is amazingly simple to use. What great fun!")

test.sentiment


test.sentiment.polarity


# it would be better than apply to use a list comprehension to get sentiment of track names, like this

itunes_df['Track_sentiment'] = [TextBlob(x).sentiment.polarity for x in itunes_df['Track']]


# but, if we wanted to mix polarity and subjectivity into one column, it would be best to use apply:

def pol_sub_mix(x):

  tb = TextBlob(x)

  return tb.polarity * tb.subjectivity


itunes_df['Track_pol_sub_mix'] = itunes_df['Track'].apply(pol_sub_mix)


# delete these columns

itunes_df.drop(['Track_pol_sub_mix', 'Track_sentiment'], inplace=True, axis=1)


# currently doesn't work with python 3.9

import swifter

itunes_df['Genre'].swifter.apply(lambda x: x.lower())


itunes_df.to_csv('cleaned_itunes_data.csv', index=False)


itunes_df.groupby('Genre').mean()['Seconds'].sort_values().head()


btc_df = pd.read_csv('bitcoin_price.csv')

btc_df.head()


btc_df['symbol'].unique()


btc_df.drop('symbol', axis=1, inplace=True)


btc_df['time'] = pd.to_datetime(btc_df['time'], unit='ms')


btc_df['time'].dtype


btc_df.info()


btc_df.set_index('time', inplace=True)


btc_df.head()


btc_df[['close']].plot(logy=True)


f = plt.figure(figsize=(5.5, 5.5))

btc_df.iloc[-3000:][['close']].plot(logy=True, figsize=(5.5, 5.5))

f.patch.set_facecolor('w')  # sets background color behind axis labels

plt.tight_layout()  # auto-adjust margins

plt.savefig('B17030_04_11.png', dpi=300)


btc_df2 = pd.read_csv('bitcoin_price.csv', index_col='time', parse_dates=['time'], infer_datetime_format=True)


date_parser = lambda x: pd.to_datetime(x, unit='ms')

btc_df2 = pd.read_csv('bitcoin_price.csv', index_col='time', parse_dates=['time'], date_parser=date_parser)

btc_df2.head()


btc_df.loc['2019']

【ANDROID STUDIO】 Query Parameter Retrofit With Kotlin Coroutines

Posted: 13 Jun 2021 08:07 AM PDT

package com.example.myapplication

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.lifecycle.LiveData
import androidx.lifecycle.Observer
import androidx.lifecycle.liveData
import kotlinx.android.synthetic.main.activity_main.*
import retrofit2.Response

class MainActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val retService = RetrofitInstance
.getRetrofitInstance()
.create(AlbumService::class.java)
val responseLiveData: LiveData<Response<Albums>> = liveData {
//val response = retService.getAlbums()
val response = retService.getSortedAlbums(3)

emit(response)
}
responseLiveData.observe(this, Observer {
val albumsList = it.body()?.listIterator()
if (albumsList != null) {
while (albumsList.hasNext()) {
val albumsItem = albumsList.next()
val result = " " + "Album Title : ${albumsItem.title}" + "\n" +
" " + "Album id : ${albumsItem.id}" + "\n" +
" " + "User id : ${albumsItem.userId}" + "\n\n\n"
text_view.append(result)
}
}
})

}
}

package com.example.myapplication

import retrofit2.Response
import retrofit2.http.GET
import retrofit2.http.Query

interface AlbumService {
@GET("/albums")
suspend fun getAlbums() : Response<Albums>
@GET("/albums")
suspend fun getSortedAlbums(@Query("userId") userId:Int) :Response<Albums>

}

【FLUTTER ANDROID STUDIO and IOS】Sqlite CRUD

Posted: 13 Jun 2021 08:05 AM PDT

 import 'package:flutter/material.dart';

import 'package:flutter/services.dart';
import 'model.dart';
import 'dataBase.dart';
import 'itemCardWidget.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(
brightness: Brightness.dark,
floatingActionButtonTheme: FloatingActionButtonThemeData(
backgroundColor: Colors.blue,
)),
home: MyHomePage(),
);
}
}

class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
final DbManager dbManager = new DbManager();

Model model;
List<Model> modelList;
TextEditingController input1 = TextEditingController();
TextEditingController input2 = TextEditingController();
FocusNode input1FocusNode;
FocusNode input2FocusNode;

@override
void initState() {
input1FocusNode = FocusNode();
input2FocusNode = FocusNode();
super.initState();
}

@override
void dispose() {
input1FocusNode.dispose();
input2FocusNode.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Sqlite Demo'),
),
floatingActionButton: FloatingActionButton(
onPressed: () {
showDialog(
context: context,
builder: (context) {
return DialogBox().dialog(
context: context,
onPressed: () {
Model model = new Model(
fruitName: input1.text, quantity: input2.text);
dbManager.insertModel(model);
setState(() {
input1.text = "";
input2.text = "";
});
Navigator.of(context).pop();
},
textEditingController1: input1,
textEditingController2: input2,
input1FocusNode: input1FocusNode,
input2FocusNode: input2FocusNode,
);
});
},
child: Icon(
Icons.add,
color: Colors.white,
),
),
body: FutureBuilder(
future: dbManager.getModelList(),
builder: (context, snapshot) {
if (snapshot.hasData) {
modelList = snapshot.data;
return ListView.builder(
itemCount: modelList.length,
itemBuilder: (context, index) {
Model _model = modelList[index];
return ItemCard(
model: _model,
input1: input1,
input2: input2,
onDeletePress: () {
dbManager.deleteModel(_model);
setState(() {});
},
onEditPress: () {
input1.text = _model.fruitName;
input2.text = _model.quantity;
showDialog(
context: context,
builder: (context) {
return DialogBox().dialog(
context: context,
onPressed: () {
Model __model = Model(
id: _model.id,
fruitName: input1.text,
quantity: input2.text);
dbManager.updateModel(__model);

setState(() {
input1.text = "";
input2.text = "";
});
Navigator.of(context).pop();
},
textEditingController2: input2,
textEditingController1: input1);
});
},
);
},
);
}
return Center(
child: CircularProgressIndicator(),
);
},
),
);
}
}

class Model {
int id;
String fruitName;
String quantity;

Model({this.id, this.fruitName, this.quantity});

Model fromJson(json) {
return Model(
id: json['id'],
fruitName: json['fruitName'],
quantity: json['quantity']);
}

Map<String, dynamic> toJson() {
return {'fruitName': fruitName, 'quantity': quantity};
}

}

import 'dart:async';
import 'package:path/path.dart';
import 'package:sqflite/sqflite.dart';

import 'model.dart';

class DbManager {
Database _database;

Future openDb() async {
_database = await openDatabase(join(await getDatabasesPath(), "ss.db"),
version: 1, onCreate: (Database db, int version) async {
await db.execute(
"CREATE TABLE model(id INTEGER PRIMARY KEY autoincrement, fruitName TEXT, quantity TEXT)",
);
});
return _database;
}

Future insertModel(Model model) async {
await openDb();
return await _database.insert('model', model.toJson());
}

Future<List<Model>> getModelList() async {
await openDb();
final List<Map<String, dynamic>> maps = await _database.query('model');

return List.generate(maps.length, (i) {
return Model(
id: maps[i]['id'],
fruitName: maps[i]['fruitName'],
quantity: maps[i]['quantity']);
});
}

Future<int> updateModel(Model model) async {
await openDb();
return await _database.update('model', model.toJson(),
where: "id = ?", whereArgs: [model.id]);
}

Future<void> deleteModel(Model model) async {
await openDb();
await _database.delete('model', where: "id = ?", whereArgs: [model.id]);
}
}

import 'package:flutter/material.dart';
import 'dataBase.dart';
import 'model.dart';

class ItemCard extends StatefulWidget {
Model model;
TextEditingController input1;
TextEditingController input2;
Function onDeletePress;
Function onEditPress;

ItemCard({this.model,
this.input1,
this.input2,
this.onDeletePress,
this.onEditPress});

@override
_ItemCardState createState() => _ItemCardState();
}

class _ItemCardState extends State<ItemCard> {
final DbManager dbManager = new DbManager();

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Card(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'Name: ${widget.model.fruitName}',
style: TextStyle(fontSize: 15),
),
Text(
'Quantity: ${widget.model.quantity}',
style: TextStyle(
fontSize: 15,
),
),
],
),
Row(
children: [
CircleAvatar(
backgroundColor: Colors.white,
child: IconButton(
onPressed: widget.onEditPress,
icon: Icon(
Icons.edit,
color: Colors.blueAccent,
),
),
),
SizedBox(
width: 15,
),
CircleAvatar(
backgroundColor: Colors.white,
child: IconButton(
onPressed: widget.onDeletePress,
icon: Icon(
Icons.delete,
color: Colors.red,
),
),
)
],
),
],
),
),
),
);
}
}

class DialogBox {
Widget dialog({BuildContext context,
Function onPressed,
TextEditingController textEditingController1,
TextEditingController textEditingController2,
FocusNode input1FocusNode,
FocusNode input2FocusNode}) {
return AlertDialog(
title: Text("Enter Data"),
content: Container(
height: 100,
child: Column(
children: [
TextFormField(
controller: textEditingController1,
keyboardType: TextInputType.text,
focusNode: input1FocusNode,
decoration: InputDecoration(hintText: "Fruit Name"),
autofocus: true,
onFieldSubmitted: (value) {
input1FocusNode.unfocus();
FocusScope.of(context).requestFocus(input2FocusNode);
},
),
TextFormField(
controller: textEditingController2,
keyboardType: TextInputType.number,
focusNode: input2FocusNode,
decoration: InputDecoration(hintText: "Quantity"),
onFieldSubmitted: (value) {
input2FocusNode.unfocus();
},
),
],
),
),
actions: [
MaterialButton(
onPressed: () {
Navigator.of(context).pop();
},
color: Colors.blueGrey,
child: Text(
"Cancel",
),
),
MaterialButton(
onPressed: onPressed,
child: Text("Submit"),
color: Colors.blue,
)
],
);
}
}

【GAMEMAKER】save and load text file

Posted: 13 Jun 2021 08:03 AM PDT

 Information about object: obj_textbox

Sprite:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

w = 50
h = 20
draw_set_font(fnt_courier)
tw = 8
th = 12
ins = 1

lines = 1
top = 0
left = 0
px = 0
py = 0
line[0] = ''
file = ""
saved = true
Step Event:
execute code:

if py < top { top = py }
if py > top + h - 1 { top = py - h + 1 }
if px < left { left = px }
if px > left + w - 1 { left = px - w + 1 }

if keyboard_string != '' {
line[py] = string_copy(line[py],1,px) + keyboard_string + string_copy(line[py],px+ins,string_length(line[py])-px)
px += string_length(keyboard_string)
keyboard_string = ''
saved = false
}

if line[0] = "" && lines = 1 && file = "" { saved = true }

room_caption = "Gamepad - "
if file = "" { room_caption += "Untitled Document" }
else { room_caption += filename_name(file) }
if !saved { room_caption += "*" }
room_caption += " ("+string(obj_right.size)+"b)"

if mouse_x > x && mouse_y > y && mouse_x < x + w*tw && mouse_y < y + h*th {
mx = (mouse_x - x) / tw
my = (mouse_y - y) / th
window_set_cursor(cr_beam)
} else { window_set_cursor(cr_default) }

if top + h > max(h,lines) { top = lines - h }
Keyboard Event for <Backspace> Key:
execute code:

keyboard_clear(vk_backspace)
saved = false
if px = 0 {
if py = 0 { exit }
px = string_length(line[py-1])
line[py-1] += line[py]
for (m = py; m < lines-1; m += 1) { line[m] = line[m+1] }
lines -= 1
py -= 1
exit
}
line[py] = string_delete(line[py],px,1)
px -= 1
Keyboard Event for <Enter> Key:
execute code:

keyboard_clear(vk_enter)
saved = false
for (m = lines-1; m > py; m -= 1) {
line[m+1] = line[m]
}
line[py+1] = string_copy(line[py],px+ins,string_length(line[py])-px)
line[py] = string_copy(line[py],1,px)
py += 1
px = 0
lines += 1
Keyboard Event for <Page Up> Key:
execute code:

keyboard_clear(vk_pageup)
top = max(top - h,0)
py = max(py - h,0)
px = min(px,string_length(line[py]))
Keyboard Event for <Page Down> Key:
execute code:

keyboard_clear(vk_pagedown)
top = max(0,min(top + h,lines-h))
py = min(py + h,lines-1)
px = min(px,string_length(line[py]))
Keyboard Event for <Left> Key:
execute code:

keyboard_clear(vk_left)
if px = 0 && py = 0 { exit }
px -= 1
if px = -1 {
py -= 1
px = string_length(line[py])
}
Keyboard Event for <Up> Key:
execute code:

keyboard_clear(vk_up)
if py = 0 { exit }
py -= 1
px = min(px,string_length(line[py]))
Keyboard Event for <Right> Key:
execute code:

keyboard_clear(vk_right)
if px = string_length(line[py]) && py = lines-1 { exit }
px += 1
if px > string_length(line[py]) {
py += 1
px = 0
}
Keyboard Event for <Down> Key:
execute code:

keyboard_clear(vk_down)
if py = lines - 1 { exit }
py += 1
px = min(px,string_length(line[py]))
Keyboard Event for <Delete> Key:
execute code:

keyboard_clear(vk_delete)
saved = false
if px = string_length(line[py]) {
if py = lines - 1 { exit }
line[py] += line[py+1]
for (m = py+1; m < lines-1; m += 1) { line[m] = line[m+1] }
lines -= 1
exit
}
line[py] = string_delete(line[py],px+1,1)
Mouse Event for Glob Left Button:
execute code:

if window_get_cursor() = cr_beam {
py = min(floor(my+top),lines-1)
px = min(round(mx+left),string_length(lines[py]))

if py < top { top = py }
if py > top + h - 1 { top = py - h + 1 }
if px < left { left = px }
if px > left + w - 1 { left = px - w + 1 }
}
Draw Event:
for other object: execute code:

draw_set_color(c_white)
draw_rectangle(x-2,y+1,x+w*tw,y+h*th+2,false)
draw_set_color(c_black)
draw_line(x-2,y+1,x+w*tw,y+1)
draw_line(x-2,y+1,x-2,y+h*th+2)
draw_line(x+w*tw+15,y+1,x+w*tw+15,y+h*th+2)
draw_line(x-2,y+h*th+17,x+w*tw,y+h*th+17)
draw_set_halign(fa_right)
draw_text(x+w*tw/2,y+h*th,string(px)+', '+string(py+1))
draw_set_halign(fa_left)
draw_text(x+w*tw/2,y+h*th,'/'+string(lines))
draw_text(0,0,"Made by IsmAvatar")
for (m = top; m < min(top + h,lines); m += 1) {
if m = py {
draw_set_color(c_red)
if ins = 1
draw_text(x+(px-left)*tw-tw/3,y+(m-top)*12,'|')
else
draw_text(x+(px-left)*tw-tw/3,y+(m-top)*12,'/')
}
draw_set_color(c_black)
draw_text(x,y+(m-top)*12,string_copy(string_replace_all(line[m],'#','\#'),left+1,w))
}
Key Press Event for <End> Key:
execute code:

if keyboard_check(vk_control) { py = lines - 1 }
px = string_length(line[py])
Key Press Event for <Home> Key:
execute code:

px = 0
if keyboard_check(vk_control) { py = 0 }
Key Press Event for <Insert> Key:
execute code:

ins = 3 - ins
Key Press Event for F2 Key:
execute code:

if !saved {
if(show_question(("File changed. Save changes?"))){

keyboard_key_press(vk_f5)
keyboard_key_release(vk_f5)
}else{
exit
}
}


lines = 1
top = 0
left = 0
px = 0
py = 0
line[0] = ''
file = ""
saved = true
Key Press Event for F4 Key:
execute code:

lastfile = file
file = get_save_filename("Text files (*.txt)|*.txt","")
if file = "" {
file = lastfile
exit
}
if file_exists(file) {
if !show_question("File exists. Overwrite?") {
file = lastfile
exit
}
}
f = file_text_open_write(file)
file_text_close(f)
if !file_exists(file) {
show_message("Could not save file")
file = lastfile
exit
}
f = file_text_open_write(file)
for (m = 0; m < lines; m += 1) {
file_text_write_string(f,line[m])
if m < lines - 1 { file_text_writeln(f) }
}
file_text_close(f)
saved = true
Key Press Event for F5 Key:
execute code:

if file = "" {
keyboard_key_press(vk_f4)
keyboard_key_release(vk_f4)
exit
}
f = file_text_open_write(file)
for (m = 0; m < lines; m += 1) {
file_text_write_string(f,line[m])
if m < lines - 1 { file_text_writeln(f) }
}
file_text_close(f)
saved = true
Key Press Event for F9 Key:
execute code:

if !saved {
if(show_question(("File changed. Save changes?"))){

keyboard_key_press(vk_f5)
keyboard_key_release(vk_f5)
}else{
exit
}
}


lastfile = file
file = get_open_filename("Text files (*.txt)|*.txt","")
if file = "" {
file = lastfile
exit
}
if !file_exists(file) {
file = filename_change_ext(file,".txt")
if !file_exists(file) {
show_message(file+"#"+"File not found")
file = lastfile
exit
}
}
f = file_text_open_read(file)
for (lines = 0; !file_text_eof(f); lines += 1) {
line[lines] = file_text_read_string(f)
file_text_readln(f)
}
file_text_close(f)
top = 0
left = 0
px = 0
py = 0
saved = true

Information about object: obj_new
Sprite: spr_new
Solid: false
Visible: true
Depth:
-1
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Mouse Event for Left Pressed:
execute code:

keyboard_key_press(vk_f2)
keyboard_key_release(vk_f2)
Draw Event:
execute code:

draw_this()

Information about object: obj_saveas
Sprite: spr_saveas
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Mouse Event for Left Pressed:
execute code:

keyboard_key_press(vk_f4)
keyboard_key_release(vk_f4)
Draw Event:
execute code:

draw_this()

Information about object: obj_save
Sprite: spr_save
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Mouse Event for Left Pressed:
execute code:

keyboard_key_press(vk_f5)
keyboard_key_release(vk_f5)
Draw Event:
execute code:

draw_this()

Information about object: obj_load
Sprite: spr_load
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Mouse Event for Left Pressed:
execute code:

keyboard_key_press(vk_f9)
keyboard_key_release(vk_f9)
Draw Event:
execute code:

draw_this()

draw_sprite(sprite_index,0,x,y)
if position_meeting(mouse_x,mouse_y,self) { draw_sprite(spr_box,0,x,y) }

Information about object: obj_up
Sprite: spr_up
Solid: false
Visible: true
Depth: 0
Persistent:
false
Parent:
Children:
Mask:

No Physics Object

Create Event:
execute code:

x = obj_textbox.x + obj_textbox.w * obj_textbox.tw
y = obj_textbox.y + 1
Step Event:
execute code:

image_single = (obj_textbox.top > 0)
Mouse Event for Left Button:
execute code:

if image_index {
obj_textbox.top -= 1
obj_textbox.py -= 1
obj_textbox.px = min(string_length(obj_textbox.line[obj_textbox.py]),obj_textbox.px)
}

Information about object: obj_down
Sprite: spr_down
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Create Event:
execute code:

x = obj_textbox.x + obj_textbox.w * obj_textbox.tw
y = obj_textbox.y + obj_textbox.h * obj_textbox.th + 2
Step Event:
execute code:

image_single = (obj_textbox.lines > obj_textbox.top + obj_textbox.h)
Mouse Event for Left Button:
execute code:

if image_index {
obj_textbox.top += 1
obj_textbox.py += 1
obj_textbox.px = min(string_length(obj_textbox.line[obj_textbox.py]),obj_textbox.px)
}


Information about object: obj_left
Sprite: spr_left
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Create Event:
execute code:

x = obj_textbox.x - 2
y = obj_textbox.y + obj_textbox.h * obj_textbox.th + 2
Step Event:
execute code:

image_single = (obj_textbox.left > 0)
Mouse Event for Left Button:
execute code:

if image_index {
obj_textbox.left -= 1
obj_textbox.px -= 1
}

Information about object: obj_right
Sprite: spr_right
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Create Event:
execute code:

x = obj_textbox.x + obj_textbox.w * obj_textbox.tw
y = obj_textbox.y + obj_textbox.h * obj_textbox.th + 2
ml = 0
size = 0
alarm = room_speed
Alarm Event for alarm 0:
execute code:

ml = 0
size = 0
for (m = 0; m < obj_textbox.lines; m += 1) {
size += string_length(obj_textbox.line[m]) + 2
ml = max(string_length(obj_textbox.line[m]),ml)
}
size -= 2
alarm = room_speed
Step Event:
execute code:

image_single = (obj_textbox.left + obj_textbox.w <= ml)
Mouse Event for Left Button:
execute code:

if image_index {
obj_textbox.left += 1
obj_textbox.px += 1
}

Information about object: obj_vbar
Sprite:
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Create Event:
execute code:

x = obj_up.x
Y = obj_up.y + obj_up.sprite_height
y = Y
th = obj_down.y - obj_up.y - obj_down.sprite_height - obj_up.sprite_height
bh = max(min(obj_textbox.h / obj_textbox.lines,1) * th,4)
Step Event:
execute code:

th = obj_down.y - obj_up.y - obj_down.sprite_height - obj_up.sprite_height
bh = max(min(obj_textbox.h / obj_textbox.lines,1) * th,4)
y = Y + (obj_textbox.top / max(obj_textbox.lines,obj_textbox.h)) * th
Draw Event:
execute code:

draw_set_color(make_color_rgb(224,224,224))
draw_rectangle(x,Y,x+16,Y+th,false)
draw_set_color(c_ltgray)
draw_rectangle(x+2,y+2,x+14,y+bh-1,false)
draw_set_color(c_black)
draw_line(x+15,y,x+15,y+bh)
draw_line(x,y+bh,x+16,y+bh)
draw_set_color(c_gray)
draw_line(x+1,y+bh-1,x+15,y+bh-1)
draw_line(x+14,y+1,x+14,y+bh-1)
draw_set_color(make_color_rgb(222,222,222))
draw_line(x,y,x+15,y)
draw_line(x,y,x,y+bh)
draw_set_color(c_white)
draw_line(x+1,y,x+1,y+bh-1)
draw_line(x,y+1,x+14,y+1)
draw_set_color(c_black)

Information about object: obj_hbar
Sprite:
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Create Event:
execute code:

y = obj_left.y
X = obj_left.x + obj_left.sprite_width
x = X
w = obj_textbox.w - 1
tw = obj_right.x - obj_left.x - obj_right.sprite_width - obj_left.sprite_width
bw = max(min(w / max(obj_right.ml,obj_textbox.left+w-1),1) * tw,4)
Step Event:
execute code:

tw = obj_right.x - obj_left.x - obj_right.sprite_width - obj_left.sprite_width
bw = max(min(w / max(obj_right.ml,obj_textbox.left+w),1) * tw,4)
x = X + (obj_textbox.left / max(max(obj_right.ml,obj_textbox.left+w),w)) * tw
Draw Event:
execute code:

draw_set_color(make_color_rgb(224,224,224))
draw_rectangle(X,y,X+tw,y+16,false)
draw_set_color(c_ltgray)
draw_rectangle(x+2,y+2,x+bw-1,y+14,false)
draw_set_color(c_black)
draw_line(x,y+15,x+bw,y+15)
draw_line(x+bw,y,x+bw,y+16)
draw_set_color(c_gray)
draw_line(x+bw-1,y+1,x+bw-1,y+15)
draw_line(x+1,y+14,x+bw-1,y+14)
draw_set_color(make_color_rgb(222,222,222))
draw_line(x,y,x,y+15)
draw_line(x,y,x+bw,y)
draw_set_color(c_white)
draw_line(x,y+1,x+bw-1,y+1)
draw_line(x+1,y,x+1,y+14)
draw_set_color(c_black)


No comments:

Post a Comment